[Java] Update auto-generated bindings to LDK 0.0.118
[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_DuplicatePaymentId;
357                 case 22: return LDKBolt12SemanticError_MissingPaths;
358                 case 23: return LDKBolt12SemanticError_InvalidPayInfo;
359                 case 24: return LDKBolt12SemanticError_MissingCreationTime;
360                 case 25: return LDKBolt12SemanticError_MissingPaymentHash;
361                 case 26: return LDKBolt12SemanticError_MissingSignature;
362         }
363         (*env)->FatalError(env, "A call to Bolt12SemanticError.ordinal() from rust returned an invalid value.");
364         abort(); // Unreachable, but will let the compiler know we don't return here
365 }
366 static jclass Bolt12SemanticError_class = NULL;
367 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired = NULL;
368 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain = NULL;
369 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain = NULL;
370 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount = NULL;
371 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount = NULL;
372 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount = NULL;
373 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount = NULL;
374 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency = NULL;
375 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures = NULL;
376 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures = NULL;
377 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription = NULL;
378 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey = NULL;
379 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey = NULL;
380 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey = NULL;
381 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity = NULL;
382 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity = NULL;
383 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity = NULL;
384 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata = NULL;
385 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata = NULL;
386 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata = NULL;
387 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId = NULL;
388 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId = NULL;
389 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths = NULL;
390 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo = NULL;
391 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime = NULL;
392 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash = NULL;
393 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature = NULL;
394 JNIEXPORT void JNICALL Java_org_ldk_enums_Bolt12SemanticError_init (JNIEnv *env, jclass clz) {
395         Bolt12SemanticError_class = (*env)->NewGlobalRef(env, clz);
396         CHECK(Bolt12SemanticError_class != NULL);
397         Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_AlreadyExpired", "Lorg/ldk/enums/Bolt12SemanticError;");
398         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired != NULL);
399         Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnsupportedChain", "Lorg/ldk/enums/Bolt12SemanticError;");
400         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain != NULL);
401         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedChain", "Lorg/ldk/enums/Bolt12SemanticError;");
402         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain != NULL);
403         Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
404         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount != NULL);
405         Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
406         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount != NULL);
407         Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InsufficientAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
408         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount != NULL);
409         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
410         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount != NULL);
411         Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnsupportedCurrency", "Lorg/ldk/enums/Bolt12SemanticError;");
412         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency != NULL);
413         Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnknownRequiredFeatures", "Lorg/ldk/enums/Bolt12SemanticError;");
414         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures != NULL);
415         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedFeatures", "Lorg/ldk/enums/Bolt12SemanticError;");
416         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures != NULL);
417         Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingDescription", "Lorg/ldk/enums/Bolt12SemanticError;");
418         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription != NULL);
419         Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
420         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey != NULL);
421         Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
422         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey != NULL);
423         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
424         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey != NULL);
425         Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
426         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity != NULL);
427         Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
428         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity != NULL);
429         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
430         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity != NULL);
431         Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
432         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata != NULL);
433         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
434         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata != NULL);
435         Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPayerMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
436         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata != NULL);
437         Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPayerId", "Lorg/ldk/enums/Bolt12SemanticError;");
438         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId != NULL);
439         Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_DuplicatePaymentId", "Lorg/ldk/enums/Bolt12SemanticError;");
440         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId != NULL);
441         Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPaths", "Lorg/ldk/enums/Bolt12SemanticError;");
442         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths != NULL);
443         Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidPayInfo", "Lorg/ldk/enums/Bolt12SemanticError;");
444         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo != NULL);
445         Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingCreationTime", "Lorg/ldk/enums/Bolt12SemanticError;");
446         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime != NULL);
447         Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPaymentHash", "Lorg/ldk/enums/Bolt12SemanticError;");
448         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash != NULL);
449         Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingSignature", "Lorg/ldk/enums/Bolt12SemanticError;");
450         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature != NULL);
451 }
452 static inline jclass LDKBolt12SemanticError_to_java(JNIEnv *env, LDKBolt12SemanticError val) {
453         switch (val) {
454                 case LDKBolt12SemanticError_AlreadyExpired:
455                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired);
456                 case LDKBolt12SemanticError_UnsupportedChain:
457                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain);
458                 case LDKBolt12SemanticError_UnexpectedChain:
459                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain);
460                 case LDKBolt12SemanticError_MissingAmount:
461                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount);
462                 case LDKBolt12SemanticError_InvalidAmount:
463                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount);
464                 case LDKBolt12SemanticError_InsufficientAmount:
465                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount);
466                 case LDKBolt12SemanticError_UnexpectedAmount:
467                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount);
468                 case LDKBolt12SemanticError_UnsupportedCurrency:
469                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency);
470                 case LDKBolt12SemanticError_UnknownRequiredFeatures:
471                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures);
472                 case LDKBolt12SemanticError_UnexpectedFeatures:
473                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures);
474                 case LDKBolt12SemanticError_MissingDescription:
475                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription);
476                 case LDKBolt12SemanticError_MissingSigningPubkey:
477                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey);
478                 case LDKBolt12SemanticError_InvalidSigningPubkey:
479                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey);
480                 case LDKBolt12SemanticError_UnexpectedSigningPubkey:
481                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey);
482                 case LDKBolt12SemanticError_MissingQuantity:
483                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity);
484                 case LDKBolt12SemanticError_InvalidQuantity:
485                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity);
486                 case LDKBolt12SemanticError_UnexpectedQuantity:
487                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity);
488                 case LDKBolt12SemanticError_InvalidMetadata:
489                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata);
490                 case LDKBolt12SemanticError_UnexpectedMetadata:
491                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata);
492                 case LDKBolt12SemanticError_MissingPayerMetadata:
493                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata);
494                 case LDKBolt12SemanticError_MissingPayerId:
495                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId);
496                 case LDKBolt12SemanticError_DuplicatePaymentId:
497                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId);
498                 case LDKBolt12SemanticError_MissingPaths:
499                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths);
500                 case LDKBolt12SemanticError_InvalidPayInfo:
501                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo);
502                 case LDKBolt12SemanticError_MissingCreationTime:
503                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime);
504                 case LDKBolt12SemanticError_MissingPaymentHash:
505                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash);
506                 case LDKBolt12SemanticError_MissingSignature:
507                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature);
508                 default: abort();
509         }
510 }
511
512 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_java(JNIEnv *env, jclass clz) {
513         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
514         if (UNLIKELY((*env)->ExceptionCheck(env))) {
515                 (*env)->ExceptionDescribe(env);
516                 (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust threw an exception.");
517         }
518         switch (ord) {
519                 case 0: return LDKCOption_NoneZ_Some;
520                 case 1: return LDKCOption_NoneZ_None;
521         }
522         (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust returned an invalid value.");
523         abort(); // Unreachable, but will let the compiler know we don't return here
524 }
525 static jclass COption_NoneZ_class = NULL;
526 static jfieldID COption_NoneZ_LDKCOption_NoneZ_Some = NULL;
527 static jfieldID COption_NoneZ_LDKCOption_NoneZ_None = NULL;
528 JNIEXPORT void JNICALL Java_org_ldk_enums_COption_1NoneZ_init (JNIEnv *env, jclass clz) {
529         COption_NoneZ_class = (*env)->NewGlobalRef(env, clz);
530         CHECK(COption_NoneZ_class != NULL);
531         COption_NoneZ_LDKCOption_NoneZ_Some = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_Some", "Lorg/ldk/enums/COption_NoneZ;");
532         CHECK(COption_NoneZ_LDKCOption_NoneZ_Some != NULL);
533         COption_NoneZ_LDKCOption_NoneZ_None = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_None", "Lorg/ldk/enums/COption_NoneZ;");
534         CHECK(COption_NoneZ_LDKCOption_NoneZ_None != NULL);
535 }
536 static inline jclass LDKCOption_NoneZ_to_java(JNIEnv *env, LDKCOption_NoneZ val) {
537         switch (val) {
538                 case LDKCOption_NoneZ_Some:
539                         return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_Some);
540                 case LDKCOption_NoneZ_None:
541                         return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_None);
542                 default: abort();
543         }
544 }
545
546 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_from_java(JNIEnv *env, jclass clz) {
547         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
548         if (UNLIKELY((*env)->ExceptionCheck(env))) {
549                 (*env)->ExceptionDescribe(env);
550                 (*env)->FatalError(env, "A call to ChannelMonitorUpdateStatus.ordinal() from rust threw an exception.");
551         }
552         switch (ord) {
553                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
554                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
555                 case 2: return LDKChannelMonitorUpdateStatus_UnrecoverableError;
556         }
557         (*env)->FatalError(env, "A call to ChannelMonitorUpdateStatus.ordinal() from rust returned an invalid value.");
558         abort(); // Unreachable, but will let the compiler know we don't return here
559 }
560 static jclass ChannelMonitorUpdateStatus_class = NULL;
561 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed = NULL;
562 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress = NULL;
563 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError = NULL;
564 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelMonitorUpdateStatus_init (JNIEnv *env, jclass clz) {
565         ChannelMonitorUpdateStatus_class = (*env)->NewGlobalRef(env, clz);
566         CHECK(ChannelMonitorUpdateStatus_class != NULL);
567         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_Completed", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
568         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed != NULL);
569         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_InProgress", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
570         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress != NULL);
571         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_UnrecoverableError", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
572         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError != NULL);
573 }
574 static inline jclass LDKChannelMonitorUpdateStatus_to_java(JNIEnv *env, LDKChannelMonitorUpdateStatus val) {
575         switch (val) {
576                 case LDKChannelMonitorUpdateStatus_Completed:
577                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed);
578                 case LDKChannelMonitorUpdateStatus_InProgress:
579                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress);
580                 case LDKChannelMonitorUpdateStatus_UnrecoverableError:
581                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError);
582                 default: abort();
583         }
584 }
585
586 static inline LDKChannelShutdownState LDKChannelShutdownState_from_java(JNIEnv *env, jclass clz) {
587         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
588         if (UNLIKELY((*env)->ExceptionCheck(env))) {
589                 (*env)->ExceptionDescribe(env);
590                 (*env)->FatalError(env, "A call to ChannelShutdownState.ordinal() from rust threw an exception.");
591         }
592         switch (ord) {
593                 case 0: return LDKChannelShutdownState_NotShuttingDown;
594                 case 1: return LDKChannelShutdownState_ShutdownInitiated;
595                 case 2: return LDKChannelShutdownState_ResolvingHTLCs;
596                 case 3: return LDKChannelShutdownState_NegotiatingClosingFee;
597                 case 4: return LDKChannelShutdownState_ShutdownComplete;
598         }
599         (*env)->FatalError(env, "A call to ChannelShutdownState.ordinal() from rust returned an invalid value.");
600         abort(); // Unreachable, but will let the compiler know we don't return here
601 }
602 static jclass ChannelShutdownState_class = NULL;
603 static jfieldID ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown = NULL;
604 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated = NULL;
605 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs = NULL;
606 static jfieldID ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee = NULL;
607 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete = NULL;
608 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelShutdownState_init (JNIEnv *env, jclass clz) {
609         ChannelShutdownState_class = (*env)->NewGlobalRef(env, clz);
610         CHECK(ChannelShutdownState_class != NULL);
611         ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_NotShuttingDown", "Lorg/ldk/enums/ChannelShutdownState;");
612         CHECK(ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown != NULL);
613         ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ShutdownInitiated", "Lorg/ldk/enums/ChannelShutdownState;");
614         CHECK(ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated != NULL);
615         ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ResolvingHTLCs", "Lorg/ldk/enums/ChannelShutdownState;");
616         CHECK(ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs != NULL);
617         ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_NegotiatingClosingFee", "Lorg/ldk/enums/ChannelShutdownState;");
618         CHECK(ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee != NULL);
619         ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ShutdownComplete", "Lorg/ldk/enums/ChannelShutdownState;");
620         CHECK(ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete != NULL);
621 }
622 static inline jclass LDKChannelShutdownState_to_java(JNIEnv *env, LDKChannelShutdownState val) {
623         switch (val) {
624                 case LDKChannelShutdownState_NotShuttingDown:
625                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown);
626                 case LDKChannelShutdownState_ShutdownInitiated:
627                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated);
628                 case LDKChannelShutdownState_ResolvingHTLCs:
629                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs);
630                 case LDKChannelShutdownState_NegotiatingClosingFee:
631                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee);
632                 case LDKChannelShutdownState_ShutdownComplete:
633                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete);
634                 default: abort();
635         }
636 }
637
638 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
639         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
640         if (UNLIKELY((*env)->ExceptionCheck(env))) {
641                 (*env)->ExceptionDescribe(env);
642                 (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust threw an exception.");
643         }
644         switch (ord) {
645                 case 0: return LDKConfirmationTarget_OnChainSweep;
646                 case 1: return LDKConfirmationTarget_MaxAllowedNonAnchorChannelRemoteFee;
647                 case 2: return LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee;
648                 case 3: return LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee;
649                 case 4: return LDKConfirmationTarget_AnchorChannelFee;
650                 case 5: return LDKConfirmationTarget_NonAnchorChannelFee;
651                 case 6: return LDKConfirmationTarget_ChannelCloseMinimum;
652         }
653         (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust returned an invalid value.");
654         abort(); // Unreachable, but will let the compiler know we don't return here
655 }
656 static jclass ConfirmationTarget_class = NULL;
657 static jfieldID ConfirmationTarget_LDKConfirmationTarget_OnChainSweep = NULL;
658 static jfieldID ConfirmationTarget_LDKConfirmationTarget_MaxAllowedNonAnchorChannelRemoteFee = NULL;
659 static jfieldID ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee = NULL;
660 static jfieldID ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee = NULL;
661 static jfieldID ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee = NULL;
662 static jfieldID ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee = NULL;
663 static jfieldID ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum = NULL;
664 JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) {
665         ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
666         CHECK(ConfirmationTarget_class != NULL);
667         ConfirmationTarget_LDKConfirmationTarget_OnChainSweep = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_OnChainSweep", "Lorg/ldk/enums/ConfirmationTarget;");
668         CHECK(ConfirmationTarget_LDKConfirmationTarget_OnChainSweep != NULL);
669         ConfirmationTarget_LDKConfirmationTarget_MaxAllowedNonAnchorChannelRemoteFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_MaxAllowedNonAnchorChannelRemoteFee", "Lorg/ldk/enums/ConfirmationTarget;");
670         CHECK(ConfirmationTarget_LDKConfirmationTarget_MaxAllowedNonAnchorChannelRemoteFee != NULL);
671         ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee", "Lorg/ldk/enums/ConfirmationTarget;");
672         CHECK(ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee != NULL);
673         ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee", "Lorg/ldk/enums/ConfirmationTarget;");
674         CHECK(ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee != NULL);
675         ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_AnchorChannelFee", "Lorg/ldk/enums/ConfirmationTarget;");
676         CHECK(ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee != NULL);
677         ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_NonAnchorChannelFee", "Lorg/ldk/enums/ConfirmationTarget;");
678         CHECK(ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee != NULL);
679         ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_ChannelCloseMinimum", "Lorg/ldk/enums/ConfirmationTarget;");
680         CHECK(ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum != NULL);
681 }
682 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
683         switch (val) {
684                 case LDKConfirmationTarget_OnChainSweep:
685                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_OnChainSweep);
686                 case LDKConfirmationTarget_MaxAllowedNonAnchorChannelRemoteFee:
687                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_MaxAllowedNonAnchorChannelRemoteFee);
688                 case LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee:
689                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee);
690                 case LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee:
691                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee);
692                 case LDKConfirmationTarget_AnchorChannelFee:
693                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee);
694                 case LDKConfirmationTarget_NonAnchorChannelFee:
695                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee);
696                 case LDKConfirmationTarget_ChannelCloseMinimum:
697                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum);
698                 default: abort();
699         }
700 }
701
702 static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) {
703         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
704         if (UNLIKELY((*env)->ExceptionCheck(env))) {
705                 (*env)->ExceptionDescribe(env);
706                 (*env)->FatalError(env, "A call to CreationError.ordinal() from rust threw an exception.");
707         }
708         switch (ord) {
709                 case 0: return LDKCreationError_DescriptionTooLong;
710                 case 1: return LDKCreationError_RouteTooLong;
711                 case 2: return LDKCreationError_TimestampOutOfBounds;
712                 case 3: return LDKCreationError_InvalidAmount;
713                 case 4: return LDKCreationError_MissingRouteHints;
714                 case 5: return LDKCreationError_MinFinalCltvExpiryDeltaTooShort;
715         }
716         (*env)->FatalError(env, "A call to CreationError.ordinal() from rust returned an invalid value.");
717         abort(); // Unreachable, but will let the compiler know we don't return here
718 }
719 static jclass CreationError_class = NULL;
720 static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL;
721 static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL;
722 static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL;
723 static jfieldID CreationError_LDKCreationError_InvalidAmount = NULL;
724 static jfieldID CreationError_LDKCreationError_MissingRouteHints = NULL;
725 static jfieldID CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort = NULL;
726 JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) {
727         CreationError_class = (*env)->NewGlobalRef(env, clz);
728         CHECK(CreationError_class != NULL);
729         CreationError_LDKCreationError_DescriptionTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_DescriptionTooLong", "Lorg/ldk/enums/CreationError;");
730         CHECK(CreationError_LDKCreationError_DescriptionTooLong != NULL);
731         CreationError_LDKCreationError_RouteTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_RouteTooLong", "Lorg/ldk/enums/CreationError;");
732         CHECK(CreationError_LDKCreationError_RouteTooLong != NULL);
733         CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;");
734         CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL);
735         CreationError_LDKCreationError_InvalidAmount = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_InvalidAmount", "Lorg/ldk/enums/CreationError;");
736         CHECK(CreationError_LDKCreationError_InvalidAmount != NULL);
737         CreationError_LDKCreationError_MissingRouteHints = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MissingRouteHints", "Lorg/ldk/enums/CreationError;");
738         CHECK(CreationError_LDKCreationError_MissingRouteHints != NULL);
739         CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MinFinalCltvExpiryDeltaTooShort", "Lorg/ldk/enums/CreationError;");
740         CHECK(CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort != NULL);
741 }
742 static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) {
743         switch (val) {
744                 case LDKCreationError_DescriptionTooLong:
745                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_DescriptionTooLong);
746                 case LDKCreationError_RouteTooLong:
747                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong);
748                 case LDKCreationError_TimestampOutOfBounds:
749                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds);
750                 case LDKCreationError_InvalidAmount:
751                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_InvalidAmount);
752                 case LDKCreationError_MissingRouteHints:
753                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MissingRouteHints);
754                 case LDKCreationError_MinFinalCltvExpiryDeltaTooShort:
755                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort);
756                 default: abort();
757         }
758 }
759
760 static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) {
761         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
762         if (UNLIKELY((*env)->ExceptionCheck(env))) {
763                 (*env)->ExceptionDescribe(env);
764                 (*env)->FatalError(env, "A call to Currency.ordinal() from rust threw an exception.");
765         }
766         switch (ord) {
767                 case 0: return LDKCurrency_Bitcoin;
768                 case 1: return LDKCurrency_BitcoinTestnet;
769                 case 2: return LDKCurrency_Regtest;
770                 case 3: return LDKCurrency_Simnet;
771                 case 4: return LDKCurrency_Signet;
772         }
773         (*env)->FatalError(env, "A call to Currency.ordinal() from rust returned an invalid value.");
774         abort(); // Unreachable, but will let the compiler know we don't return here
775 }
776 static jclass Currency_class = NULL;
777 static jfieldID Currency_LDKCurrency_Bitcoin = NULL;
778 static jfieldID Currency_LDKCurrency_BitcoinTestnet = NULL;
779 static jfieldID Currency_LDKCurrency_Regtest = NULL;
780 static jfieldID Currency_LDKCurrency_Simnet = NULL;
781 static jfieldID Currency_LDKCurrency_Signet = NULL;
782 JNIEXPORT void JNICALL Java_org_ldk_enums_Currency_init (JNIEnv *env, jclass clz) {
783         Currency_class = (*env)->NewGlobalRef(env, clz);
784         CHECK(Currency_class != NULL);
785         Currency_LDKCurrency_Bitcoin = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Bitcoin", "Lorg/ldk/enums/Currency;");
786         CHECK(Currency_LDKCurrency_Bitcoin != NULL);
787         Currency_LDKCurrency_BitcoinTestnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_BitcoinTestnet", "Lorg/ldk/enums/Currency;");
788         CHECK(Currency_LDKCurrency_BitcoinTestnet != NULL);
789         Currency_LDKCurrency_Regtest = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Regtest", "Lorg/ldk/enums/Currency;");
790         CHECK(Currency_LDKCurrency_Regtest != NULL);
791         Currency_LDKCurrency_Simnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Simnet", "Lorg/ldk/enums/Currency;");
792         CHECK(Currency_LDKCurrency_Simnet != NULL);
793         Currency_LDKCurrency_Signet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Signet", "Lorg/ldk/enums/Currency;");
794         CHECK(Currency_LDKCurrency_Signet != NULL);
795 }
796 static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) {
797         switch (val) {
798                 case LDKCurrency_Bitcoin:
799                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Bitcoin);
800                 case LDKCurrency_BitcoinTestnet:
801                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_BitcoinTestnet);
802                 case LDKCurrency_Regtest:
803                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Regtest);
804                 case LDKCurrency_Simnet:
805                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Simnet);
806                 case LDKCurrency_Signet:
807                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Signet);
808                 default: abort();
809         }
810 }
811
812 static inline LDKHTLCClaim LDKHTLCClaim_from_java(JNIEnv *env, jclass clz) {
813         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
814         if (UNLIKELY((*env)->ExceptionCheck(env))) {
815                 (*env)->ExceptionDescribe(env);
816                 (*env)->FatalError(env, "A call to HTLCClaim.ordinal() from rust threw an exception.");
817         }
818         switch (ord) {
819                 case 0: return LDKHTLCClaim_OfferedTimeout;
820                 case 1: return LDKHTLCClaim_OfferedPreimage;
821                 case 2: return LDKHTLCClaim_AcceptedTimeout;
822                 case 3: return LDKHTLCClaim_AcceptedPreimage;
823                 case 4: return LDKHTLCClaim_Revocation;
824         }
825         (*env)->FatalError(env, "A call to HTLCClaim.ordinal() from rust returned an invalid value.");
826         abort(); // Unreachable, but will let the compiler know we don't return here
827 }
828 static jclass HTLCClaim_class = NULL;
829 static jfieldID HTLCClaim_LDKHTLCClaim_OfferedTimeout = NULL;
830 static jfieldID HTLCClaim_LDKHTLCClaim_OfferedPreimage = NULL;
831 static jfieldID HTLCClaim_LDKHTLCClaim_AcceptedTimeout = NULL;
832 static jfieldID HTLCClaim_LDKHTLCClaim_AcceptedPreimage = NULL;
833 static jfieldID HTLCClaim_LDKHTLCClaim_Revocation = NULL;
834 JNIEXPORT void JNICALL Java_org_ldk_enums_HTLCClaim_init (JNIEnv *env, jclass clz) {
835         HTLCClaim_class = (*env)->NewGlobalRef(env, clz);
836         CHECK(HTLCClaim_class != NULL);
837         HTLCClaim_LDKHTLCClaim_OfferedTimeout = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_OfferedTimeout", "Lorg/ldk/enums/HTLCClaim;");
838         CHECK(HTLCClaim_LDKHTLCClaim_OfferedTimeout != NULL);
839         HTLCClaim_LDKHTLCClaim_OfferedPreimage = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_OfferedPreimage", "Lorg/ldk/enums/HTLCClaim;");
840         CHECK(HTLCClaim_LDKHTLCClaim_OfferedPreimage != NULL);
841         HTLCClaim_LDKHTLCClaim_AcceptedTimeout = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_AcceptedTimeout", "Lorg/ldk/enums/HTLCClaim;");
842         CHECK(HTLCClaim_LDKHTLCClaim_AcceptedTimeout != NULL);
843         HTLCClaim_LDKHTLCClaim_AcceptedPreimage = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_AcceptedPreimage", "Lorg/ldk/enums/HTLCClaim;");
844         CHECK(HTLCClaim_LDKHTLCClaim_AcceptedPreimage != NULL);
845         HTLCClaim_LDKHTLCClaim_Revocation = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_Revocation", "Lorg/ldk/enums/HTLCClaim;");
846         CHECK(HTLCClaim_LDKHTLCClaim_Revocation != NULL);
847 }
848 static inline jclass LDKHTLCClaim_to_java(JNIEnv *env, LDKHTLCClaim val) {
849         switch (val) {
850                 case LDKHTLCClaim_OfferedTimeout:
851                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_OfferedTimeout);
852                 case LDKHTLCClaim_OfferedPreimage:
853                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_OfferedPreimage);
854                 case LDKHTLCClaim_AcceptedTimeout:
855                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_AcceptedTimeout);
856                 case LDKHTLCClaim_AcceptedPreimage:
857                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_AcceptedPreimage);
858                 case LDKHTLCClaim_Revocation:
859                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_Revocation);
860                 default: abort();
861         }
862 }
863
864 static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) {
865         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
866         if (UNLIKELY((*env)->ExceptionCheck(env))) {
867                 (*env)->ExceptionDescribe(env);
868                 (*env)->FatalError(env, "A call to IOError.ordinal() from rust threw an exception.");
869         }
870         switch (ord) {
871                 case 0: return LDKIOError_NotFound;
872                 case 1: return LDKIOError_PermissionDenied;
873                 case 2: return LDKIOError_ConnectionRefused;
874                 case 3: return LDKIOError_ConnectionReset;
875                 case 4: return LDKIOError_ConnectionAborted;
876                 case 5: return LDKIOError_NotConnected;
877                 case 6: return LDKIOError_AddrInUse;
878                 case 7: return LDKIOError_AddrNotAvailable;
879                 case 8: return LDKIOError_BrokenPipe;
880                 case 9: return LDKIOError_AlreadyExists;
881                 case 10: return LDKIOError_WouldBlock;
882                 case 11: return LDKIOError_InvalidInput;
883                 case 12: return LDKIOError_InvalidData;
884                 case 13: return LDKIOError_TimedOut;
885                 case 14: return LDKIOError_WriteZero;
886                 case 15: return LDKIOError_Interrupted;
887                 case 16: return LDKIOError_Other;
888                 case 17: return LDKIOError_UnexpectedEof;
889         }
890         (*env)->FatalError(env, "A call to IOError.ordinal() from rust returned an invalid value.");
891         abort(); // Unreachable, but will let the compiler know we don't return here
892 }
893 static jclass IOError_class = NULL;
894 static jfieldID IOError_LDKIOError_NotFound = NULL;
895 static jfieldID IOError_LDKIOError_PermissionDenied = NULL;
896 static jfieldID IOError_LDKIOError_ConnectionRefused = NULL;
897 static jfieldID IOError_LDKIOError_ConnectionReset = NULL;
898 static jfieldID IOError_LDKIOError_ConnectionAborted = NULL;
899 static jfieldID IOError_LDKIOError_NotConnected = NULL;
900 static jfieldID IOError_LDKIOError_AddrInUse = NULL;
901 static jfieldID IOError_LDKIOError_AddrNotAvailable = NULL;
902 static jfieldID IOError_LDKIOError_BrokenPipe = NULL;
903 static jfieldID IOError_LDKIOError_AlreadyExists = NULL;
904 static jfieldID IOError_LDKIOError_WouldBlock = NULL;
905 static jfieldID IOError_LDKIOError_InvalidInput = NULL;
906 static jfieldID IOError_LDKIOError_InvalidData = NULL;
907 static jfieldID IOError_LDKIOError_TimedOut = NULL;
908 static jfieldID IOError_LDKIOError_WriteZero = NULL;
909 static jfieldID IOError_LDKIOError_Interrupted = NULL;
910 static jfieldID IOError_LDKIOError_Other = NULL;
911 static jfieldID IOError_LDKIOError_UnexpectedEof = NULL;
912 JNIEXPORT void JNICALL Java_org_ldk_enums_IOError_init (JNIEnv *env, jclass clz) {
913         IOError_class = (*env)->NewGlobalRef(env, clz);
914         CHECK(IOError_class != NULL);
915         IOError_LDKIOError_NotFound = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotFound", "Lorg/ldk/enums/IOError;");
916         CHECK(IOError_LDKIOError_NotFound != NULL);
917         IOError_LDKIOError_PermissionDenied = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_PermissionDenied", "Lorg/ldk/enums/IOError;");
918         CHECK(IOError_LDKIOError_PermissionDenied != NULL);
919         IOError_LDKIOError_ConnectionRefused = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionRefused", "Lorg/ldk/enums/IOError;");
920         CHECK(IOError_LDKIOError_ConnectionRefused != NULL);
921         IOError_LDKIOError_ConnectionReset = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionReset", "Lorg/ldk/enums/IOError;");
922         CHECK(IOError_LDKIOError_ConnectionReset != NULL);
923         IOError_LDKIOError_ConnectionAborted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionAborted", "Lorg/ldk/enums/IOError;");
924         CHECK(IOError_LDKIOError_ConnectionAborted != NULL);
925         IOError_LDKIOError_NotConnected = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotConnected", "Lorg/ldk/enums/IOError;");
926         CHECK(IOError_LDKIOError_NotConnected != NULL);
927         IOError_LDKIOError_AddrInUse = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrInUse", "Lorg/ldk/enums/IOError;");
928         CHECK(IOError_LDKIOError_AddrInUse != NULL);
929         IOError_LDKIOError_AddrNotAvailable = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrNotAvailable", "Lorg/ldk/enums/IOError;");
930         CHECK(IOError_LDKIOError_AddrNotAvailable != NULL);
931         IOError_LDKIOError_BrokenPipe = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_BrokenPipe", "Lorg/ldk/enums/IOError;");
932         CHECK(IOError_LDKIOError_BrokenPipe != NULL);
933         IOError_LDKIOError_AlreadyExists = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AlreadyExists", "Lorg/ldk/enums/IOError;");
934         CHECK(IOError_LDKIOError_AlreadyExists != NULL);
935         IOError_LDKIOError_WouldBlock = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WouldBlock", "Lorg/ldk/enums/IOError;");
936         CHECK(IOError_LDKIOError_WouldBlock != NULL);
937         IOError_LDKIOError_InvalidInput = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidInput", "Lorg/ldk/enums/IOError;");
938         CHECK(IOError_LDKIOError_InvalidInput != NULL);
939         IOError_LDKIOError_InvalidData = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidData", "Lorg/ldk/enums/IOError;");
940         CHECK(IOError_LDKIOError_InvalidData != NULL);
941         IOError_LDKIOError_TimedOut = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_TimedOut", "Lorg/ldk/enums/IOError;");
942         CHECK(IOError_LDKIOError_TimedOut != NULL);
943         IOError_LDKIOError_WriteZero = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WriteZero", "Lorg/ldk/enums/IOError;");
944         CHECK(IOError_LDKIOError_WriteZero != NULL);
945         IOError_LDKIOError_Interrupted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Interrupted", "Lorg/ldk/enums/IOError;");
946         CHECK(IOError_LDKIOError_Interrupted != NULL);
947         IOError_LDKIOError_Other = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Other", "Lorg/ldk/enums/IOError;");
948         CHECK(IOError_LDKIOError_Other != NULL);
949         IOError_LDKIOError_UnexpectedEof = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_UnexpectedEof", "Lorg/ldk/enums/IOError;");
950         CHECK(IOError_LDKIOError_UnexpectedEof != NULL);
951 }
952 static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
953         switch (val) {
954                 case LDKIOError_NotFound:
955                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotFound);
956                 case LDKIOError_PermissionDenied:
957                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_PermissionDenied);
958                 case LDKIOError_ConnectionRefused:
959                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionRefused);
960                 case LDKIOError_ConnectionReset:
961                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionReset);
962                 case LDKIOError_ConnectionAborted:
963                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionAborted);
964                 case LDKIOError_NotConnected:
965                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotConnected);
966                 case LDKIOError_AddrInUse:
967                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrInUse);
968                 case LDKIOError_AddrNotAvailable:
969                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrNotAvailable);
970                 case LDKIOError_BrokenPipe:
971                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_BrokenPipe);
972                 case LDKIOError_AlreadyExists:
973                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AlreadyExists);
974                 case LDKIOError_WouldBlock:
975                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WouldBlock);
976                 case LDKIOError_InvalidInput:
977                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidInput);
978                 case LDKIOError_InvalidData:
979                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidData);
980                 case LDKIOError_TimedOut:
981                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_TimedOut);
982                 case LDKIOError_WriteZero:
983                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WriteZero);
984                 case LDKIOError_Interrupted:
985                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Interrupted);
986                 case LDKIOError_Other:
987                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Other);
988                 case LDKIOError_UnexpectedEof:
989                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_UnexpectedEof);
990                 default: abort();
991         }
992 }
993
994 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
995         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
996         if (UNLIKELY((*env)->ExceptionCheck(env))) {
997                 (*env)->ExceptionDescribe(env);
998                 (*env)->FatalError(env, "A call to Level.ordinal() from rust threw an exception.");
999         }
1000         switch (ord) {
1001                 case 0: return LDKLevel_Gossip;
1002                 case 1: return LDKLevel_Trace;
1003                 case 2: return LDKLevel_Debug;
1004                 case 3: return LDKLevel_Info;
1005                 case 4: return LDKLevel_Warn;
1006                 case 5: return LDKLevel_Error;
1007         }
1008         (*env)->FatalError(env, "A call to Level.ordinal() from rust returned an invalid value.");
1009         abort(); // Unreachable, but will let the compiler know we don't return here
1010 }
1011 static jclass Level_class = NULL;
1012 static jfieldID Level_LDKLevel_Gossip = NULL;
1013 static jfieldID Level_LDKLevel_Trace = NULL;
1014 static jfieldID Level_LDKLevel_Debug = NULL;
1015 static jfieldID Level_LDKLevel_Info = NULL;
1016 static jfieldID Level_LDKLevel_Warn = NULL;
1017 static jfieldID Level_LDKLevel_Error = NULL;
1018 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
1019         Level_class = (*env)->NewGlobalRef(env, clz);
1020         CHECK(Level_class != NULL);
1021         Level_LDKLevel_Gossip = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Gossip", "Lorg/ldk/enums/Level;");
1022         CHECK(Level_LDKLevel_Gossip != NULL);
1023         Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
1024         CHECK(Level_LDKLevel_Trace != NULL);
1025         Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
1026         CHECK(Level_LDKLevel_Debug != NULL);
1027         Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
1028         CHECK(Level_LDKLevel_Info != NULL);
1029         Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
1030         CHECK(Level_LDKLevel_Warn != NULL);
1031         Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
1032         CHECK(Level_LDKLevel_Error != NULL);
1033 }
1034 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
1035         switch (val) {
1036                 case LDKLevel_Gossip:
1037                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Gossip);
1038                 case LDKLevel_Trace:
1039                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
1040                 case LDKLevel_Debug:
1041                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
1042                 case LDKLevel_Info:
1043                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
1044                 case LDKLevel_Warn:
1045                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
1046                 case LDKLevel_Error:
1047                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
1048                 default: abort();
1049         }
1050 }
1051
1052 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
1053         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1054         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1055                 (*env)->ExceptionDescribe(env);
1056                 (*env)->FatalError(env, "A call to Network.ordinal() from rust threw an exception.");
1057         }
1058         switch (ord) {
1059                 case 0: return LDKNetwork_Bitcoin;
1060                 case 1: return LDKNetwork_Testnet;
1061                 case 2: return LDKNetwork_Regtest;
1062                 case 3: return LDKNetwork_Signet;
1063         }
1064         (*env)->FatalError(env, "A call to Network.ordinal() from rust returned an invalid value.");
1065         abort(); // Unreachable, but will let the compiler know we don't return here
1066 }
1067 static jclass Network_class = NULL;
1068 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
1069 static jfieldID Network_LDKNetwork_Testnet = NULL;
1070 static jfieldID Network_LDKNetwork_Regtest = NULL;
1071 static jfieldID Network_LDKNetwork_Signet = NULL;
1072 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
1073         Network_class = (*env)->NewGlobalRef(env, clz);
1074         CHECK(Network_class != NULL);
1075         Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
1076         CHECK(Network_LDKNetwork_Bitcoin != NULL);
1077         Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
1078         CHECK(Network_LDKNetwork_Testnet != NULL);
1079         Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
1080         CHECK(Network_LDKNetwork_Regtest != NULL);
1081         Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
1082         CHECK(Network_LDKNetwork_Signet != NULL);
1083 }
1084 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
1085         switch (val) {
1086                 case LDKNetwork_Bitcoin:
1087                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
1088                 case LDKNetwork_Testnet:
1089                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
1090                 case LDKNetwork_Regtest:
1091                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
1092                 case LDKNetwork_Signet:
1093                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
1094                 default: abort();
1095         }
1096 }
1097
1098 static inline LDKPaymentFailureReason LDKPaymentFailureReason_from_java(JNIEnv *env, jclass clz) {
1099         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1100         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1101                 (*env)->ExceptionDescribe(env);
1102                 (*env)->FatalError(env, "A call to PaymentFailureReason.ordinal() from rust threw an exception.");
1103         }
1104         switch (ord) {
1105                 case 0: return LDKPaymentFailureReason_RecipientRejected;
1106                 case 1: return LDKPaymentFailureReason_UserAbandoned;
1107                 case 2: return LDKPaymentFailureReason_RetriesExhausted;
1108                 case 3: return LDKPaymentFailureReason_PaymentExpired;
1109                 case 4: return LDKPaymentFailureReason_RouteNotFound;
1110                 case 5: return LDKPaymentFailureReason_UnexpectedError;
1111         }
1112         (*env)->FatalError(env, "A call to PaymentFailureReason.ordinal() from rust returned an invalid value.");
1113         abort(); // Unreachable, but will let the compiler know we don't return here
1114 }
1115 static jclass PaymentFailureReason_class = NULL;
1116 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected = NULL;
1117 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned = NULL;
1118 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted = NULL;
1119 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired = NULL;
1120 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound = NULL;
1121 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError = NULL;
1122 JNIEXPORT void JNICALL Java_org_ldk_enums_PaymentFailureReason_init (JNIEnv *env, jclass clz) {
1123         PaymentFailureReason_class = (*env)->NewGlobalRef(env, clz);
1124         CHECK(PaymentFailureReason_class != NULL);
1125         PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RecipientRejected", "Lorg/ldk/enums/PaymentFailureReason;");
1126         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected != NULL);
1127         PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_UserAbandoned", "Lorg/ldk/enums/PaymentFailureReason;");
1128         CHECK(PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned != NULL);
1129         PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RetriesExhausted", "Lorg/ldk/enums/PaymentFailureReason;");
1130         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted != NULL);
1131         PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_PaymentExpired", "Lorg/ldk/enums/PaymentFailureReason;");
1132         CHECK(PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired != NULL);
1133         PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RouteNotFound", "Lorg/ldk/enums/PaymentFailureReason;");
1134         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound != NULL);
1135         PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_UnexpectedError", "Lorg/ldk/enums/PaymentFailureReason;");
1136         CHECK(PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError != NULL);
1137 }
1138 static inline jclass LDKPaymentFailureReason_to_java(JNIEnv *env, LDKPaymentFailureReason val) {
1139         switch (val) {
1140                 case LDKPaymentFailureReason_RecipientRejected:
1141                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected);
1142                 case LDKPaymentFailureReason_UserAbandoned:
1143                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned);
1144                 case LDKPaymentFailureReason_RetriesExhausted:
1145                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted);
1146                 case LDKPaymentFailureReason_PaymentExpired:
1147                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired);
1148                 case LDKPaymentFailureReason_RouteNotFound:
1149                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound);
1150                 case LDKPaymentFailureReason_UnexpectedError:
1151                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError);
1152                 default: abort();
1153         }
1154 }
1155
1156 static inline LDKRecipient LDKRecipient_from_java(JNIEnv *env, jclass clz) {
1157         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1158         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1159                 (*env)->ExceptionDescribe(env);
1160                 (*env)->FatalError(env, "A call to Recipient.ordinal() from rust threw an exception.");
1161         }
1162         switch (ord) {
1163                 case 0: return LDKRecipient_Node;
1164                 case 1: return LDKRecipient_PhantomNode;
1165         }
1166         (*env)->FatalError(env, "A call to Recipient.ordinal() from rust returned an invalid value.");
1167         abort(); // Unreachable, but will let the compiler know we don't return here
1168 }
1169 static jclass Recipient_class = NULL;
1170 static jfieldID Recipient_LDKRecipient_Node = NULL;
1171 static jfieldID Recipient_LDKRecipient_PhantomNode = NULL;
1172 JNIEXPORT void JNICALL Java_org_ldk_enums_Recipient_init (JNIEnv *env, jclass clz) {
1173         Recipient_class = (*env)->NewGlobalRef(env, clz);
1174         CHECK(Recipient_class != NULL);
1175         Recipient_LDKRecipient_Node = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_Node", "Lorg/ldk/enums/Recipient;");
1176         CHECK(Recipient_LDKRecipient_Node != NULL);
1177         Recipient_LDKRecipient_PhantomNode = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_PhantomNode", "Lorg/ldk/enums/Recipient;");
1178         CHECK(Recipient_LDKRecipient_PhantomNode != NULL);
1179 }
1180 static inline jclass LDKRecipient_to_java(JNIEnv *env, LDKRecipient val) {
1181         switch (val) {
1182                 case LDKRecipient_Node:
1183                         return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_Node);
1184                 case LDKRecipient_PhantomNode:
1185                         return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_PhantomNode);
1186                 default: abort();
1187         }
1188 }
1189
1190 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_java(JNIEnv *env, jclass clz) {
1191         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1192         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1193                 (*env)->ExceptionDescribe(env);
1194                 (*env)->FatalError(env, "A call to RetryableSendFailure.ordinal() from rust threw an exception.");
1195         }
1196         switch (ord) {
1197                 case 0: return LDKRetryableSendFailure_PaymentExpired;
1198                 case 1: return LDKRetryableSendFailure_RouteNotFound;
1199                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
1200         }
1201         (*env)->FatalError(env, "A call to RetryableSendFailure.ordinal() from rust returned an invalid value.");
1202         abort(); // Unreachable, but will let the compiler know we don't return here
1203 }
1204 static jclass RetryableSendFailure_class = NULL;
1205 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired = NULL;
1206 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound = NULL;
1207 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment = NULL;
1208 JNIEXPORT void JNICALL Java_org_ldk_enums_RetryableSendFailure_init (JNIEnv *env, jclass clz) {
1209         RetryableSendFailure_class = (*env)->NewGlobalRef(env, clz);
1210         CHECK(RetryableSendFailure_class != NULL);
1211         RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_PaymentExpired", "Lorg/ldk/enums/RetryableSendFailure;");
1212         CHECK(RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired != NULL);
1213         RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_RouteNotFound", "Lorg/ldk/enums/RetryableSendFailure;");
1214         CHECK(RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound != NULL);
1215         RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_DuplicatePayment", "Lorg/ldk/enums/RetryableSendFailure;");
1216         CHECK(RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment != NULL);
1217 }
1218 static inline jclass LDKRetryableSendFailure_to_java(JNIEnv *env, LDKRetryableSendFailure val) {
1219         switch (val) {
1220                 case LDKRetryableSendFailure_PaymentExpired:
1221                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired);
1222                 case LDKRetryableSendFailure_RouteNotFound:
1223                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound);
1224                 case LDKRetryableSendFailure_DuplicatePayment:
1225                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment);
1226                 default: abort();
1227         }
1228 }
1229
1230 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
1231         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1232         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1233                 (*env)->ExceptionDescribe(env);
1234                 (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust threw an exception.");
1235         }
1236         switch (ord) {
1237                 case 0: return LDKSecp256k1Error_IncorrectSignature;
1238                 case 1: return LDKSecp256k1Error_InvalidMessage;
1239                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
1240                 case 3: return LDKSecp256k1Error_InvalidSignature;
1241                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
1242                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
1243                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
1244                 case 7: return LDKSecp256k1Error_InvalidTweak;
1245                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
1246                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
1247                 case 10: return LDKSecp256k1Error_InvalidParityValue;
1248         }
1249         (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust returned an invalid value.");
1250         abort(); // Unreachable, but will let the compiler know we don't return here
1251 }
1252 static jclass Secp256k1Error_class = NULL;
1253 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
1254 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
1255 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
1256 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
1257 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
1258 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = NULL;
1259 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
1260 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
1261 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
1262 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = NULL;
1263 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = NULL;
1264 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
1265         Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
1266         CHECK(Secp256k1Error_class != NULL);
1267         Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
1268         CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
1269         Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
1270         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
1271         Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
1272         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
1273         Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
1274         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
1275         Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
1276         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
1277         Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSharedSecret", "Lorg/ldk/enums/Secp256k1Error;");
1278         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret != NULL);
1279         Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
1280         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
1281         Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
1282         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
1283         Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
1284         CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
1285         Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKeySum", "Lorg/ldk/enums/Secp256k1Error;");
1286         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum != NULL);
1287         Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidParityValue", "Lorg/ldk/enums/Secp256k1Error;");
1288         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidParityValue != NULL);
1289 }
1290 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
1291         switch (val) {
1292                 case LDKSecp256k1Error_IncorrectSignature:
1293                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
1294                 case LDKSecp256k1Error_InvalidMessage:
1295                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
1296                 case LDKSecp256k1Error_InvalidPublicKey:
1297                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
1298                 case LDKSecp256k1Error_InvalidSignature:
1299                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
1300                 case LDKSecp256k1Error_InvalidSecretKey:
1301                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
1302                 case LDKSecp256k1Error_InvalidSharedSecret:
1303                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret);
1304                 case LDKSecp256k1Error_InvalidRecoveryId:
1305                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
1306                 case LDKSecp256k1Error_InvalidTweak:
1307                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
1308                 case LDKSecp256k1Error_NotEnoughMemory:
1309                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
1310                 case LDKSecp256k1Error_InvalidPublicKeySum:
1311                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum);
1312                 case LDKSecp256k1Error_InvalidParityValue:
1313                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidParityValue);
1314                 default: abort();
1315         }
1316 }
1317
1318 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
1319         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1320         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1321                 (*env)->ExceptionDescribe(env);
1322                 (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust threw an exception.");
1323         }
1324         switch (ord) {
1325                 case 0: return LDKSiPrefix_Milli;
1326                 case 1: return LDKSiPrefix_Micro;
1327                 case 2: return LDKSiPrefix_Nano;
1328                 case 3: return LDKSiPrefix_Pico;
1329         }
1330         (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust returned an invalid value.");
1331         abort(); // Unreachable, but will let the compiler know we don't return here
1332 }
1333 static jclass SiPrefix_class = NULL;
1334 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
1335 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
1336 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
1337 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
1338 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
1339         SiPrefix_class = (*env)->NewGlobalRef(env, clz);
1340         CHECK(SiPrefix_class != NULL);
1341         SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
1342         CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
1343         SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
1344         CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
1345         SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
1346         CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
1347         SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
1348         CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
1349 }
1350 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
1351         switch (val) {
1352                 case LDKSiPrefix_Milli:
1353                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
1354                 case LDKSiPrefix_Micro:
1355                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
1356                 case LDKSiPrefix_Nano:
1357                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
1358                 case LDKSiPrefix_Pico:
1359                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
1360                 default: abort();
1361         }
1362 }
1363
1364 static inline LDKSocketAddressParseError LDKSocketAddressParseError_from_java(JNIEnv *env, jclass clz) {
1365         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1366         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1367                 (*env)->ExceptionDescribe(env);
1368                 (*env)->FatalError(env, "A call to SocketAddressParseError.ordinal() from rust threw an exception.");
1369         }
1370         switch (ord) {
1371                 case 0: return LDKSocketAddressParseError_SocketAddrParse;
1372                 case 1: return LDKSocketAddressParseError_InvalidInput;
1373                 case 2: return LDKSocketAddressParseError_InvalidPort;
1374                 case 3: return LDKSocketAddressParseError_InvalidOnionV3;
1375         }
1376         (*env)->FatalError(env, "A call to SocketAddressParseError.ordinal() from rust returned an invalid value.");
1377         abort(); // Unreachable, but will let the compiler know we don't return here
1378 }
1379 static jclass SocketAddressParseError_class = NULL;
1380 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse = NULL;
1381 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_InvalidInput = NULL;
1382 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_InvalidPort = NULL;
1383 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3 = NULL;
1384 JNIEXPORT void JNICALL Java_org_ldk_enums_SocketAddressParseError_init (JNIEnv *env, jclass clz) {
1385         SocketAddressParseError_class = (*env)->NewGlobalRef(env, clz);
1386         CHECK(SocketAddressParseError_class != NULL);
1387         SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_SocketAddrParse", "Lorg/ldk/enums/SocketAddressParseError;");
1388         CHECK(SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse != NULL);
1389         SocketAddressParseError_LDKSocketAddressParseError_InvalidInput = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_InvalidInput", "Lorg/ldk/enums/SocketAddressParseError;");
1390         CHECK(SocketAddressParseError_LDKSocketAddressParseError_InvalidInput != NULL);
1391         SocketAddressParseError_LDKSocketAddressParseError_InvalidPort = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_InvalidPort", "Lorg/ldk/enums/SocketAddressParseError;");
1392         CHECK(SocketAddressParseError_LDKSocketAddressParseError_InvalidPort != NULL);
1393         SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3 = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_InvalidOnionV3", "Lorg/ldk/enums/SocketAddressParseError;");
1394         CHECK(SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3 != NULL);
1395 }
1396 static inline jclass LDKSocketAddressParseError_to_java(JNIEnv *env, LDKSocketAddressParseError val) {
1397         switch (val) {
1398                 case LDKSocketAddressParseError_SocketAddrParse:
1399                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse);
1400                 case LDKSocketAddressParseError_InvalidInput:
1401                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_InvalidInput);
1402                 case LDKSocketAddressParseError_InvalidPort:
1403                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_InvalidPort);
1404                 case LDKSocketAddressParseError_InvalidOnionV3:
1405                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3);
1406                 default: abort();
1407         }
1408 }
1409
1410 static inline LDKUtxoLookupError LDKUtxoLookupError_from_java(JNIEnv *env, jclass clz) {
1411         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1412         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1413                 (*env)->ExceptionDescribe(env);
1414                 (*env)->FatalError(env, "A call to UtxoLookupError.ordinal() from rust threw an exception.");
1415         }
1416         switch (ord) {
1417                 case 0: return LDKUtxoLookupError_UnknownChain;
1418                 case 1: return LDKUtxoLookupError_UnknownTx;
1419         }
1420         (*env)->FatalError(env, "A call to UtxoLookupError.ordinal() from rust returned an invalid value.");
1421         abort(); // Unreachable, but will let the compiler know we don't return here
1422 }
1423 static jclass UtxoLookupError_class = NULL;
1424 static jfieldID UtxoLookupError_LDKUtxoLookupError_UnknownChain = NULL;
1425 static jfieldID UtxoLookupError_LDKUtxoLookupError_UnknownTx = NULL;
1426 JNIEXPORT void JNICALL Java_org_ldk_enums_UtxoLookupError_init (JNIEnv *env, jclass clz) {
1427         UtxoLookupError_class = (*env)->NewGlobalRef(env, clz);
1428         CHECK(UtxoLookupError_class != NULL);
1429         UtxoLookupError_LDKUtxoLookupError_UnknownChain = (*env)->GetStaticFieldID(env, UtxoLookupError_class, "LDKUtxoLookupError_UnknownChain", "Lorg/ldk/enums/UtxoLookupError;");
1430         CHECK(UtxoLookupError_LDKUtxoLookupError_UnknownChain != NULL);
1431         UtxoLookupError_LDKUtxoLookupError_UnknownTx = (*env)->GetStaticFieldID(env, UtxoLookupError_class, "LDKUtxoLookupError_UnknownTx", "Lorg/ldk/enums/UtxoLookupError;");
1432         CHECK(UtxoLookupError_LDKUtxoLookupError_UnknownTx != NULL);
1433 }
1434 static inline jclass LDKUtxoLookupError_to_java(JNIEnv *env, LDKUtxoLookupError val) {
1435         switch (val) {
1436                 case LDKUtxoLookupError_UnknownChain:
1437                         return (*env)->GetStaticObjectField(env, UtxoLookupError_class, UtxoLookupError_LDKUtxoLookupError_UnknownChain);
1438                 case LDKUtxoLookupError_UnknownTx:
1439                         return (*env)->GetStaticObjectField(env, UtxoLookupError_class, UtxoLookupError_LDKUtxoLookupError_UnknownTx);
1440                 default: abort();
1441         }
1442 }
1443
1444 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
1445         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
1446         return ret;
1447 }
1448 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1get_1bytes(JNIEnv *env, jclass clz, int64_t thing) {
1449         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
1450         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
1451         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BigEndianScalar_get_bytes(thing_conv).data);
1452         return ret_arr;
1453 }
1454
1455 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
1456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1free(JNIEnv *env, jclass clz, int64_t thing) {
1457         if (!ptr_is_owned(thing)) return;
1458         void* thing_ptr = untag_ptr(thing);
1459         CHECK_ACCESS(thing_ptr);
1460         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
1461         FREE(untag_ptr(thing));
1462         BigEndianScalar_free(thing_conv);
1463 }
1464
1465 static jclass LDKBech32Error_MissingSeparator_class = NULL;
1466 static jmethodID LDKBech32Error_MissingSeparator_meth = NULL;
1467 static jclass LDKBech32Error_InvalidChecksum_class = NULL;
1468 static jmethodID LDKBech32Error_InvalidChecksum_meth = NULL;
1469 static jclass LDKBech32Error_InvalidLength_class = NULL;
1470 static jmethodID LDKBech32Error_InvalidLength_meth = NULL;
1471 static jclass LDKBech32Error_InvalidChar_class = NULL;
1472 static jmethodID LDKBech32Error_InvalidChar_meth = NULL;
1473 static jclass LDKBech32Error_InvalidData_class = NULL;
1474 static jmethodID LDKBech32Error_InvalidData_meth = NULL;
1475 static jclass LDKBech32Error_InvalidPadding_class = NULL;
1476 static jmethodID LDKBech32Error_InvalidPadding_meth = NULL;
1477 static jclass LDKBech32Error_MixedCase_class = NULL;
1478 static jmethodID LDKBech32Error_MixedCase_meth = NULL;
1479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBech32Error_init (JNIEnv *env, jclass clz) {
1480         LDKBech32Error_MissingSeparator_class =
1481                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MissingSeparator"));
1482         CHECK(LDKBech32Error_MissingSeparator_class != NULL);
1483         LDKBech32Error_MissingSeparator_meth = (*env)->GetMethodID(env, LDKBech32Error_MissingSeparator_class, "<init>", "()V");
1484         CHECK(LDKBech32Error_MissingSeparator_meth != NULL);
1485         LDKBech32Error_InvalidChecksum_class =
1486                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChecksum"));
1487         CHECK(LDKBech32Error_InvalidChecksum_class != NULL);
1488         LDKBech32Error_InvalidChecksum_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChecksum_class, "<init>", "()V");
1489         CHECK(LDKBech32Error_InvalidChecksum_meth != NULL);
1490         LDKBech32Error_InvalidLength_class =
1491                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidLength"));
1492         CHECK(LDKBech32Error_InvalidLength_class != NULL);
1493         LDKBech32Error_InvalidLength_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidLength_class, "<init>", "()V");
1494         CHECK(LDKBech32Error_InvalidLength_meth != NULL);
1495         LDKBech32Error_InvalidChar_class =
1496                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChar"));
1497         CHECK(LDKBech32Error_InvalidChar_class != NULL);
1498         LDKBech32Error_InvalidChar_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChar_class, "<init>", "(I)V");
1499         CHECK(LDKBech32Error_InvalidChar_meth != NULL);
1500         LDKBech32Error_InvalidData_class =
1501                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidData"));
1502         CHECK(LDKBech32Error_InvalidData_class != NULL);
1503         LDKBech32Error_InvalidData_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidData_class, "<init>", "(B)V");
1504         CHECK(LDKBech32Error_InvalidData_meth != NULL);
1505         LDKBech32Error_InvalidPadding_class =
1506                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidPadding"));
1507         CHECK(LDKBech32Error_InvalidPadding_class != NULL);
1508         LDKBech32Error_InvalidPadding_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidPadding_class, "<init>", "()V");
1509         CHECK(LDKBech32Error_InvalidPadding_meth != NULL);
1510         LDKBech32Error_MixedCase_class =
1511                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MixedCase"));
1512         CHECK(LDKBech32Error_MixedCase_class != NULL);
1513         LDKBech32Error_MixedCase_meth = (*env)->GetMethodID(env, LDKBech32Error_MixedCase_class, "<init>", "()V");
1514         CHECK(LDKBech32Error_MixedCase_meth != NULL);
1515 }
1516 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBech32Error_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1517         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
1518         switch(obj->tag) {
1519                 case LDKBech32Error_MissingSeparator: {
1520                         return (*env)->NewObject(env, LDKBech32Error_MissingSeparator_class, LDKBech32Error_MissingSeparator_meth);
1521                 }
1522                 case LDKBech32Error_InvalidChecksum: {
1523                         return (*env)->NewObject(env, LDKBech32Error_InvalidChecksum_class, LDKBech32Error_InvalidChecksum_meth);
1524                 }
1525                 case LDKBech32Error_InvalidLength: {
1526                         return (*env)->NewObject(env, LDKBech32Error_InvalidLength_class, LDKBech32Error_InvalidLength_meth);
1527                 }
1528                 case LDKBech32Error_InvalidChar: {
1529                         int32_t invalid_char_conv = obj->invalid_char;
1530                         return (*env)->NewObject(env, LDKBech32Error_InvalidChar_class, LDKBech32Error_InvalidChar_meth, invalid_char_conv);
1531                 }
1532                 case LDKBech32Error_InvalidData: {
1533                         int8_t invalid_data_conv = obj->invalid_data;
1534                         return (*env)->NewObject(env, LDKBech32Error_InvalidData_class, LDKBech32Error_InvalidData_meth, invalid_data_conv);
1535                 }
1536                 case LDKBech32Error_InvalidPadding: {
1537                         return (*env)->NewObject(env, LDKBech32Error_InvalidPadding_class, LDKBech32Error_InvalidPadding_meth);
1538                 }
1539                 case LDKBech32Error_MixedCase: {
1540                         return (*env)->NewObject(env, LDKBech32Error_MixedCase_class, LDKBech32Error_MixedCase_meth);
1541                 }
1542                 default: abort();
1543         }
1544 }
1545 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
1546         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
1547         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
1548         return ret;
1549 }
1550 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) {
1551         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
1552         LDKWitness ret_var = TxIn_get_witness(thing_conv);
1553         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1554         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1555         Witness_free(ret_var);
1556         return ret_arr;
1557 }
1558
1559 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) {
1560         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
1561         LDKCVec_u8Z ret_var = TxIn_get_script_sig(thing_conv);
1562         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1563         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1564         CVec_u8Z_free(ret_var);
1565         return ret_arr;
1566 }
1567
1568 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) {
1569         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
1570         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
1571         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TxIn_get_previous_txid(thing_conv).data);
1572         return ret_arr;
1573 }
1574
1575 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) {
1576         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
1577         int32_t ret_conv = TxIn_get_previous_vout(thing_conv);
1578         return ret_conv;
1579 }
1580
1581 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) {
1582         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
1583         int32_t ret_conv = TxIn_get_sequence(thing_conv);
1584         return ret_conv;
1585 }
1586
1587 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) {
1588         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
1589         LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
1590         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1591         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1592         CVec_u8Z_free(ret_var);
1593         return ret_arr;
1594 }
1595
1596 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) {
1597         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
1598         int64_t ret_conv = TxOut_get_value(thing_conv);
1599         return ret_conv;
1600 }
1601
1602 static jclass LDKCOption_u64Z_Some_class = NULL;
1603 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1604 static jclass LDKCOption_u64Z_None_class = NULL;
1605 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1607         LDKCOption_u64Z_Some_class =
1608                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$Some"));
1609         CHECK(LDKCOption_u64Z_Some_class != NULL);
1610         LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1611         CHECK(LDKCOption_u64Z_Some_meth != NULL);
1612         LDKCOption_u64Z_None_class =
1613                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$None"));
1614         CHECK(LDKCOption_u64Z_None_class != NULL);
1615         LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1616         CHECK(LDKCOption_u64Z_None_meth != NULL);
1617 }
1618 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1619         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1620         switch(obj->tag) {
1621                 case LDKCOption_u64Z_Some: {
1622                         int64_t some_conv = obj->some;
1623                         return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, some_conv);
1624                 }
1625                 case LDKCOption_u64Z_None: {
1626                         return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1627                 }
1628                 default: abort();
1629         }
1630 }
1631 static inline LDKCVec_BlindedPathZ CVec_BlindedPathZ_clone(const LDKCVec_BlindedPathZ *orig) {
1632         LDKCVec_BlindedPathZ ret = { .data = MALLOC(sizeof(LDKBlindedPath) * orig->datalen, "LDKCVec_BlindedPathZ clone bytes"), .datalen = orig->datalen };
1633         for (size_t i = 0; i < ret.datalen; i++) {
1634                 ret.data[i] = BlindedPath_clone(&orig->data[i]);
1635         }
1636         return ret;
1637 }
1638 static inline struct LDKRefund CResult_RefundBolt12ParseErrorZ_get_ok(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
1639         LDKRefund ret = *owner->contents.result;
1640         ret.is_owned = false;
1641         return ret;
1642 }
1643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1644         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
1645         LDKRefund ret_var = CResult_RefundBolt12ParseErrorZ_get_ok(owner_conv);
1646         int64_t ret_ref = 0;
1647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1649         return ret_ref;
1650 }
1651
1652 static inline struct LDKBolt12ParseError CResult_RefundBolt12ParseErrorZ_get_err(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
1653         LDKBolt12ParseError ret = *owner->contents.err;
1654         ret.is_owned = false;
1655         return ret;
1656 }
1657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1658         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
1659         LDKBolt12ParseError ret_var = CResult_RefundBolt12ParseErrorZ_get_err(owner_conv);
1660         int64_t ret_ref = 0;
1661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1662         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1663         return ret_ref;
1664 }
1665
1666 static jclass LDKRetry_Attempts_class = NULL;
1667 static jmethodID LDKRetry_Attempts_meth = NULL;
1668 static jclass LDKRetry_Timeout_class = NULL;
1669 static jmethodID LDKRetry_Timeout_meth = NULL;
1670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRetry_init (JNIEnv *env, jclass clz) {
1671         LDKRetry_Attempts_class =
1672                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Attempts"));
1673         CHECK(LDKRetry_Attempts_class != NULL);
1674         LDKRetry_Attempts_meth = (*env)->GetMethodID(env, LDKRetry_Attempts_class, "<init>", "(I)V");
1675         CHECK(LDKRetry_Attempts_meth != NULL);
1676         LDKRetry_Timeout_class =
1677                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Timeout"));
1678         CHECK(LDKRetry_Timeout_class != NULL);
1679         LDKRetry_Timeout_meth = (*env)->GetMethodID(env, LDKRetry_Timeout_class, "<init>", "(J)V");
1680         CHECK(LDKRetry_Timeout_meth != NULL);
1681 }
1682 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRetry_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1683         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
1684         switch(obj->tag) {
1685                 case LDKRetry_Attempts: {
1686                         int32_t attempts_conv = obj->attempts;
1687                         return (*env)->NewObject(env, LDKRetry_Attempts_class, LDKRetry_Attempts_meth, attempts_conv);
1688                 }
1689                 case LDKRetry_Timeout: {
1690                         int64_t timeout_conv = obj->timeout;
1691                         return (*env)->NewObject(env, LDKRetry_Timeout_class, LDKRetry_Timeout_meth, timeout_conv);
1692                 }
1693                 default: abort();
1694         }
1695 }
1696 static jclass LDKDecodeError_UnknownVersion_class = NULL;
1697 static jmethodID LDKDecodeError_UnknownVersion_meth = NULL;
1698 static jclass LDKDecodeError_UnknownRequiredFeature_class = NULL;
1699 static jmethodID LDKDecodeError_UnknownRequiredFeature_meth = NULL;
1700 static jclass LDKDecodeError_InvalidValue_class = NULL;
1701 static jmethodID LDKDecodeError_InvalidValue_meth = NULL;
1702 static jclass LDKDecodeError_ShortRead_class = NULL;
1703 static jmethodID LDKDecodeError_ShortRead_meth = NULL;
1704 static jclass LDKDecodeError_BadLengthDescriptor_class = NULL;
1705 static jmethodID LDKDecodeError_BadLengthDescriptor_meth = NULL;
1706 static jclass LDKDecodeError_Io_class = NULL;
1707 static jmethodID LDKDecodeError_Io_meth = NULL;
1708 static jclass LDKDecodeError_UnsupportedCompression_class = NULL;
1709 static jmethodID LDKDecodeError_UnsupportedCompression_meth = NULL;
1710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKDecodeError_init (JNIEnv *env, jclass clz) {
1711         LDKDecodeError_UnknownVersion_class =
1712                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnknownVersion"));
1713         CHECK(LDKDecodeError_UnknownVersion_class != NULL);
1714         LDKDecodeError_UnknownVersion_meth = (*env)->GetMethodID(env, LDKDecodeError_UnknownVersion_class, "<init>", "()V");
1715         CHECK(LDKDecodeError_UnknownVersion_meth != NULL);
1716         LDKDecodeError_UnknownRequiredFeature_class =
1717                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnknownRequiredFeature"));
1718         CHECK(LDKDecodeError_UnknownRequiredFeature_class != NULL);
1719         LDKDecodeError_UnknownRequiredFeature_meth = (*env)->GetMethodID(env, LDKDecodeError_UnknownRequiredFeature_class, "<init>", "()V");
1720         CHECK(LDKDecodeError_UnknownRequiredFeature_meth != NULL);
1721         LDKDecodeError_InvalidValue_class =
1722                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$InvalidValue"));
1723         CHECK(LDKDecodeError_InvalidValue_class != NULL);
1724         LDKDecodeError_InvalidValue_meth = (*env)->GetMethodID(env, LDKDecodeError_InvalidValue_class, "<init>", "()V");
1725         CHECK(LDKDecodeError_InvalidValue_meth != NULL);
1726         LDKDecodeError_ShortRead_class =
1727                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$ShortRead"));
1728         CHECK(LDKDecodeError_ShortRead_class != NULL);
1729         LDKDecodeError_ShortRead_meth = (*env)->GetMethodID(env, LDKDecodeError_ShortRead_class, "<init>", "()V");
1730         CHECK(LDKDecodeError_ShortRead_meth != NULL);
1731         LDKDecodeError_BadLengthDescriptor_class =
1732                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$BadLengthDescriptor"));
1733         CHECK(LDKDecodeError_BadLengthDescriptor_class != NULL);
1734         LDKDecodeError_BadLengthDescriptor_meth = (*env)->GetMethodID(env, LDKDecodeError_BadLengthDescriptor_class, "<init>", "()V");
1735         CHECK(LDKDecodeError_BadLengthDescriptor_meth != NULL);
1736         LDKDecodeError_Io_class =
1737                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$Io"));
1738         CHECK(LDKDecodeError_Io_class != NULL);
1739         LDKDecodeError_Io_meth = (*env)->GetMethodID(env, LDKDecodeError_Io_class, "<init>", "(Lorg/ldk/enums/IOError;)V");
1740         CHECK(LDKDecodeError_Io_meth != NULL);
1741         LDKDecodeError_UnsupportedCompression_class =
1742                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnsupportedCompression"));
1743         CHECK(LDKDecodeError_UnsupportedCompression_class != NULL);
1744         LDKDecodeError_UnsupportedCompression_meth = (*env)->GetMethodID(env, LDKDecodeError_UnsupportedCompression_class, "<init>", "()V");
1745         CHECK(LDKDecodeError_UnsupportedCompression_meth != NULL);
1746 }
1747 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKDecodeError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1748         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
1749         switch(obj->tag) {
1750                 case LDKDecodeError_UnknownVersion: {
1751                         return (*env)->NewObject(env, LDKDecodeError_UnknownVersion_class, LDKDecodeError_UnknownVersion_meth);
1752                 }
1753                 case LDKDecodeError_UnknownRequiredFeature: {
1754                         return (*env)->NewObject(env, LDKDecodeError_UnknownRequiredFeature_class, LDKDecodeError_UnknownRequiredFeature_meth);
1755                 }
1756                 case LDKDecodeError_InvalidValue: {
1757                         return (*env)->NewObject(env, LDKDecodeError_InvalidValue_class, LDKDecodeError_InvalidValue_meth);
1758                 }
1759                 case LDKDecodeError_ShortRead: {
1760                         return (*env)->NewObject(env, LDKDecodeError_ShortRead_class, LDKDecodeError_ShortRead_meth);
1761                 }
1762                 case LDKDecodeError_BadLengthDescriptor: {
1763                         return (*env)->NewObject(env, LDKDecodeError_BadLengthDescriptor_class, LDKDecodeError_BadLengthDescriptor_meth);
1764                 }
1765                 case LDKDecodeError_Io: {
1766                         jclass io_conv = LDKIOError_to_java(env, obj->io);
1767                         return (*env)->NewObject(env, LDKDecodeError_Io_class, LDKDecodeError_Io_meth, io_conv);
1768                 }
1769                 case LDKDecodeError_UnsupportedCompression: {
1770                         return (*env)->NewObject(env, LDKDecodeError_UnsupportedCompression_class, LDKDecodeError_UnsupportedCompression_meth);
1771                 }
1772                 default: abort();
1773         }
1774 }
1775 static inline struct LDKRetry CResult_RetryDecodeErrorZ_get_ok(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
1776 CHECK(owner->result_ok);
1777         return Retry_clone(&*owner->contents.result);
1778 }
1779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1780         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
1781         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
1782         *ret_copy = CResult_RetryDecodeErrorZ_get_ok(owner_conv);
1783         int64_t ret_ref = tag_ptr(ret_copy, true);
1784         return ret_ref;
1785 }
1786
1787 static inline struct LDKDecodeError CResult_RetryDecodeErrorZ_get_err(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
1788 CHECK(!owner->result_ok);
1789         return DecodeError_clone(&*owner->contents.err);
1790 }
1791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1792         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
1793         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1794         *ret_copy = CResult_RetryDecodeErrorZ_get_err(owner_conv);
1795         int64_t ret_ref = tag_ptr(ret_copy, true);
1796         return ret_ref;
1797 }
1798
1799 static jclass LDKAPIError_APIMisuseError_class = NULL;
1800 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
1801 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
1802 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
1803 static jclass LDKAPIError_InvalidRoute_class = NULL;
1804 static jmethodID LDKAPIError_InvalidRoute_meth = NULL;
1805 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
1806 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
1807 static jclass LDKAPIError_MonitorUpdateInProgress_class = NULL;
1808 static jmethodID LDKAPIError_MonitorUpdateInProgress_meth = NULL;
1809 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
1810 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
1811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
1812         LDKAPIError_APIMisuseError_class =
1813                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError"));
1814         CHECK(LDKAPIError_APIMisuseError_class != NULL);
1815         LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
1816         CHECK(LDKAPIError_APIMisuseError_meth != NULL);
1817         LDKAPIError_FeeRateTooHigh_class =
1818                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh"));
1819         CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
1820         LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
1821         CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
1822         LDKAPIError_InvalidRoute_class =
1823                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$InvalidRoute"));
1824         CHECK(LDKAPIError_InvalidRoute_class != NULL);
1825         LDKAPIError_InvalidRoute_meth = (*env)->GetMethodID(env, LDKAPIError_InvalidRoute_class, "<init>", "(Ljava/lang/String;)V");
1826         CHECK(LDKAPIError_InvalidRoute_meth != NULL);
1827         LDKAPIError_ChannelUnavailable_class =
1828                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable"));
1829         CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
1830         LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
1831         CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
1832         LDKAPIError_MonitorUpdateInProgress_class =
1833                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateInProgress"));
1834         CHECK(LDKAPIError_MonitorUpdateInProgress_class != NULL);
1835         LDKAPIError_MonitorUpdateInProgress_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateInProgress_class, "<init>", "()V");
1836         CHECK(LDKAPIError_MonitorUpdateInProgress_meth != NULL);
1837         LDKAPIError_IncompatibleShutdownScript_class =
1838                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript"));
1839         CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
1840         LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
1841         CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
1842 }
1843 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1844         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1845         switch(obj->tag) {
1846                 case LDKAPIError_APIMisuseError: {
1847                         LDKStr err_str = obj->api_misuse_error.err;
1848                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1849                         return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
1850                 }
1851                 case LDKAPIError_FeeRateTooHigh: {
1852                         LDKStr err_str = obj->fee_rate_too_high.err;
1853                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1854                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
1855                         return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, feerate_conv);
1856                 }
1857                 case LDKAPIError_InvalidRoute: {
1858                         LDKStr err_str = obj->invalid_route.err;
1859                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1860                         return (*env)->NewObject(env, LDKAPIError_InvalidRoute_class, LDKAPIError_InvalidRoute_meth, err_conv);
1861                 }
1862                 case LDKAPIError_ChannelUnavailable: {
1863                         LDKStr err_str = obj->channel_unavailable.err;
1864                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1865                         return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
1866                 }
1867                 case LDKAPIError_MonitorUpdateInProgress: {
1868                         return (*env)->NewObject(env, LDKAPIError_MonitorUpdateInProgress_class, LDKAPIError_MonitorUpdateInProgress_meth);
1869                 }
1870                 case LDKAPIError_IncompatibleShutdownScript: {
1871                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
1872                         int64_t script_ref = 0;
1873                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
1874                         script_ref = tag_ptr(script_var.inner, false);
1875                         return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
1876                 }
1877                 default: abort();
1878         }
1879 }
1880 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
1881 CHECK(owner->result_ok);
1882         return *owner->contents.result;
1883 }
1884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1885         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
1886         CResult_NoneAPIErrorZ_get_ok(owner_conv);
1887 }
1888
1889 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
1890 CHECK(!owner->result_ok);
1891         return APIError_clone(&*owner->contents.err);
1892 }
1893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1894         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
1895         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
1896         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
1897         int64_t ret_ref = tag_ptr(ret_copy, true);
1898         return ret_ref;
1899 }
1900
1901 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
1902         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
1903         for (size_t i = 0; i < ret.datalen; i++) {
1904                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
1905         }
1906         return ret;
1907 }
1908 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
1909         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
1910         for (size_t i = 0; i < ret.datalen; i++) {
1911                 ret.data[i] = APIError_clone(&orig->data[i]);
1912         }
1913         return ret;
1914 }
1915 static jclass LDKCOption_ThirtyTwoBytesZ_Some_class = NULL;
1916 static jmethodID LDKCOption_ThirtyTwoBytesZ_Some_meth = NULL;
1917 static jclass LDKCOption_ThirtyTwoBytesZ_None_class = NULL;
1918 static jmethodID LDKCOption_ThirtyTwoBytesZ_None_meth = NULL;
1919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ThirtyTwoBytesZ_init (JNIEnv *env, jclass clz) {
1920         LDKCOption_ThirtyTwoBytesZ_Some_class =
1921                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ThirtyTwoBytesZ$Some"));
1922         CHECK(LDKCOption_ThirtyTwoBytesZ_Some_class != NULL);
1923         LDKCOption_ThirtyTwoBytesZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ThirtyTwoBytesZ_Some_class, "<init>", "([B)V");
1924         CHECK(LDKCOption_ThirtyTwoBytesZ_Some_meth != NULL);
1925         LDKCOption_ThirtyTwoBytesZ_None_class =
1926                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ThirtyTwoBytesZ$None"));
1927         CHECK(LDKCOption_ThirtyTwoBytesZ_None_class != NULL);
1928         LDKCOption_ThirtyTwoBytesZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ThirtyTwoBytesZ_None_class, "<init>", "()V");
1929         CHECK(LDKCOption_ThirtyTwoBytesZ_None_meth != NULL);
1930 }
1931 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ThirtyTwoBytesZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1932         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
1933         switch(obj->tag) {
1934                 case LDKCOption_ThirtyTwoBytesZ_Some: {
1935                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
1936                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.data);
1937                         return (*env)->NewObject(env, LDKCOption_ThirtyTwoBytesZ_Some_class, LDKCOption_ThirtyTwoBytesZ_Some_meth, some_arr);
1938                 }
1939                 case LDKCOption_ThirtyTwoBytesZ_None: {
1940                         return (*env)->NewObject(env, LDKCOption_ThirtyTwoBytesZ_None_class, LDKCOption_ThirtyTwoBytesZ_None_meth);
1941                 }
1942                 default: abort();
1943         }
1944 }
1945 static jclass LDKCOption_CVec_u8ZZ_Some_class = NULL;
1946 static jmethodID LDKCOption_CVec_u8ZZ_Some_meth = NULL;
1947 static jclass LDKCOption_CVec_u8ZZ_None_class = NULL;
1948 static jmethodID LDKCOption_CVec_u8ZZ_None_meth = NULL;
1949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1u8ZZ_init (JNIEnv *env, jclass clz) {
1950         LDKCOption_CVec_u8ZZ_Some_class =
1951                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_u8ZZ$Some"));
1952         CHECK(LDKCOption_CVec_u8ZZ_Some_class != NULL);
1953         LDKCOption_CVec_u8ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_u8ZZ_Some_class, "<init>", "([B)V");
1954         CHECK(LDKCOption_CVec_u8ZZ_Some_meth != NULL);
1955         LDKCOption_CVec_u8ZZ_None_class =
1956                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_u8ZZ$None"));
1957         CHECK(LDKCOption_CVec_u8ZZ_None_class != NULL);
1958         LDKCOption_CVec_u8ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_u8ZZ_None_class, "<init>", "()V");
1959         CHECK(LDKCOption_CVec_u8ZZ_None_meth != NULL);
1960 }
1961 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1u8ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1962         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
1963         switch(obj->tag) {
1964                 case LDKCOption_CVec_u8ZZ_Some: {
1965                         LDKCVec_u8Z some_var = obj->some;
1966                         int8_tArray some_arr = (*env)->NewByteArray(env, some_var.datalen);
1967                         (*env)->SetByteArrayRegion(env, some_arr, 0, some_var.datalen, some_var.data);
1968                         return (*env)->NewObject(env, LDKCOption_CVec_u8ZZ_Some_class, LDKCOption_CVec_u8ZZ_Some_meth, some_arr);
1969                 }
1970                 case LDKCOption_CVec_u8ZZ_None: {
1971                         return (*env)->NewObject(env, LDKCOption_CVec_u8ZZ_None_class, LDKCOption_CVec_u8ZZ_None_meth);
1972                 }
1973                 default: abort();
1974         }
1975 }
1976 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
1977         LDKRecipientOnionFields ret = *owner->contents.result;
1978         ret.is_owned = false;
1979         return ret;
1980 }
1981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1982         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
1983         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(owner_conv);
1984         int64_t ret_ref = 0;
1985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1987         return ret_ref;
1988 }
1989
1990 static inline struct LDKDecodeError CResult_RecipientOnionFieldsDecodeErrorZ_get_err(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
1991 CHECK(!owner->result_ok);
1992         return DecodeError_clone(&*owner->contents.err);
1993 }
1994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1995         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
1996         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1997         *ret_copy = CResult_RecipientOnionFieldsDecodeErrorZ_get_err(owner_conv);
1998         int64_t ret_ref = tag_ptr(ret_copy, true);
1999         return ret_ref;
2000 }
2001
2002 static inline uint64_t C2Tuple_u64CVec_u8ZZ_get_a(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
2003         return owner->a;
2004 }
2005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
2006         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
2007         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_get_a(owner_conv);
2008         return ret_conv;
2009 }
2010
2011 static inline struct LDKCVec_u8Z C2Tuple_u64CVec_u8ZZ_get_b(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
2012         return CVec_u8Z_clone(&owner->b);
2013 }
2014 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
2015         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
2016         LDKCVec_u8Z ret_var = C2Tuple_u64CVec_u8ZZ_get_b(owner_conv);
2017         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2018         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2019         CVec_u8Z_free(ret_var);
2020         return ret_arr;
2021 }
2022
2023 static inline LDKCVec_C2Tuple_u64CVec_u8ZZZ CVec_C2Tuple_u64CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u64CVec_u8ZZZ *orig) {
2024         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u64CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
2025         for (size_t i = 0; i < ret.datalen; i++) {
2026                 ret.data[i] = C2Tuple_u64CVec_u8ZZ_clone(&orig->data[i]);
2027         }
2028         return ret;
2029 }
2030 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsNoneZ_get_ok(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
2031         LDKRecipientOnionFields ret = *owner->contents.result;
2032         ret.is_owned = false;
2033         return ret;
2034 }
2035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2036         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
2037         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsNoneZ_get_ok(owner_conv);
2038         int64_t ret_ref = 0;
2039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2041         return ret_ref;
2042 }
2043
2044 static inline void CResult_RecipientOnionFieldsNoneZ_get_err(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
2045 CHECK(!owner->result_ok);
2046         return *owner->contents.err;
2047 }
2048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2049         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
2050         CResult_RecipientOnionFieldsNoneZ_get_err(owner_conv);
2051 }
2052
2053 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
2054         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
2055         for (size_t i = 0; i < ret.datalen; i++) {
2056                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
2057         }
2058         return ret;
2059 }
2060 static jclass LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class = NULL;
2061 static jmethodID LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth = NULL;
2062 static jclass LDKCOption_CVec_ThirtyTwoBytesZZ_None_class = NULL;
2063 static jmethodID LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth = NULL;
2064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1ThirtyTwoBytesZZ_init (JNIEnv *env, jclass clz) {
2065         LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class =
2066                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_ThirtyTwoBytesZZ$Some"));
2067         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class != NULL);
2068         LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class, "<init>", "([[B)V");
2069         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth != NULL);
2070         LDKCOption_CVec_ThirtyTwoBytesZZ_None_class =
2071                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_ThirtyTwoBytesZZ$None"));
2072         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_None_class != NULL);
2073         LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_ThirtyTwoBytesZZ_None_class, "<init>", "()V");
2074         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth != NULL);
2075 }
2076 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1ThirtyTwoBytesZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2077         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
2078         switch(obj->tag) {
2079                 case LDKCOption_CVec_ThirtyTwoBytesZZ_Some: {
2080                         LDKCVec_ThirtyTwoBytesZ some_var = obj->some;
2081                         jobjectArray some_arr = NULL;
2082                         some_arr = (*env)->NewObjectArray(env, some_var.datalen, arr_of_B_clz, NULL);
2083                         ;
2084                         for (size_t i = 0; i < some_var.datalen; i++) {
2085                                 int8_tArray some_conv_8_arr = (*env)->NewByteArray(env, 32);
2086                                 (*env)->SetByteArrayRegion(env, some_conv_8_arr, 0, 32, some_var.data[i].data);
2087                                 (*env)->SetObjectArrayElement(env, some_arr, i, some_conv_8_arr);
2088                         }
2089                         
2090                         return (*env)->NewObject(env, LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class, LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth, some_arr);
2091                 }
2092                 case LDKCOption_CVec_ThirtyTwoBytesZZ_None: {
2093                         return (*env)->NewObject(env, LDKCOption_CVec_ThirtyTwoBytesZZ_None_class, LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth);
2094                 }
2095                 default: abort();
2096         }
2097 }
2098 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesNoneZ_get_ok(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
2099 CHECK(owner->result_ok);
2100         return ThirtyTwoBytes_clone(&*owner->contents.result);
2101 }
2102 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2103         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
2104         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2105         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesNoneZ_get_ok(owner_conv).data);
2106         return ret_arr;
2107 }
2108
2109 static inline void CResult_ThirtyTwoBytesNoneZ_get_err(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
2110 CHECK(!owner->result_ok);
2111         return *owner->contents.err;
2112 }
2113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2114         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
2115         CResult_ThirtyTwoBytesNoneZ_get_err(owner_conv);
2116 }
2117
2118 static inline struct LDKBlindedPayInfo CResult_BlindedPayInfoDecodeErrorZ_get_ok(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
2119         LDKBlindedPayInfo ret = *owner->contents.result;
2120         ret.is_owned = false;
2121         return ret;
2122 }
2123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2124         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
2125         LDKBlindedPayInfo ret_var = CResult_BlindedPayInfoDecodeErrorZ_get_ok(owner_conv);
2126         int64_t ret_ref = 0;
2127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2129         return ret_ref;
2130 }
2131
2132 static inline struct LDKDecodeError CResult_BlindedPayInfoDecodeErrorZ_get_err(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
2133 CHECK(!owner->result_ok);
2134         return DecodeError_clone(&*owner->contents.err);
2135 }
2136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2137         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
2138         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2139         *ret_copy = CResult_BlindedPayInfoDecodeErrorZ_get_err(owner_conv);
2140         int64_t ret_ref = tag_ptr(ret_copy, true);
2141         return ret_ref;
2142 }
2143
2144 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2145         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
2146         ret.is_owned = false;
2147         return ret;
2148 }
2149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2150         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2151         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
2152         int64_t ret_ref = 0;
2153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2155         return ret_ref;
2156 }
2157
2158 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2159 CHECK(!owner->result_ok);
2160         return DecodeError_clone(&*owner->contents.err);
2161 }
2162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2163         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2164         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2165         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2166         int64_t ret_ref = tag_ptr(ret_copy, true);
2167         return ret_ref;
2168 }
2169
2170 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2171         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
2172         ret.is_owned = false;
2173         return ret;
2174 }
2175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2176         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2177         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
2178         int64_t ret_ref = 0;
2179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2181         return ret_ref;
2182 }
2183
2184 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2185 CHECK(!owner->result_ok);
2186         return DecodeError_clone(&*owner->contents.err);
2187 }
2188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2189         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2190         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2191         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2192         int64_t ret_ref = tag_ptr(ret_copy, true);
2193         return ret_ref;
2194 }
2195
2196 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
2197 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
2198 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
2199 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
2200 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
2201 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
2202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
2203         LDKSpendableOutputDescriptor_StaticOutput_class =
2204                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput"));
2205         CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
2206         LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
2207         CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
2208         LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
2209                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput"));
2210         CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
2211         LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
2212         CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
2213         LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
2214                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput"));
2215         CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
2216         LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
2217         CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
2218 }
2219 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2220         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
2221         switch(obj->tag) {
2222                 case LDKSpendableOutputDescriptor_StaticOutput: {
2223                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
2224                         int64_t outpoint_ref = 0;
2225                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
2226                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
2227                         LDKTxOut* output_ref = &obj->static_output.output;
2228                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, tag_ptr(output_ref, false));
2229                 }
2230                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
2231                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
2232                         int64_t delayed_payment_output_ref = 0;
2233                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
2234                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
2235                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
2236                 }
2237                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
2238                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
2239                         int64_t static_payment_output_ref = 0;
2240                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
2241                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
2242                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
2243                 }
2244                 default: abort();
2245         }
2246 }
2247 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2248 CHECK(owner->result_ok);
2249         return SpendableOutputDescriptor_clone(&*owner->contents.result);
2250 }
2251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2252         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2253         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
2254         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
2255         int64_t ret_ref = tag_ptr(ret_copy, true);
2256         return ret_ref;
2257 }
2258
2259 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2260 CHECK(!owner->result_ok);
2261         return DecodeError_clone(&*owner->contents.err);
2262 }
2263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2264         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2265         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2266         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2267         int64_t ret_ref = tag_ptr(ret_copy, true);
2268         return ret_ref;
2269 }
2270
2271 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
2272         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
2273         for (size_t i = 0; i < ret.datalen; i++) {
2274                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
2275         }
2276         return ret;
2277 }
2278 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2279         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2280         for (size_t i = 0; i < ret.datalen; i++) {
2281                 ret.data[i] = TxOut_clone(&orig->data[i]);
2282         }
2283         return ret;
2284 }
2285 static jclass LDKCOption_u32Z_Some_class = NULL;
2286 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
2287 static jclass LDKCOption_u32Z_None_class = NULL;
2288 static jmethodID LDKCOption_u32Z_None_meth = NULL;
2289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
2290         LDKCOption_u32Z_Some_class =
2291                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$Some"));
2292         CHECK(LDKCOption_u32Z_Some_class != NULL);
2293         LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
2294         CHECK(LDKCOption_u32Z_Some_meth != NULL);
2295         LDKCOption_u32Z_None_class =
2296                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$None"));
2297         CHECK(LDKCOption_u32Z_None_class != NULL);
2298         LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
2299         CHECK(LDKCOption_u32Z_None_meth != NULL);
2300 }
2301 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2302         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
2303         switch(obj->tag) {
2304                 case LDKCOption_u32Z_Some: {
2305                         int32_t some_conv = obj->some;
2306                         return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, some_conv);
2307                 }
2308                 case LDKCOption_u32Z_None: {
2309                         return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
2310                 }
2311                 default: abort();
2312         }
2313 }
2314 static inline struct LDKCVec_u8Z C2Tuple_CVec_u8ZusizeZ_get_a(LDKC2Tuple_CVec_u8ZusizeZ *NONNULL_PTR owner){
2315         return CVec_u8Z_clone(&owner->a);
2316 }
2317 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8ZusizeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
2318         LDKC2Tuple_CVec_u8ZusizeZ* owner_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(owner);
2319         LDKCVec_u8Z ret_var = C2Tuple_CVec_u8ZusizeZ_get_a(owner_conv);
2320         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2321         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2322         CVec_u8Z_free(ret_var);
2323         return ret_arr;
2324 }
2325
2326 static inline uintptr_t C2Tuple_CVec_u8ZusizeZ_get_b(LDKC2Tuple_CVec_u8ZusizeZ *NONNULL_PTR owner){
2327         return owner->b;
2328 }
2329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8ZusizeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
2330         LDKC2Tuple_CVec_u8ZusizeZ* owner_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(owner);
2331         int64_t ret_conv = C2Tuple_CVec_u8ZusizeZ_get_b(owner_conv);
2332         return ret_conv;
2333 }
2334
2335 static inline struct LDKC2Tuple_CVec_u8ZusizeZ CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_ok(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR owner){
2336 CHECK(owner->result_ok);
2337         return C2Tuple_CVec_u8ZusizeZ_clone(&*owner->contents.result);
2338 }
2339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2340         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(owner);
2341         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
2342         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_ok(owner_conv);
2343         return tag_ptr(ret_conv, true);
2344 }
2345
2346 static inline void CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_err(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR owner){
2347 CHECK(!owner->result_ok);
2348         return *owner->contents.err;
2349 }
2350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2351         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(owner);
2352         CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_err(owner_conv);
2353 }
2354
2355 static inline struct LDKChannelDerivationParameters CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
2356         LDKChannelDerivationParameters ret = *owner->contents.result;
2357         ret.is_owned = false;
2358         return ret;
2359 }
2360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2361         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
2362         LDKChannelDerivationParameters ret_var = CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(owner_conv);
2363         int64_t ret_ref = 0;
2364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2366         return ret_ref;
2367 }
2368
2369 static inline struct LDKDecodeError CResult_ChannelDerivationParametersDecodeErrorZ_get_err(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
2370 CHECK(!owner->result_ok);
2371         return DecodeError_clone(&*owner->contents.err);
2372 }
2373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2374         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
2375         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2376         *ret_copy = CResult_ChannelDerivationParametersDecodeErrorZ_get_err(owner_conv);
2377         int64_t ret_ref = tag_ptr(ret_copy, true);
2378         return ret_ref;
2379 }
2380
2381 static inline struct LDKHTLCDescriptor CResult_HTLCDescriptorDecodeErrorZ_get_ok(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
2382         LDKHTLCDescriptor ret = *owner->contents.result;
2383         ret.is_owned = false;
2384         return ret;
2385 }
2386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2387         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
2388         LDKHTLCDescriptor ret_var = CResult_HTLCDescriptorDecodeErrorZ_get_ok(owner_conv);
2389         int64_t ret_ref = 0;
2390         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2391         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2392         return ret_ref;
2393 }
2394
2395 static inline struct LDKDecodeError CResult_HTLCDescriptorDecodeErrorZ_get_err(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
2396 CHECK(!owner->result_ok);
2397         return DecodeError_clone(&*owner->contents.err);
2398 }
2399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2400         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
2401         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2402         *ret_copy = CResult_HTLCDescriptorDecodeErrorZ_get_err(owner_conv);
2403         int64_t ret_ref = tag_ptr(ret_copy, true);
2404         return ret_ref;
2405 }
2406
2407 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
2408 CHECK(owner->result_ok);
2409         return *owner->contents.result;
2410 }
2411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2412         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
2413         CResult_NoneNoneZ_get_ok(owner_conv);
2414 }
2415
2416 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
2417 CHECK(!owner->result_ok);
2418         return *owner->contents.err;
2419 }
2420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2421         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
2422         CResult_NoneNoneZ_get_err(owner_conv);
2423 }
2424
2425 static inline struct LDKECDSASignature C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
2426         return owner->a;
2427 }
2428 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
2429         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
2430         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2431         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(owner_conv).compact_form);
2432         return ret_arr;
2433 }
2434
2435 static inline struct LDKCVec_ECDSASignatureZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
2436         return owner->b;
2437 }
2438 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
2439         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
2440         LDKCVec_ECDSASignatureZ ret_var = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(owner_conv);
2441         jobjectArray ret_arr = NULL;
2442         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
2443         ;
2444         for (size_t i = 0; i < ret_var.datalen; i++) {
2445                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
2446                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
2447                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
2448         }
2449         
2450         return ret_arr;
2451 }
2452
2453 static inline struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
2454 CHECK(owner->result_ok);
2455         return C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(&*owner->contents.result);
2456 }
2457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2458         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
2459         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
2460         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(owner_conv);
2461         return tag_ptr(ret_conv, true);
2462 }
2463
2464 static inline void CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
2465 CHECK(!owner->result_ok);
2466         return *owner->contents.err;
2467 }
2468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2469         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
2470         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(owner_conv);
2471 }
2472
2473 static inline struct LDKECDSASignature CResult_ECDSASignatureNoneZ_get_ok(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
2474 CHECK(owner->result_ok);
2475         return *owner->contents.result;
2476 }
2477 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2478         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
2479         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2480         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_ECDSASignatureNoneZ_get_ok(owner_conv).compact_form);
2481         return ret_arr;
2482 }
2483
2484 static inline void CResult_ECDSASignatureNoneZ_get_err(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
2485 CHECK(!owner->result_ok);
2486         return *owner->contents.err;
2487 }
2488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2489         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
2490         CResult_ECDSASignatureNoneZ_get_err(owner_conv);
2491 }
2492
2493 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
2494 CHECK(owner->result_ok);
2495         return *owner->contents.result;
2496 }
2497 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2498         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
2499         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2500         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form);
2501         return ret_arr;
2502 }
2503
2504 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
2505 CHECK(!owner->result_ok);
2506         return *owner->contents.err;
2507 }
2508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2509         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
2510         CResult_PublicKeyNoneZ_get_err(owner_conv);
2511 }
2512
2513 static jclass LDKCOption_BigEndianScalarZ_Some_class = NULL;
2514 static jmethodID LDKCOption_BigEndianScalarZ_Some_meth = NULL;
2515 static jclass LDKCOption_BigEndianScalarZ_None_class = NULL;
2516 static jmethodID LDKCOption_BigEndianScalarZ_None_meth = NULL;
2517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1BigEndianScalarZ_init (JNIEnv *env, jclass clz) {
2518         LDKCOption_BigEndianScalarZ_Some_class =
2519                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_BigEndianScalarZ$Some"));
2520         CHECK(LDKCOption_BigEndianScalarZ_Some_class != NULL);
2521         LDKCOption_BigEndianScalarZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_BigEndianScalarZ_Some_class, "<init>", "(J)V");
2522         CHECK(LDKCOption_BigEndianScalarZ_Some_meth != NULL);
2523         LDKCOption_BigEndianScalarZ_None_class =
2524                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_BigEndianScalarZ$None"));
2525         CHECK(LDKCOption_BigEndianScalarZ_None_class != NULL);
2526         LDKCOption_BigEndianScalarZ_None_meth = (*env)->GetMethodID(env, LDKCOption_BigEndianScalarZ_None_class, "<init>", "()V");
2527         CHECK(LDKCOption_BigEndianScalarZ_None_meth != NULL);
2528 }
2529 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1BigEndianScalarZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2530         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
2531         switch(obj->tag) {
2532                 case LDKCOption_BigEndianScalarZ_Some: {
2533                         LDKBigEndianScalar* some_ref = &obj->some;
2534                         return (*env)->NewObject(env, LDKCOption_BigEndianScalarZ_Some_class, LDKCOption_BigEndianScalarZ_Some_meth, tag_ptr(some_ref, false));
2535                 }
2536                 case LDKCOption_BigEndianScalarZ_None: {
2537                         return (*env)->NewObject(env, LDKCOption_BigEndianScalarZ_None_class, LDKCOption_BigEndianScalarZ_None_meth);
2538                 }
2539                 default: abort();
2540         }
2541 }
2542 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
2543 CHECK(owner->result_ok);
2544         return *owner->contents.result;
2545 }
2546 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2547         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
2548         int8_tArray ret_arr = (*env)->NewByteArray(env, 68);
2549         (*env)->SetByteArrayRegion(env, ret_arr, 0, 68, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form);
2550         return ret_arr;
2551 }
2552
2553 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
2554 CHECK(!owner->result_ok);
2555         return *owner->contents.err;
2556 }
2557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2558         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
2559         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
2560 }
2561
2562 static inline struct LDKSchnorrSignature CResult_SchnorrSignatureNoneZ_get_ok(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
2563 CHECK(owner->result_ok);
2564         return *owner->contents.result;
2565 }
2566 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2567         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
2568         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2569         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_SchnorrSignatureNoneZ_get_ok(owner_conv).compact_form);
2570         return ret_arr;
2571 }
2572
2573 static inline void CResult_SchnorrSignatureNoneZ_get_err(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
2574 CHECK(!owner->result_ok);
2575         return *owner->contents.err;
2576 }
2577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2578         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
2579         CResult_SchnorrSignatureNoneZ_get_err(owner_conv);
2580 }
2581
2582 typedef struct LDKChannelSigner_JCalls {
2583         atomic_size_t refcnt;
2584         JavaVM *vm;
2585         jweak o;
2586         jmethodID get_per_commitment_point_meth;
2587         jmethodID release_commitment_secret_meth;
2588         jmethodID validate_holder_commitment_meth;
2589         jmethodID channel_keys_id_meth;
2590         jmethodID provide_channel_parameters_meth;
2591 } LDKChannelSigner_JCalls;
2592 static void LDKChannelSigner_JCalls_free(void* this_arg) {
2593         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2594         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2595                 JNIEnv *env;
2596                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2597                 if (get_jenv_res == JNI_EDETACHED) {
2598                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2599                 } else {
2600                         DO_ASSERT(get_jenv_res == JNI_OK);
2601                 }
2602                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2603                 if (get_jenv_res == JNI_EDETACHED) {
2604                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2605                 }
2606                 FREE(j_calls);
2607         }
2608 }
2609 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
2610         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2611         JNIEnv *env;
2612         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2613         if (get_jenv_res == JNI_EDETACHED) {
2614                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2615         } else {
2616                 DO_ASSERT(get_jenv_res == JNI_OK);
2617         }
2618         int64_t idx_conv = idx;
2619         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2620         CHECK(obj != NULL);
2621         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx_conv);
2622         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2623                 (*env)->ExceptionDescribe(env);
2624                 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKChannelSigner from rust threw an exception.");
2625         }
2626         LDKPublicKey ret_ref;
2627         CHECK((*env)->GetArrayLength(env, ret) == 33);
2628         (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
2629         if (get_jenv_res == JNI_EDETACHED) {
2630                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2631         }
2632         return ret_ref;
2633 }
2634 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
2635         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2636         JNIEnv *env;
2637         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2638         if (get_jenv_res == JNI_EDETACHED) {
2639                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2640         } else {
2641                 DO_ASSERT(get_jenv_res == JNI_OK);
2642         }
2643         int64_t idx_conv = idx;
2644         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2645         CHECK(obj != NULL);
2646         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx_conv);
2647         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2648                 (*env)->ExceptionDescribe(env);
2649                 (*env)->FatalError(env, "A call to release_commitment_secret in LDKChannelSigner from rust threw an exception.");
2650         }
2651         LDKThirtyTwoBytes ret_ref;
2652         CHECK((*env)->GetArrayLength(env, ret) == 32);
2653         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2654         if (get_jenv_res == JNI_EDETACHED) {
2655                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2656         }
2657         return ret_ref;
2658 }
2659 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_ThirtyTwoBytesZ preimages) {
2660         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2661         JNIEnv *env;
2662         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2663         if (get_jenv_res == JNI_EDETACHED) {
2664                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2665         } else {
2666                 DO_ASSERT(get_jenv_res == JNI_OK);
2667         }
2668         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
2669         int64_t holder_tx_ref = 0;
2670         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
2671         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
2672         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
2673         LDKCVec_ThirtyTwoBytesZ preimages_var = preimages;
2674         jobjectArray preimages_arr = NULL;
2675         preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
2676         ;
2677         for (size_t i = 0; i < preimages_var.datalen; i++) {
2678                 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
2679                 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
2680                 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
2681         }
2682         
2683         FREE(preimages_var.data);
2684         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2685         CHECK(obj != NULL);
2686         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref, preimages_arr);
2687         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2688                 (*env)->ExceptionDescribe(env);
2689                 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKChannelSigner from rust threw an exception.");
2690         }
2691         void* ret_ptr = untag_ptr(ret);
2692         CHECK_ACCESS(ret_ptr);
2693         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
2694         FREE(untag_ptr(ret));
2695         if (get_jenv_res == JNI_EDETACHED) {
2696                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2697         }
2698         return ret_conv;
2699 }
2700 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
2701         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2702         JNIEnv *env;
2703         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2704         if (get_jenv_res == JNI_EDETACHED) {
2705                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2706         } else {
2707                 DO_ASSERT(get_jenv_res == JNI_OK);
2708         }
2709         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2710         CHECK(obj != NULL);
2711         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
2712         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2713                 (*env)->ExceptionDescribe(env);
2714                 (*env)->FatalError(env, "A call to channel_keys_id in LDKChannelSigner from rust threw an exception.");
2715         }
2716         LDKThirtyTwoBytes ret_ref;
2717         CHECK((*env)->GetArrayLength(env, ret) == 32);
2718         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2719         if (get_jenv_res == JNI_EDETACHED) {
2720                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2721         }
2722         return ret_ref;
2723 }
2724 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2725         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2726         JNIEnv *env;
2727         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2728         if (get_jenv_res == JNI_EDETACHED) {
2729                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2730         } else {
2731                 DO_ASSERT(get_jenv_res == JNI_OK);
2732         }
2733         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2734         int64_t channel_parameters_ref = 0;
2735         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
2736         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
2737         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
2738         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2739         CHECK(obj != NULL);
2740         (*env)->CallVoidMethod(env, obj, j_calls->provide_channel_parameters_meth, channel_parameters_ref);
2741         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2742                 (*env)->ExceptionDescribe(env);
2743                 (*env)->FatalError(env, "A call to provide_channel_parameters in LDKChannelSigner from rust threw an exception.");
2744         }
2745         if (get_jenv_res == JNI_EDETACHED) {
2746                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2747         }
2748 }
2749 static inline LDKChannelSigner LDKChannelSigner_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2750         jclass c = (*env)->GetObjectClass(env, o);
2751         CHECK(c != NULL);
2752         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
2753         atomic_init(&calls->refcnt, 1);
2754         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2755         calls->o = (*env)->NewWeakGlobalRef(env, o);
2756         calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2757         CHECK(calls->get_per_commitment_point_meth != NULL);
2758         calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2759         CHECK(calls->release_commitment_secret_meth != NULL);
2760         calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J[[B)J");
2761         CHECK(calls->validate_holder_commitment_meth != NULL);
2762         calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
2763         CHECK(calls->channel_keys_id_meth != NULL);
2764         calls->provide_channel_parameters_meth = (*env)->GetMethodID(env, c, "provide_channel_parameters", "(J)V");
2765         CHECK(calls->provide_channel_parameters_meth != NULL);
2766
2767         LDKChannelPublicKeys pubkeys_conv;
2768         pubkeys_conv.inner = untag_ptr(pubkeys);
2769         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2770         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2771
2772         LDKChannelSigner ret = {
2773                 .this_arg = (void*) calls,
2774                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
2775                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
2776                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
2777                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
2778                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
2779                 .free = LDKChannelSigner_JCalls_free,
2780                 .pubkeys = pubkeys_conv,
2781                 .set_pubkeys = NULL,
2782         };
2783         return ret;
2784 }
2785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2786         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
2787         *res_ptr = LDKChannelSigner_init(env, clz, o, pubkeys);
2788         return tag_ptr(res_ptr, true);
2789 }
2790 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) {
2791         void* this_arg_ptr = untag_ptr(this_arg);
2792         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2793         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2794         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2795         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2796         return ret_arr;
2797 }
2798
2799 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2800         void* this_arg_ptr = untag_ptr(this_arg);
2801         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2802         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2803         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2804         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2805         return ret_arr;
2806 }
2807
2808 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) {
2809         void* this_arg_ptr = untag_ptr(this_arg);
2810         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2811         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2812         LDKHolderCommitmentTransaction holder_tx_conv;
2813         holder_tx_conv.inner = untag_ptr(holder_tx);
2814         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
2815         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
2816         holder_tx_conv.is_owned = false;
2817         LDKCVec_ThirtyTwoBytesZ preimages_constr;
2818         preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
2819         if (preimages_constr.datalen > 0)
2820                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
2821         else
2822                 preimages_constr.data = NULL;
2823         for (size_t i = 0; i < preimages_constr.datalen; i++) {
2824                 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
2825                 LDKThirtyTwoBytes preimages_conv_8_ref;
2826                 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
2827                 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
2828                 preimages_constr.data[i] = preimages_conv_8_ref;
2829         }
2830         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2831         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
2832         return tag_ptr(ret_conv, true);
2833 }
2834
2835 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
2836         void* this_arg_ptr = untag_ptr(this_arg);
2837         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2838         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2839         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2840         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
2841         return ret_arr;
2842 }
2843
2844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1provide_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
2845         void* this_arg_ptr = untag_ptr(this_arg);
2846         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2847         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2848         LDKChannelTransactionParameters channel_parameters_conv;
2849         channel_parameters_conv.inner = untag_ptr(channel_parameters);
2850         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
2851         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
2852         channel_parameters_conv.is_owned = false;
2853         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
2854 }
2855
2856 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
2857         if (this_arg->set_pubkeys != NULL)
2858                 this_arg->set_pubkeys(this_arg);
2859         return this_arg->pubkeys;
2860 }
2861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
2862         void* this_arg_ptr = untag_ptr(this_arg);
2863         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2864         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2865         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
2866         int64_t ret_ref = 0;
2867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2869         return ret_ref;
2870 }
2871
2872 typedef struct LDKEcdsaChannelSigner_JCalls {
2873         atomic_size_t refcnt;
2874         JavaVM *vm;
2875         jweak o;
2876         LDKChannelSigner_JCalls* ChannelSigner;
2877         jmethodID sign_counterparty_commitment_meth;
2878         jmethodID validate_counterparty_revocation_meth;
2879         jmethodID sign_holder_commitment_meth;
2880         jmethodID sign_justice_revoked_output_meth;
2881         jmethodID sign_justice_revoked_htlc_meth;
2882         jmethodID sign_holder_htlc_transaction_meth;
2883         jmethodID sign_counterparty_htlc_transaction_meth;
2884         jmethodID sign_closing_transaction_meth;
2885         jmethodID sign_holder_anchor_input_meth;
2886         jmethodID sign_channel_announcement_with_funding_key_meth;
2887 } LDKEcdsaChannelSigner_JCalls;
2888 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
2889         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2890         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2891                 JNIEnv *env;
2892                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2893                 if (get_jenv_res == JNI_EDETACHED) {
2894                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2895                 } else {
2896                         DO_ASSERT(get_jenv_res == JNI_OK);
2897                 }
2898                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2899                 if (get_jenv_res == JNI_EDETACHED) {
2900                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2901                 }
2902                 FREE(j_calls);
2903         }
2904 }
2905 LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_ThirtyTwoBytesZ preimages) {
2906         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2907         JNIEnv *env;
2908         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2909         if (get_jenv_res == JNI_EDETACHED) {
2910                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2911         } else {
2912                 DO_ASSERT(get_jenv_res == JNI_OK);
2913         }
2914         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2915         int64_t commitment_tx_ref = 0;
2916         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
2917         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
2918         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
2919         LDKCVec_ThirtyTwoBytesZ preimages_var = preimages;
2920         jobjectArray preimages_arr = NULL;
2921         preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
2922         ;
2923         for (size_t i = 0; i < preimages_var.datalen; i++) {
2924                 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
2925                 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
2926                 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
2927         }
2928         
2929         FREE(preimages_var.data);
2930         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2931         CHECK(obj != NULL);
2932         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref, preimages_arr);
2933         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2934                 (*env)->ExceptionDescribe(env);
2935                 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKEcdsaChannelSigner from rust threw an exception.");
2936         }
2937         void* ret_ptr = untag_ptr(ret);
2938         CHECK_ACCESS(ret_ptr);
2939         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(ret_ptr);
2940         FREE(untag_ptr(ret));
2941         if (get_jenv_res == JNI_EDETACHED) {
2942                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2943         }
2944         return ret_conv;
2945 }
2946 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
2947         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2948         JNIEnv *env;
2949         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2950         if (get_jenv_res == JNI_EDETACHED) {
2951                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2952         } else {
2953                 DO_ASSERT(get_jenv_res == JNI_OK);
2954         }
2955         int64_t idx_conv = idx;
2956         int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
2957         (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
2958         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2959         CHECK(obj != NULL);
2960         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx_conv, secret_arr);
2961         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2962                 (*env)->ExceptionDescribe(env);
2963                 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKEcdsaChannelSigner from rust threw an exception.");
2964         }
2965         void* ret_ptr = untag_ptr(ret);
2966         CHECK_ACCESS(ret_ptr);
2967         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
2968         FREE(untag_ptr(ret));
2969         if (get_jenv_res == JNI_EDETACHED) {
2970                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2971         }
2972         return ret_conv;
2973 }
2974 LDKCResult_ECDSASignatureNoneZ sign_holder_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2975         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2976         JNIEnv *env;
2977         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2978         if (get_jenv_res == JNI_EDETACHED) {
2979                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2980         } else {
2981                 DO_ASSERT(get_jenv_res == JNI_OK);
2982         }
2983         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2984         int64_t commitment_tx_ref = 0;
2985         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
2986         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
2987         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
2988         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2989         CHECK(obj != NULL);
2990         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_meth, commitment_tx_ref);
2991         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2992                 (*env)->ExceptionDescribe(env);
2993                 (*env)->FatalError(env, "A call to sign_holder_commitment in LDKEcdsaChannelSigner from rust threw an exception.");
2994         }
2995         void* ret_ptr = untag_ptr(ret);
2996         CHECK_ACCESS(ret_ptr);
2997         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2998         FREE(untag_ptr(ret));
2999         if (get_jenv_res == JNI_EDETACHED) {
3000                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3001         }
3002         return ret_conv;
3003 }
3004 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]) {
3005         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3006         JNIEnv *env;
3007         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3008         if (get_jenv_res == JNI_EDETACHED) {
3009                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3010         } else {
3011                 DO_ASSERT(get_jenv_res == JNI_OK);
3012         }
3013         LDKTransaction justice_tx_var = justice_tx;
3014         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
3015         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
3016         Transaction_free(justice_tx_var);
3017         int64_t input_conv = input;
3018         int64_t amount_conv = amount;
3019         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
3020         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
3021         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3022         CHECK(obj != NULL);
3023         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);
3024         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3025                 (*env)->ExceptionDescribe(env);
3026                 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKEcdsaChannelSigner from rust threw an exception.");
3027         }
3028         void* ret_ptr = untag_ptr(ret);
3029         CHECK_ACCESS(ret_ptr);
3030         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3031         FREE(untag_ptr(ret));
3032         if (get_jenv_res == JNI_EDETACHED) {
3033                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3034         }
3035         return ret_conv;
3036 }
3037 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) {
3038         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3039         JNIEnv *env;
3040         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3041         if (get_jenv_res == JNI_EDETACHED) {
3042                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3043         } else {
3044                 DO_ASSERT(get_jenv_res == JNI_OK);
3045         }
3046         LDKTransaction justice_tx_var = justice_tx;
3047         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
3048         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
3049         Transaction_free(justice_tx_var);
3050         int64_t input_conv = input;
3051         int64_t amount_conv = amount;
3052         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
3053         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
3054         LDKHTLCOutputInCommitment htlc_var = *htlc;
3055         int64_t htlc_ref = 0;
3056         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3057         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3058         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
3059         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3060         CHECK(obj != NULL);
3061         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);
3062         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3063                 (*env)->ExceptionDescribe(env);
3064                 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKEcdsaChannelSigner from rust threw an exception.");
3065         }
3066         void* ret_ptr = untag_ptr(ret);
3067         CHECK_ACCESS(ret_ptr);
3068         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3069         FREE(untag_ptr(ret));
3070         if (get_jenv_res == JNI_EDETACHED) {
3071                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3072         }
3073         return ret_conv;
3074 }
3075 LDKCResult_ECDSASignatureNoneZ sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, const LDKHTLCDescriptor * htlc_descriptor) {
3076         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3077         JNIEnv *env;
3078         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3079         if (get_jenv_res == JNI_EDETACHED) {
3080                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3081         } else {
3082                 DO_ASSERT(get_jenv_res == JNI_OK);
3083         }
3084         LDKTransaction htlc_tx_var = htlc_tx;
3085         int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
3086         (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
3087         Transaction_free(htlc_tx_var);
3088         int64_t input_conv = input;
3089         LDKHTLCDescriptor htlc_descriptor_var = *htlc_descriptor;
3090         int64_t htlc_descriptor_ref = 0;
3091         htlc_descriptor_var = HTLCDescriptor_clone(&htlc_descriptor_var);
3092         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_var);
3093         htlc_descriptor_ref = tag_ptr(htlc_descriptor_var.inner, htlc_descriptor_var.is_owned);
3094         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3095         CHECK(obj != NULL);
3096         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_htlc_transaction_meth, htlc_tx_arr, input_conv, htlc_descriptor_ref);
3097         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3098                 (*env)->ExceptionDescribe(env);
3099                 (*env)->FatalError(env, "A call to sign_holder_htlc_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
3100         }
3101         void* ret_ptr = untag_ptr(ret);
3102         CHECK_ACCESS(ret_ptr);
3103         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3104         FREE(untag_ptr(ret));
3105         if (get_jenv_res == JNI_EDETACHED) {
3106                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3107         }
3108         return ret_conv;
3109 }
3110 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) {
3111         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3112         JNIEnv *env;
3113         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3114         if (get_jenv_res == JNI_EDETACHED) {
3115                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3116         } else {
3117                 DO_ASSERT(get_jenv_res == JNI_OK);
3118         }
3119         LDKTransaction htlc_tx_var = htlc_tx;
3120         int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
3121         (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
3122         Transaction_free(htlc_tx_var);
3123         int64_t input_conv = input;
3124         int64_t amount_conv = amount;
3125         int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
3126         (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
3127         LDKHTLCOutputInCommitment htlc_var = *htlc;
3128         int64_t htlc_ref = 0;
3129         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3130         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3131         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
3132         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3133         CHECK(obj != NULL);
3134         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);
3135         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3136                 (*env)->ExceptionDescribe(env);
3137                 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
3138         }
3139         void* ret_ptr = untag_ptr(ret);
3140         CHECK_ACCESS(ret_ptr);
3141         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3142         FREE(untag_ptr(ret));
3143         if (get_jenv_res == JNI_EDETACHED) {
3144                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3145         }
3146         return ret_conv;
3147 }
3148 LDKCResult_ECDSASignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
3149         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3150         JNIEnv *env;
3151         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3152         if (get_jenv_res == JNI_EDETACHED) {
3153                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3154         } else {
3155                 DO_ASSERT(get_jenv_res == JNI_OK);
3156         }
3157         LDKClosingTransaction closing_tx_var = *closing_tx;
3158         int64_t closing_tx_ref = 0;
3159         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
3160         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
3161         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
3162         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3163         CHECK(obj != NULL);
3164         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
3165         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3166                 (*env)->ExceptionDescribe(env);
3167                 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
3168         }
3169         void* ret_ptr = untag_ptr(ret);
3170         CHECK_ACCESS(ret_ptr);
3171         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3172         FREE(untag_ptr(ret));
3173         if (get_jenv_res == JNI_EDETACHED) {
3174                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3175         }
3176         return ret_conv;
3177 }
3178 LDKCResult_ECDSASignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
3179         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3180         JNIEnv *env;
3181         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3182         if (get_jenv_res == JNI_EDETACHED) {
3183                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3184         } else {
3185                 DO_ASSERT(get_jenv_res == JNI_OK);
3186         }
3187         LDKTransaction anchor_tx_var = anchor_tx;
3188         int8_tArray anchor_tx_arr = (*env)->NewByteArray(env, anchor_tx_var.datalen);
3189         (*env)->SetByteArrayRegion(env, anchor_tx_arr, 0, anchor_tx_var.datalen, anchor_tx_var.data);
3190         Transaction_free(anchor_tx_var);
3191         int64_t input_conv = input;
3192         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3193         CHECK(obj != NULL);
3194         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_anchor_input_meth, anchor_tx_arr, input_conv);
3195         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3196                 (*env)->ExceptionDescribe(env);
3197                 (*env)->FatalError(env, "A call to sign_holder_anchor_input in LDKEcdsaChannelSigner from rust threw an exception.");
3198         }
3199         void* ret_ptr = untag_ptr(ret);
3200         CHECK_ACCESS(ret_ptr);
3201         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3202         FREE(untag_ptr(ret));
3203         if (get_jenv_res == JNI_EDETACHED) {
3204                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3205         }
3206         return ret_conv;
3207 }
3208 LDKCResult_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
3209         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3210         JNIEnv *env;
3211         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3212         if (get_jenv_res == JNI_EDETACHED) {
3213                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3214         } else {
3215                 DO_ASSERT(get_jenv_res == JNI_OK);
3216         }
3217         LDKUnsignedChannelAnnouncement msg_var = *msg;
3218         int64_t msg_ref = 0;
3219         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
3220         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3221         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
3222         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3223         CHECK(obj != NULL);
3224         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_with_funding_key_meth, msg_ref);
3225         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3226                 (*env)->ExceptionDescribe(env);
3227                 (*env)->FatalError(env, "A call to sign_channel_announcement_with_funding_key in LDKEcdsaChannelSigner from rust threw an exception.");
3228         }
3229         void* ret_ptr = untag_ptr(ret);
3230         CHECK_ACCESS(ret_ptr);
3231         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3232         FREE(untag_ptr(ret));
3233         if (get_jenv_res == JNI_EDETACHED) {
3234                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3235         }
3236         return ret_conv;
3237 }
3238 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
3239         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
3240         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3241         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
3242 }
3243 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JNIEnv *env, jclass clz, jobject o, jobject ChannelSigner, int64_t pubkeys) {
3244         jclass c = (*env)->GetObjectClass(env, o);
3245         CHECK(c != NULL);
3246         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
3247         atomic_init(&calls->refcnt, 1);
3248         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3249         calls->o = (*env)->NewWeakGlobalRef(env, o);
3250         calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J[[B)J");
3251         CHECK(calls->sign_counterparty_commitment_meth != NULL);
3252         calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
3253         CHECK(calls->validate_counterparty_revocation_meth != NULL);
3254         calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
3255         CHECK(calls->sign_holder_commitment_meth != NULL);
3256         calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
3257         CHECK(calls->sign_justice_revoked_output_meth != NULL);
3258         calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
3259         CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
3260         calls->sign_holder_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_holder_htlc_transaction", "([BJJ)J");
3261         CHECK(calls->sign_holder_htlc_transaction_meth != NULL);
3262         calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
3263         CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
3264         calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
3265         CHECK(calls->sign_closing_transaction_meth != NULL);
3266         calls->sign_holder_anchor_input_meth = (*env)->GetMethodID(env, c, "sign_holder_anchor_input", "([BJ)J");
3267         CHECK(calls->sign_holder_anchor_input_meth != NULL);
3268         calls->sign_channel_announcement_with_funding_key_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement_with_funding_key", "(J)J");
3269         CHECK(calls->sign_channel_announcement_with_funding_key_meth != NULL);
3270
3271         LDKChannelPublicKeys pubkeys_conv;
3272         pubkeys_conv.inner = untag_ptr(pubkeys);
3273         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
3274         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3275
3276         LDKEcdsaChannelSigner ret = {
3277                 .this_arg = (void*) calls,
3278                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
3279                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall,
3280                 .sign_holder_commitment = sign_holder_commitment_LDKEcdsaChannelSigner_jcall,
3281                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
3282                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
3283                 .sign_holder_htlc_transaction = sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall,
3284                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
3285                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
3286                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
3287                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
3288                 .free = LDKEcdsaChannelSigner_JCalls_free,
3289                 .ChannelSigner = LDKChannelSigner_init(env, clz, ChannelSigner, pubkeys),
3290         };
3291         calls->ChannelSigner = ret.ChannelSigner.this_arg;
3292         return ret;
3293 }
3294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEcdsaChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, jobject ChannelSigner, int64_t pubkeys) {
3295         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
3296         *res_ptr = LDKEcdsaChannelSigner_init(env, clz, o, ChannelSigner, pubkeys);
3297         return tag_ptr(res_ptr, true);
3298 }
3299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEcdsaChannelSigner_1get_1ChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
3300         LDKEcdsaChannelSigner *inp = (LDKEcdsaChannelSigner *)untag_ptr(arg);
3301         return tag_ptr(&inp->ChannelSigner, false);
3302 }
3303 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) {
3304         void* this_arg_ptr = untag_ptr(this_arg);
3305         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3306         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3307         LDKCommitmentTransaction commitment_tx_conv;
3308         commitment_tx_conv.inner = untag_ptr(commitment_tx);
3309         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
3310         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3311         commitment_tx_conv.is_owned = false;
3312         LDKCVec_ThirtyTwoBytesZ preimages_constr;
3313         preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
3314         if (preimages_constr.datalen > 0)
3315                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
3316         else
3317                 preimages_constr.data = NULL;
3318         for (size_t i = 0; i < preimages_constr.datalen; i++) {
3319                 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
3320                 LDKThirtyTwoBytes preimages_conv_8_ref;
3321                 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
3322                 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
3323                 preimages_constr.data[i] = preimages_conv_8_ref;
3324         }
3325         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
3326         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
3327         return tag_ptr(ret_conv, true);
3328 }
3329
3330 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) {
3331         void* this_arg_ptr = untag_ptr(this_arg);
3332         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3333         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3334         uint8_t secret_arr[32];
3335         CHECK((*env)->GetArrayLength(env, secret) == 32);
3336         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
3337         uint8_t (*secret_ref)[32] = &secret_arr;
3338         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
3339         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
3340         return tag_ptr(ret_conv, true);
3341 }
3342
3343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1holder_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) {
3344         void* this_arg_ptr = untag_ptr(this_arg);
3345         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3346         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3347         LDKHolderCommitmentTransaction commitment_tx_conv;
3348         commitment_tx_conv.inner = untag_ptr(commitment_tx);
3349         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
3350         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3351         commitment_tx_conv.is_owned = false;
3352         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3353         *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
3354         return tag_ptr(ret_conv, true);
3355 }
3356
3357 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) {
3358         void* this_arg_ptr = untag_ptr(this_arg);
3359         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3360         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3361         LDKTransaction justice_tx_ref;
3362         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
3363         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3364         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
3365         justice_tx_ref.data_is_owned = true;
3366         uint8_t per_commitment_key_arr[32];
3367         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
3368         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
3369         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3370         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3371         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
3372         return tag_ptr(ret_conv, true);
3373 }
3374
3375 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) {
3376         void* this_arg_ptr = untag_ptr(this_arg);
3377         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3378         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3379         LDKTransaction justice_tx_ref;
3380         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
3381         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3382         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
3383         justice_tx_ref.data_is_owned = true;
3384         uint8_t per_commitment_key_arr[32];
3385         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
3386         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
3387         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3388         LDKHTLCOutputInCommitment htlc_conv;
3389         htlc_conv.inner = untag_ptr(htlc);
3390         htlc_conv.is_owned = ptr_is_owned(htlc);
3391         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3392         htlc_conv.is_owned = false;
3393         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3394         *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);
3395         return tag_ptr(ret_conv, true);
3396 }
3397
3398 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) {
3399         void* this_arg_ptr = untag_ptr(this_arg);
3400         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3401         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3402         LDKTransaction htlc_tx_ref;
3403         htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
3404         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
3405         (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
3406         htlc_tx_ref.data_is_owned = true;
3407         LDKHTLCDescriptor htlc_descriptor_conv;
3408         htlc_descriptor_conv.inner = untag_ptr(htlc_descriptor);
3409         htlc_descriptor_conv.is_owned = ptr_is_owned(htlc_descriptor);
3410         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_conv);
3411         htlc_descriptor_conv.is_owned = false;
3412         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3413         *ret_conv = (this_arg_conv->sign_holder_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, &htlc_descriptor_conv);
3414         return tag_ptr(ret_conv, true);
3415 }
3416
3417 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) {
3418         void* this_arg_ptr = untag_ptr(this_arg);
3419         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3420         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3421         LDKTransaction htlc_tx_ref;
3422         htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
3423         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
3424         (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
3425         htlc_tx_ref.data_is_owned = true;
3426         LDKPublicKey per_commitment_point_ref;
3427         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
3428         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
3429         LDKHTLCOutputInCommitment htlc_conv;
3430         htlc_conv.inner = untag_ptr(htlc);
3431         htlc_conv.is_owned = ptr_is_owned(htlc);
3432         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3433         htlc_conv.is_owned = false;
3434         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3435         *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);
3436         return tag_ptr(ret_conv, true);
3437 }
3438
3439 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) {
3440         void* this_arg_ptr = untag_ptr(this_arg);
3441         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3442         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3443         LDKClosingTransaction closing_tx_conv;
3444         closing_tx_conv.inner = untag_ptr(closing_tx);
3445         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
3446         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
3447         closing_tx_conv.is_owned = false;
3448         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3449         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
3450         return tag_ptr(ret_conv, true);
3451 }
3452
3453 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) {
3454         void* this_arg_ptr = untag_ptr(this_arg);
3455         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3456         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3457         LDKTransaction anchor_tx_ref;
3458         anchor_tx_ref.datalen = (*env)->GetArrayLength(env, anchor_tx);
3459         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
3460         (*env)->GetByteArrayRegion(env, anchor_tx, 0, anchor_tx_ref.datalen, anchor_tx_ref.data);
3461         anchor_tx_ref.data_is_owned = true;
3462         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3463         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
3464         return tag_ptr(ret_conv, true);
3465 }
3466
3467 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) {
3468         void* this_arg_ptr = untag_ptr(this_arg);
3469         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3470         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3471         LDKUnsignedChannelAnnouncement msg_conv;
3472         msg_conv.inner = untag_ptr(msg);
3473         msg_conv.is_owned = ptr_is_owned(msg);
3474         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
3475         msg_conv.is_owned = false;
3476         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3477         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
3478         return tag_ptr(ret_conv, true);
3479 }
3480
3481 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
3482         atomic_size_t refcnt;
3483         JavaVM *vm;
3484         jweak o;
3485         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
3486         LDKChannelSigner_JCalls* ChannelSigner;
3487         jmethodID write_meth;
3488 } LDKWriteableEcdsaChannelSigner_JCalls;
3489 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
3490         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
3491         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3492                 JNIEnv *env;
3493                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3494                 if (get_jenv_res == JNI_EDETACHED) {
3495                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3496                 } else {
3497                         DO_ASSERT(get_jenv_res == JNI_OK);
3498                 }
3499                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3500                 if (get_jenv_res == JNI_EDETACHED) {
3501                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3502                 }
3503                 FREE(j_calls);
3504         }
3505 }
3506 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
3507         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
3508         JNIEnv *env;
3509         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3510         if (get_jenv_res == JNI_EDETACHED) {
3511                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3512         } else {
3513                 DO_ASSERT(get_jenv_res == JNI_OK);
3514         }
3515         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3516         CHECK(obj != NULL);
3517         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
3518         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3519                 (*env)->ExceptionDescribe(env);
3520                 (*env)->FatalError(env, "A call to write in LDKWriteableEcdsaChannelSigner from rust threw an exception.");
3521         }
3522         LDKCVec_u8Z ret_ref;
3523         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3524         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3525         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3526         if (get_jenv_res == JNI_EDETACHED) {
3527                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3528         }
3529         return ret_ref;
3530 }
3531 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
3532         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
3533         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3534         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
3535         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
3536 }
3537 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (JNIEnv *env, jclass clz, jobject o, jobject EcdsaChannelSigner, jobject ChannelSigner, int64_t pubkeys) {
3538         jclass c = (*env)->GetObjectClass(env, o);
3539         CHECK(c != NULL);
3540         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
3541         atomic_init(&calls->refcnt, 1);
3542         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3543         calls->o = (*env)->NewWeakGlobalRef(env, o);
3544         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
3545         CHECK(calls->write_meth != NULL);
3546
3547         LDKChannelPublicKeys pubkeys_conv;
3548         pubkeys_conv.inner = untag_ptr(pubkeys);
3549         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
3550         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3551
3552         LDKWriteableEcdsaChannelSigner ret = {
3553                 .this_arg = (void*) calls,
3554                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
3555                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
3556                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
3557                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(env, clz, EcdsaChannelSigner, ChannelSigner, pubkeys),
3558         };
3559         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
3560         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
3561         return ret;
3562 }
3563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, jobject EcdsaChannelSigner, jobject ChannelSigner, int64_t pubkeys) {
3564         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
3565         *res_ptr = LDKWriteableEcdsaChannelSigner_init(env, clz, o, EcdsaChannelSigner, ChannelSigner, pubkeys);
3566         return tag_ptr(res_ptr, true);
3567 }
3568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1get_1EcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
3569         LDKWriteableEcdsaChannelSigner *inp = (LDKWriteableEcdsaChannelSigner *)untag_ptr(arg);
3570         return tag_ptr(&inp->EcdsaChannelSigner, false);
3571 }
3572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1get_1ChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
3573         LDKWriteableEcdsaChannelSigner *inp = (LDKWriteableEcdsaChannelSigner *)untag_ptr(arg);
3574         return tag_ptr(&inp->EcdsaChannelSigner.ChannelSigner, false);
3575 }
3576 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
3577         void* this_arg_ptr = untag_ptr(this_arg);
3578         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3579         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
3580         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3581         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3582         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3583         CVec_u8Z_free(ret_var);
3584         return ret_arr;
3585 }
3586
3587 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
3588 CHECK(owner->result_ok);
3589         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
3590 }
3591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3592         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
3593         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
3594         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
3595         return tag_ptr(ret_ret, true);
3596 }
3597
3598 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
3599 CHECK(!owner->result_ok);
3600         return DecodeError_clone(&*owner->contents.err);
3601 }
3602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3603         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
3604         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3605         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
3606         int64_t ret_ref = tag_ptr(ret_copy, true);
3607         return ret_ref;
3608 }
3609
3610 static inline struct LDKCVec_u8Z CResult_CVec_u8ZNoneZ_get_ok(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
3611 CHECK(owner->result_ok);
3612         return CVec_u8Z_clone(&*owner->contents.result);
3613 }
3614 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3615         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
3616         LDKCVec_u8Z ret_var = CResult_CVec_u8ZNoneZ_get_ok(owner_conv);
3617         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3618         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3619         CVec_u8Z_free(ret_var);
3620         return ret_arr;
3621 }
3622
3623 static inline void CResult_CVec_u8ZNoneZ_get_err(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
3624 CHECK(!owner->result_ok);
3625         return *owner->contents.err;
3626 }
3627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3628         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
3629         CResult_CVec_u8ZNoneZ_get_err(owner_conv);
3630 }
3631
3632 static inline struct LDKShutdownScript CResult_ShutdownScriptNoneZ_get_ok(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
3633         LDKShutdownScript ret = *owner->contents.result;
3634         ret.is_owned = false;
3635         return ret;
3636 }
3637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3638         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
3639         LDKShutdownScript ret_var = CResult_ShutdownScriptNoneZ_get_ok(owner_conv);
3640         int64_t ret_ref = 0;
3641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3643         return ret_ref;
3644 }
3645
3646 static inline void CResult_ShutdownScriptNoneZ_get_err(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
3647 CHECK(!owner->result_ok);
3648         return *owner->contents.err;
3649 }
3650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3651         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
3652         CResult_ShutdownScriptNoneZ_get_err(owner_conv);
3653 }
3654
3655 static jclass LDKCOption_u16Z_Some_class = NULL;
3656 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
3657 static jclass LDKCOption_u16Z_None_class = NULL;
3658 static jmethodID LDKCOption_u16Z_None_meth = NULL;
3659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
3660         LDKCOption_u16Z_Some_class =
3661                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$Some"));
3662         CHECK(LDKCOption_u16Z_Some_class != NULL);
3663         LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
3664         CHECK(LDKCOption_u16Z_Some_meth != NULL);
3665         LDKCOption_u16Z_None_class =
3666                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$None"));
3667         CHECK(LDKCOption_u16Z_None_class != NULL);
3668         LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
3669         CHECK(LDKCOption_u16Z_None_meth != NULL);
3670 }
3671 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3672         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
3673         switch(obj->tag) {
3674                 case LDKCOption_u16Z_Some: {
3675                         int16_t some_conv = obj->some;
3676                         return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, some_conv);
3677                 }
3678                 case LDKCOption_u16Z_None: {
3679                         return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
3680                 }
3681                 default: abort();
3682         }
3683 }
3684 static jclass LDKCOption_boolZ_Some_class = NULL;
3685 static jmethodID LDKCOption_boolZ_Some_meth = NULL;
3686 static jclass LDKCOption_boolZ_None_class = NULL;
3687 static jmethodID LDKCOption_boolZ_None_meth = NULL;
3688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1boolZ_init (JNIEnv *env, jclass clz) {
3689         LDKCOption_boolZ_Some_class =
3690                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_boolZ$Some"));
3691         CHECK(LDKCOption_boolZ_Some_class != NULL);
3692         LDKCOption_boolZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_boolZ_Some_class, "<init>", "(Z)V");
3693         CHECK(LDKCOption_boolZ_Some_meth != NULL);
3694         LDKCOption_boolZ_None_class =
3695                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_boolZ$None"));
3696         CHECK(LDKCOption_boolZ_None_class != NULL);
3697         LDKCOption_boolZ_None_meth = (*env)->GetMethodID(env, LDKCOption_boolZ_None_class, "<init>", "()V");
3698         CHECK(LDKCOption_boolZ_None_meth != NULL);
3699 }
3700 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1boolZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3701         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
3702         switch(obj->tag) {
3703                 case LDKCOption_boolZ_Some: {
3704                         jboolean some_conv = obj->some;
3705                         return (*env)->NewObject(env, LDKCOption_boolZ_Some_class, LDKCOption_boolZ_Some_meth, some_conv);
3706                 }
3707                 case LDKCOption_boolZ_None: {
3708                         return (*env)->NewObject(env, LDKCOption_boolZ_None_class, LDKCOption_boolZ_None_meth);
3709                 }
3710                 default: abort();
3711         }
3712 }
3713 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
3714         LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
3715         for (size_t i = 0; i < ret.datalen; i++) {
3716                 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
3717         }
3718         return ret;
3719 }
3720 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
3721 CHECK(owner->result_ok);
3722         return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
3723 }
3724 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3725         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
3726         LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
3727         jobjectArray ret_arr = NULL;
3728         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
3729         ;
3730         for (size_t i = 0; i < ret_var.datalen; i++) {
3731                 LDKCVec_u8Z ret_conv_8_var = ret_var.data[i];
3732                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
3733                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
3734                 CVec_u8Z_free(ret_conv_8_var);
3735                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
3736         }
3737         
3738         FREE(ret_var.data);
3739         return ret_arr;
3740 }
3741
3742 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
3743 CHECK(!owner->result_ok);
3744         return *owner->contents.err;
3745 }
3746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3747         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
3748         CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
3749 }
3750
3751 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
3752         LDKInMemorySigner ret = *owner->contents.result;
3753         ret.is_owned = false;
3754         return ret;
3755 }
3756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3757         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
3758         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
3759         int64_t ret_ref = 0;
3760         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3761         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3762         return ret_ref;
3763 }
3764
3765 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
3766 CHECK(!owner->result_ok);
3767         return DecodeError_clone(&*owner->contents.err);
3768 }
3769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3770         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
3771         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3772         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
3773         int64_t ret_ref = tag_ptr(ret_copy, true);
3774         return ret_ref;
3775 }
3776
3777 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
3778 CHECK(owner->result_ok);
3779         return *owner->contents.result;
3780 }
3781 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3782         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
3783         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
3784         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3785         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3786         return ret_arr;
3787 }
3788
3789 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
3790 CHECK(!owner->result_ok);
3791         return *owner->contents.err;
3792 }
3793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3794         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
3795         CResult_TransactionNoneZ_get_err(owner_conv);
3796 }
3797
3798 typedef struct LDKScoreLookUp_JCalls {
3799         atomic_size_t refcnt;
3800         JavaVM *vm;
3801         jweak o;
3802         jmethodID channel_penalty_msat_meth;
3803 } LDKScoreLookUp_JCalls;
3804 static void LDKScoreLookUp_JCalls_free(void* this_arg) {
3805         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
3806         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3807                 JNIEnv *env;
3808                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3809                 if (get_jenv_res == JNI_EDETACHED) {
3810                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3811                 } else {
3812                         DO_ASSERT(get_jenv_res == JNI_OK);
3813                 }
3814                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3815                 if (get_jenv_res == JNI_EDETACHED) {
3816                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3817                 }
3818                 FREE(j_calls);
3819         }
3820 }
3821 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) {
3822         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
3823         JNIEnv *env;
3824         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3825         if (get_jenv_res == JNI_EDETACHED) {
3826                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3827         } else {
3828                 DO_ASSERT(get_jenv_res == JNI_OK);
3829         }
3830         int64_t short_channel_id_conv = short_channel_id;
3831         LDKNodeId source_var = *source;
3832         int64_t source_ref = 0;
3833         source_var = NodeId_clone(&source_var);
3834         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
3835         source_ref = tag_ptr(source_var.inner, source_var.is_owned);
3836         LDKNodeId target_var = *target;
3837         int64_t target_ref = 0;
3838         target_var = NodeId_clone(&target_var);
3839         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
3840         target_ref = tag_ptr(target_var.inner, target_var.is_owned);
3841         LDKChannelUsage usage_var = usage;
3842         int64_t usage_ref = 0;
3843         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
3844         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
3845         LDKProbabilisticScoringFeeParameters score_params_var = *score_params;
3846         int64_t score_params_ref = 0;
3847         score_params_var = ProbabilisticScoringFeeParameters_clone(&score_params_var);
3848         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_var);
3849         score_params_ref = tag_ptr(score_params_var.inner, score_params_var.is_owned);
3850         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3851         CHECK(obj != NULL);
3852         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);
3853         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3854                 (*env)->ExceptionDescribe(env);
3855                 (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScoreLookUp from rust threw an exception.");
3856         }
3857         if (get_jenv_res == JNI_EDETACHED) {
3858                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3859         }
3860         return ret;
3861 }
3862 static void LDKScoreLookUp_JCalls_cloned(LDKScoreLookUp* new_obj) {
3863         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) new_obj->this_arg;
3864         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3865 }
3866 static inline LDKScoreLookUp LDKScoreLookUp_init (JNIEnv *env, jclass clz, jobject o) {
3867         jclass c = (*env)->GetObjectClass(env, o);
3868         CHECK(c != NULL);
3869         LDKScoreLookUp_JCalls *calls = MALLOC(sizeof(LDKScoreLookUp_JCalls), "LDKScoreLookUp_JCalls");
3870         atomic_init(&calls->refcnt, 1);
3871         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3872         calls->o = (*env)->NewWeakGlobalRef(env, o);
3873         calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJJJ)J");
3874         CHECK(calls->channel_penalty_msat_meth != NULL);
3875
3876         LDKScoreLookUp ret = {
3877                 .this_arg = (void*) calls,
3878                 .channel_penalty_msat = channel_penalty_msat_LDKScoreLookUp_jcall,
3879                 .free = LDKScoreLookUp_JCalls_free,
3880         };
3881         return ret;
3882 }
3883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScoreLookUp_1new(JNIEnv *env, jclass clz, jobject o) {
3884         LDKScoreLookUp *res_ptr = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
3885         *res_ptr = LDKScoreLookUp_init(env, clz, o);
3886         return tag_ptr(res_ptr, true);
3887 }
3888 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) {
3889         void* this_arg_ptr = untag_ptr(this_arg);
3890         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3891         LDKScoreLookUp* this_arg_conv = (LDKScoreLookUp*)this_arg_ptr;
3892         LDKNodeId source_conv;
3893         source_conv.inner = untag_ptr(source);
3894         source_conv.is_owned = ptr_is_owned(source);
3895         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
3896         source_conv.is_owned = false;
3897         LDKNodeId target_conv;
3898         target_conv.inner = untag_ptr(target);
3899         target_conv.is_owned = ptr_is_owned(target);
3900         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
3901         target_conv.is_owned = false;
3902         LDKChannelUsage usage_conv;
3903         usage_conv.inner = untag_ptr(usage);
3904         usage_conv.is_owned = ptr_is_owned(usage);
3905         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
3906         usage_conv = ChannelUsage_clone(&usage_conv);
3907         LDKProbabilisticScoringFeeParameters score_params_conv;
3908         score_params_conv.inner = untag_ptr(score_params);
3909         score_params_conv.is_owned = ptr_is_owned(score_params);
3910         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
3911         score_params_conv.is_owned = false;
3912         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);
3913         return ret_conv;
3914 }
3915
3916 typedef struct LDKScoreUpdate_JCalls {
3917         atomic_size_t refcnt;
3918         JavaVM *vm;
3919         jweak o;
3920         jmethodID payment_path_failed_meth;
3921         jmethodID payment_path_successful_meth;
3922         jmethodID probe_failed_meth;
3923         jmethodID probe_successful_meth;
3924 } LDKScoreUpdate_JCalls;
3925 static void LDKScoreUpdate_JCalls_free(void* this_arg) {
3926         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
3927         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3928                 JNIEnv *env;
3929                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3930                 if (get_jenv_res == JNI_EDETACHED) {
3931                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3932                 } else {
3933                         DO_ASSERT(get_jenv_res == JNI_OK);
3934                 }
3935                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3936                 if (get_jenv_res == JNI_EDETACHED) {
3937                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3938                 }
3939                 FREE(j_calls);
3940         }
3941 }
3942 void payment_path_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id) {
3943         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
3944         JNIEnv *env;
3945         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3946         if (get_jenv_res == JNI_EDETACHED) {
3947                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3948         } else {
3949                 DO_ASSERT(get_jenv_res == JNI_OK);
3950         }
3951         LDKPath path_var = *path;
3952         int64_t path_ref = 0;
3953         path_var = Path_clone(&path_var);
3954         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
3955         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
3956         int64_t short_channel_id_conv = short_channel_id;
3957         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3958         CHECK(obj != NULL);
3959         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_failed_meth, path_ref, short_channel_id_conv);
3960         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3961                 (*env)->ExceptionDescribe(env);
3962                 (*env)->FatalError(env, "A call to payment_path_failed 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 void payment_path_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path) {
3969         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
3970         JNIEnv *env;
3971         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3972         if (get_jenv_res == JNI_EDETACHED) {
3973                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3974         } else {
3975                 DO_ASSERT(get_jenv_res == JNI_OK);
3976         }
3977         LDKPath path_var = *path;
3978         int64_t path_ref = 0;
3979         path_var = Path_clone(&path_var);
3980         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
3981         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
3982         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3983         CHECK(obj != NULL);
3984         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_successful_meth, path_ref);
3985         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3986                 (*env)->ExceptionDescribe(env);
3987                 (*env)->FatalError(env, "A call to payment_path_successful in LDKScoreUpdate from rust threw an exception.");
3988         }
3989         if (get_jenv_res == JNI_EDETACHED) {
3990                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3991         }
3992 }
3993 void probe_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id) {
3994         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
3995         JNIEnv *env;
3996         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3997         if (get_jenv_res == JNI_EDETACHED) {
3998                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3999         } else {
4000                 DO_ASSERT(get_jenv_res == JNI_OK);
4001         }
4002         LDKPath path_var = *path;
4003         int64_t path_ref = 0;
4004         path_var = Path_clone(&path_var);
4005         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4006         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
4007         int64_t short_channel_id_conv = short_channel_id;
4008         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4009         CHECK(obj != NULL);
4010         (*env)->CallVoidMethod(env, obj, j_calls->probe_failed_meth, path_ref, short_channel_id_conv);
4011         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4012                 (*env)->ExceptionDescribe(env);
4013                 (*env)->FatalError(env, "A call to probe_failed in LDKScoreUpdate from rust threw an exception.");
4014         }
4015         if (get_jenv_res == JNI_EDETACHED) {
4016                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4017         }
4018 }
4019 void probe_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path) {
4020         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
4021         JNIEnv *env;
4022         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4023         if (get_jenv_res == JNI_EDETACHED) {
4024                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4025         } else {
4026                 DO_ASSERT(get_jenv_res == JNI_OK);
4027         }
4028         LDKPath path_var = *path;
4029         int64_t path_ref = 0;
4030         path_var = Path_clone(&path_var);
4031         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4032         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
4033         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4034         CHECK(obj != NULL);
4035         (*env)->CallVoidMethod(env, obj, j_calls->probe_successful_meth, path_ref);
4036         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4037                 (*env)->ExceptionDescribe(env);
4038                 (*env)->FatalError(env, "A call to probe_successful in LDKScoreUpdate from rust threw an exception.");
4039         }
4040         if (get_jenv_res == JNI_EDETACHED) {
4041                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4042         }
4043 }
4044 static void LDKScoreUpdate_JCalls_cloned(LDKScoreUpdate* new_obj) {
4045         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) new_obj->this_arg;
4046         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4047 }
4048 static inline LDKScoreUpdate LDKScoreUpdate_init (JNIEnv *env, jclass clz, jobject o) {
4049         jclass c = (*env)->GetObjectClass(env, o);
4050         CHECK(c != NULL);
4051         LDKScoreUpdate_JCalls *calls = MALLOC(sizeof(LDKScoreUpdate_JCalls), "LDKScoreUpdate_JCalls");
4052         atomic_init(&calls->refcnt, 1);
4053         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4054         calls->o = (*env)->NewWeakGlobalRef(env, o);
4055         calls->payment_path_failed_meth = (*env)->GetMethodID(env, c, "payment_path_failed", "(JJ)V");
4056         CHECK(calls->payment_path_failed_meth != NULL);
4057         calls->payment_path_successful_meth = (*env)->GetMethodID(env, c, "payment_path_successful", "(J)V");
4058         CHECK(calls->payment_path_successful_meth != NULL);
4059         calls->probe_failed_meth = (*env)->GetMethodID(env, c, "probe_failed", "(JJ)V");
4060         CHECK(calls->probe_failed_meth != NULL);
4061         calls->probe_successful_meth = (*env)->GetMethodID(env, c, "probe_successful", "(J)V");
4062         CHECK(calls->probe_successful_meth != NULL);
4063
4064         LDKScoreUpdate ret = {
4065                 .this_arg = (void*) calls,
4066                 .payment_path_failed = payment_path_failed_LDKScoreUpdate_jcall,
4067                 .payment_path_successful = payment_path_successful_LDKScoreUpdate_jcall,
4068                 .probe_failed = probe_failed_LDKScoreUpdate_jcall,
4069                 .probe_successful = probe_successful_LDKScoreUpdate_jcall,
4070                 .free = LDKScoreUpdate_JCalls_free,
4071         };
4072         return ret;
4073 }
4074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScoreUpdate_1new(JNIEnv *env, jclass clz, jobject o) {
4075         LDKScoreUpdate *res_ptr = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
4076         *res_ptr = LDKScoreUpdate_init(env, clz, o);
4077         return tag_ptr(res_ptr, true);
4078 }
4079 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) {
4080         void* this_arg_ptr = untag_ptr(this_arg);
4081         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4082         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4083         LDKPath path_conv;
4084         path_conv.inner = untag_ptr(path);
4085         path_conv.is_owned = ptr_is_owned(path);
4086         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4087         path_conv.is_owned = false;
4088         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id);
4089 }
4090
4091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1payment_1path_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
4092         void* this_arg_ptr = untag_ptr(this_arg);
4093         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4094         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4095         LDKPath path_conv;
4096         path_conv.inner = untag_ptr(path);
4097         path_conv.is_owned = ptr_is_owned(path);
4098         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4099         path_conv.is_owned = false;
4100         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, &path_conv);
4101 }
4102
4103 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) {
4104         void* this_arg_ptr = untag_ptr(this_arg);
4105         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4106         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4107         LDKPath path_conv;
4108         path_conv.inner = untag_ptr(path);
4109         path_conv.is_owned = ptr_is_owned(path);
4110         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4111         path_conv.is_owned = false;
4112         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id);
4113 }
4114
4115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1probe_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
4116         void* this_arg_ptr = untag_ptr(this_arg);
4117         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4118         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4119         LDKPath path_conv;
4120         path_conv.inner = untag_ptr(path);
4121         path_conv.is_owned = ptr_is_owned(path);
4122         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4123         path_conv.is_owned = false;
4124         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, &path_conv);
4125 }
4126
4127 typedef struct LDKLockableScore_JCalls {
4128         atomic_size_t refcnt;
4129         JavaVM *vm;
4130         jweak o;
4131         jmethodID read_lock_meth;
4132         jmethodID write_lock_meth;
4133 } LDKLockableScore_JCalls;
4134 static void LDKLockableScore_JCalls_free(void* this_arg) {
4135         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
4136         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4137                 JNIEnv *env;
4138                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4139                 if (get_jenv_res == JNI_EDETACHED) {
4140                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4141                 } else {
4142                         DO_ASSERT(get_jenv_res == JNI_OK);
4143                 }
4144                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4145                 if (get_jenv_res == JNI_EDETACHED) {
4146                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4147                 }
4148                 FREE(j_calls);
4149         }
4150 }
4151 LDKScoreLookUp read_lock_LDKLockableScore_jcall(const void* this_arg) {
4152         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
4153         JNIEnv *env;
4154         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4155         if (get_jenv_res == JNI_EDETACHED) {
4156                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4157         } else {
4158                 DO_ASSERT(get_jenv_res == JNI_OK);
4159         }
4160         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4161         CHECK(obj != NULL);
4162         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_lock_meth);
4163         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4164                 (*env)->ExceptionDescribe(env);
4165                 (*env)->FatalError(env, "A call to read_lock in LDKLockableScore from rust threw an exception.");
4166         }
4167         void* ret_ptr = untag_ptr(ret);
4168         CHECK_ACCESS(ret_ptr);
4169         LDKScoreLookUp ret_conv = *(LDKScoreLookUp*)(ret_ptr);
4170         if (ret_conv.free == LDKScoreLookUp_JCalls_free) {
4171                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4172                 LDKScoreLookUp_JCalls_cloned(&ret_conv);
4173         }// WARNING: we may need a move here but no clone is available for LDKScoreLookUp
4174         
4175         if (get_jenv_res == JNI_EDETACHED) {
4176                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4177         }
4178         return ret_conv;
4179 }
4180 LDKScoreUpdate write_lock_LDKLockableScore_jcall(const void* this_arg) {
4181         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
4182         JNIEnv *env;
4183         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4184         if (get_jenv_res == JNI_EDETACHED) {
4185                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4186         } else {
4187                 DO_ASSERT(get_jenv_res == JNI_OK);
4188         }
4189         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4190         CHECK(obj != NULL);
4191         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->write_lock_meth);
4192         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4193                 (*env)->ExceptionDescribe(env);
4194                 (*env)->FatalError(env, "A call to write_lock in LDKLockableScore from rust threw an exception.");
4195         }
4196         void* ret_ptr = untag_ptr(ret);
4197         CHECK_ACCESS(ret_ptr);
4198         LDKScoreUpdate ret_conv = *(LDKScoreUpdate*)(ret_ptr);
4199         if (ret_conv.free == LDKScoreUpdate_JCalls_free) {
4200                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4201                 LDKScoreUpdate_JCalls_cloned(&ret_conv);
4202         }// WARNING: we may need a move here but no clone is available for LDKScoreUpdate
4203         
4204         if (get_jenv_res == JNI_EDETACHED) {
4205                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4206         }
4207         return ret_conv;
4208 }
4209 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
4210         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
4211         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4212 }
4213 static inline LDKLockableScore LDKLockableScore_init (JNIEnv *env, jclass clz, jobject o) {
4214         jclass c = (*env)->GetObjectClass(env, o);
4215         CHECK(c != NULL);
4216         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
4217         atomic_init(&calls->refcnt, 1);
4218         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4219         calls->o = (*env)->NewWeakGlobalRef(env, o);
4220         calls->read_lock_meth = (*env)->GetMethodID(env, c, "read_lock", "()J");
4221         CHECK(calls->read_lock_meth != NULL);
4222         calls->write_lock_meth = (*env)->GetMethodID(env, c, "write_lock", "()J");
4223         CHECK(calls->write_lock_meth != NULL);
4224
4225         LDKLockableScore ret = {
4226                 .this_arg = (void*) calls,
4227                 .read_lock = read_lock_LDKLockableScore_jcall,
4228                 .write_lock = write_lock_LDKLockableScore_jcall,
4229                 .free = LDKLockableScore_JCalls_free,
4230         };
4231         return ret;
4232 }
4233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLockableScore_1new(JNIEnv *env, jclass clz, jobject o) {
4234         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
4235         *res_ptr = LDKLockableScore_init(env, clz, o);
4236         return tag_ptr(res_ptr, true);
4237 }
4238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1read_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
4239         void* this_arg_ptr = untag_ptr(this_arg);
4240         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4241         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
4242         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
4243         *ret_ret = (this_arg_conv->read_lock)(this_arg_conv->this_arg);
4244         return tag_ptr(ret_ret, true);
4245 }
4246
4247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1write_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
4248         void* this_arg_ptr = untag_ptr(this_arg);
4249         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4250         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
4251         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
4252         *ret_ret = (this_arg_conv->write_lock)(this_arg_conv->this_arg);
4253         return tag_ptr(ret_ret, true);
4254 }
4255
4256 typedef struct LDKWriteableScore_JCalls {
4257         atomic_size_t refcnt;
4258         JavaVM *vm;
4259         jweak o;
4260         LDKLockableScore_JCalls* LockableScore;
4261         jmethodID write_meth;
4262 } LDKWriteableScore_JCalls;
4263 static void LDKWriteableScore_JCalls_free(void* this_arg) {
4264         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
4265         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4266                 JNIEnv *env;
4267                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4268                 if (get_jenv_res == JNI_EDETACHED) {
4269                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4270                 } else {
4271                         DO_ASSERT(get_jenv_res == JNI_OK);
4272                 }
4273                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4274                 if (get_jenv_res == JNI_EDETACHED) {
4275                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4276                 }
4277                 FREE(j_calls);
4278         }
4279 }
4280 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
4281         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
4282         JNIEnv *env;
4283         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4284         if (get_jenv_res == JNI_EDETACHED) {
4285                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4286         } else {
4287                 DO_ASSERT(get_jenv_res == JNI_OK);
4288         }
4289         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4290         CHECK(obj != NULL);
4291         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
4292         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4293                 (*env)->ExceptionDescribe(env);
4294                 (*env)->FatalError(env, "A call to write in LDKWriteableScore from rust threw an exception.");
4295         }
4296         LDKCVec_u8Z ret_ref;
4297         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
4298         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4299         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
4300         if (get_jenv_res == JNI_EDETACHED) {
4301                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4302         }
4303         return ret_ref;
4304 }
4305 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
4306         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
4307         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4308         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
4309 }
4310 static inline LDKWriteableScore LDKWriteableScore_init (JNIEnv *env, jclass clz, jobject o, jobject LockableScore) {
4311         jclass c = (*env)->GetObjectClass(env, o);
4312         CHECK(c != NULL);
4313         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
4314         atomic_init(&calls->refcnt, 1);
4315         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4316         calls->o = (*env)->NewWeakGlobalRef(env, o);
4317         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
4318         CHECK(calls->write_meth != NULL);
4319
4320         LDKWriteableScore ret = {
4321                 .this_arg = (void*) calls,
4322                 .write = write_LDKWriteableScore_jcall,
4323                 .free = LDKWriteableScore_JCalls_free,
4324                 .LockableScore = LDKLockableScore_init(env, clz, LockableScore),
4325         };
4326         calls->LockableScore = ret.LockableScore.this_arg;
4327         return ret;
4328 }
4329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableScore_1new(JNIEnv *env, jclass clz, jobject o, jobject LockableScore) {
4330         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
4331         *res_ptr = LDKWriteableScore_init(env, clz, o, LockableScore);
4332         return tag_ptr(res_ptr, true);
4333 }
4334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableScore_1get_1LockableScore(JNIEnv *env, jclass clz, int64_t arg) {
4335         LDKWriteableScore *inp = (LDKWriteableScore *)untag_ptr(arg);
4336         return tag_ptr(&inp->LockableScore, false);
4337 }
4338 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WriteableScore_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
4339         void* this_arg_ptr = untag_ptr(this_arg);
4340         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4341         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
4342         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4343         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4344         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4345         CVec_u8Z_free(ret_var);
4346         return ret_arr;
4347 }
4348
4349 static jclass LDKCOption_WriteableScoreZ_Some_class = NULL;
4350 static jmethodID LDKCOption_WriteableScoreZ_Some_meth = NULL;
4351 static jclass LDKCOption_WriteableScoreZ_None_class = NULL;
4352 static jmethodID LDKCOption_WriteableScoreZ_None_meth = NULL;
4353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1WriteableScoreZ_init (JNIEnv *env, jclass clz) {
4354         LDKCOption_WriteableScoreZ_Some_class =
4355                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_WriteableScoreZ$Some"));
4356         CHECK(LDKCOption_WriteableScoreZ_Some_class != NULL);
4357         LDKCOption_WriteableScoreZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_WriteableScoreZ_Some_class, "<init>", "(J)V");
4358         CHECK(LDKCOption_WriteableScoreZ_Some_meth != NULL);
4359         LDKCOption_WriteableScoreZ_None_class =
4360                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_WriteableScoreZ$None"));
4361         CHECK(LDKCOption_WriteableScoreZ_None_class != NULL);
4362         LDKCOption_WriteableScoreZ_None_meth = (*env)->GetMethodID(env, LDKCOption_WriteableScoreZ_None_class, "<init>", "()V");
4363         CHECK(LDKCOption_WriteableScoreZ_None_meth != NULL);
4364 }
4365 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1WriteableScoreZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4366         LDKCOption_WriteableScoreZ *obj = (LDKCOption_WriteableScoreZ*)untag_ptr(ptr);
4367         switch(obj->tag) {
4368                 case LDKCOption_WriteableScoreZ_Some: {
4369                         LDKWriteableScore* some_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
4370                         *some_ret = obj->some;
4371                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
4372                         if ((*some_ret).free == LDKWriteableScore_JCalls_free) {
4373                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4374                                 LDKWriteableScore_JCalls_cloned(&(*some_ret));
4375                         }
4376                         return (*env)->NewObject(env, LDKCOption_WriteableScoreZ_Some_class, LDKCOption_WriteableScoreZ_Some_meth, tag_ptr(some_ret, true));
4377                 }
4378                 case LDKCOption_WriteableScoreZ_None: {
4379                         return (*env)->NewObject(env, LDKCOption_WriteableScoreZ_None_class, LDKCOption_WriteableScoreZ_None_meth);
4380                 }
4381                 default: abort();
4382         }
4383 }
4384 static inline void CResult_NoneIOErrorZ_get_ok(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
4385 CHECK(owner->result_ok);
4386         return *owner->contents.result;
4387 }
4388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4389         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
4390         CResult_NoneIOErrorZ_get_ok(owner_conv);
4391 }
4392
4393 static inline enum LDKIOError CResult_NoneIOErrorZ_get_err(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
4394 CHECK(!owner->result_ok);
4395         return *owner->contents.err;
4396 }
4397 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4398         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
4399         jclass ret_conv = LDKIOError_to_java(env, CResult_NoneIOErrorZ_get_err(owner_conv));
4400         return ret_conv;
4401 }
4402
4403 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
4404         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
4405         for (size_t i = 0; i < ret.datalen; i++) {
4406                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
4407         }
4408         return ret;
4409 }
4410 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
4411         LDKRoute ret = *owner->contents.result;
4412         ret.is_owned = false;
4413         return ret;
4414 }
4415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4416         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
4417         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
4418         int64_t ret_ref = 0;
4419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4421         return ret_ref;
4422 }
4423
4424 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
4425         LDKLightningError ret = *owner->contents.err;
4426         ret.is_owned = false;
4427         return ret;
4428 }
4429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4430         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
4431         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
4432         int64_t ret_ref = 0;
4433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4435         return ret_ref;
4436 }
4437
4438 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
4439         LDKInFlightHtlcs ret = *owner->contents.result;
4440         ret.is_owned = false;
4441         return ret;
4442 }
4443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4444         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
4445         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
4446         int64_t ret_ref = 0;
4447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4449         return ret_ref;
4450 }
4451
4452 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
4453 CHECK(!owner->result_ok);
4454         return DecodeError_clone(&*owner->contents.err);
4455 }
4456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4457         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
4458         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4459         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
4460         int64_t ret_ref = tag_ptr(ret_copy, true);
4461         return ret_ref;
4462 }
4463
4464 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
4465         LDKRouteHop ret = *owner->contents.result;
4466         ret.is_owned = false;
4467         return ret;
4468 }
4469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4470         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
4471         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
4472         int64_t ret_ref = 0;
4473         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4474         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4475         return ret_ref;
4476 }
4477
4478 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
4479 CHECK(!owner->result_ok);
4480         return DecodeError_clone(&*owner->contents.err);
4481 }
4482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4483         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
4484         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4485         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
4486         int64_t ret_ref = tag_ptr(ret_copy, true);
4487         return ret_ref;
4488 }
4489
4490 static inline LDKCVec_BlindedHopZ CVec_BlindedHopZ_clone(const LDKCVec_BlindedHopZ *orig) {
4491         LDKCVec_BlindedHopZ ret = { .data = MALLOC(sizeof(LDKBlindedHop) * orig->datalen, "LDKCVec_BlindedHopZ clone bytes"), .datalen = orig->datalen };
4492         for (size_t i = 0; i < ret.datalen; i++) {
4493                 ret.data[i] = BlindedHop_clone(&orig->data[i]);
4494         }
4495         return ret;
4496 }
4497 static inline struct LDKBlindedTail CResult_BlindedTailDecodeErrorZ_get_ok(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
4498         LDKBlindedTail ret = *owner->contents.result;
4499         ret.is_owned = false;
4500         return ret;
4501 }
4502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4503         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
4504         LDKBlindedTail ret_var = CResult_BlindedTailDecodeErrorZ_get_ok(owner_conv);
4505         int64_t ret_ref = 0;
4506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4508         return ret_ref;
4509 }
4510
4511 static inline struct LDKDecodeError CResult_BlindedTailDecodeErrorZ_get_err(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
4512 CHECK(!owner->result_ok);
4513         return DecodeError_clone(&*owner->contents.err);
4514 }
4515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4516         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
4517         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4518         *ret_copy = CResult_BlindedTailDecodeErrorZ_get_err(owner_conv);
4519         int64_t ret_ref = tag_ptr(ret_copy, true);
4520         return ret_ref;
4521 }
4522
4523 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
4524         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
4525         for (size_t i = 0; i < ret.datalen; i++) {
4526                 ret.data[i] = RouteHop_clone(&orig->data[i]);
4527         }
4528         return ret;
4529 }
4530 static inline LDKCVec_PathZ CVec_PathZ_clone(const LDKCVec_PathZ *orig) {
4531         LDKCVec_PathZ ret = { .data = MALLOC(sizeof(LDKPath) * orig->datalen, "LDKCVec_PathZ clone bytes"), .datalen = orig->datalen };
4532         for (size_t i = 0; i < ret.datalen; i++) {
4533                 ret.data[i] = Path_clone(&orig->data[i]);
4534         }
4535         return ret;
4536 }
4537 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
4538         LDKRoute ret = *owner->contents.result;
4539         ret.is_owned = false;
4540         return ret;
4541 }
4542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4543         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
4544         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
4545         int64_t ret_ref = 0;
4546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4548         return ret_ref;
4549 }
4550
4551 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
4552 CHECK(!owner->result_ok);
4553         return DecodeError_clone(&*owner->contents.err);
4554 }
4555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4556         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
4557         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4558         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
4559         int64_t ret_ref = tag_ptr(ret_copy, true);
4560         return ret_ref;
4561 }
4562
4563 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
4564         LDKRouteParameters ret = *owner->contents.result;
4565         ret.is_owned = false;
4566         return ret;
4567 }
4568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4569         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
4570         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
4571         int64_t ret_ref = 0;
4572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4574         return ret_ref;
4575 }
4576
4577 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
4578 CHECK(!owner->result_ok);
4579         return DecodeError_clone(&*owner->contents.err);
4580 }
4581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4582         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
4583         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4584         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
4585         int64_t ret_ref = tag_ptr(ret_copy, true);
4586         return ret_ref;
4587 }
4588
4589 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
4590         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
4591         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
4592         return ret;
4593 }
4594 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
4595         LDKPaymentParameters ret = *owner->contents.result;
4596         ret.is_owned = false;
4597         return ret;
4598 }
4599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4600         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
4601         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
4602         int64_t ret_ref = 0;
4603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4605         return ret_ref;
4606 }
4607
4608 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
4609 CHECK(!owner->result_ok);
4610         return DecodeError_clone(&*owner->contents.err);
4611 }
4612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4613         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
4614         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4615         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
4616         int64_t ret_ref = tag_ptr(ret_copy, true);
4617         return ret_ref;
4618 }
4619
4620 static inline struct LDKBlindedPayInfo C2Tuple_BlindedPayInfoBlindedPathZ_get_a(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
4621         LDKBlindedPayInfo ret = owner->a;
4622         ret.is_owned = false;
4623         return ret;
4624 }
4625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4626         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
4627         LDKBlindedPayInfo ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_a(owner_conv);
4628         int64_t ret_ref = 0;
4629         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4630         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4631         return ret_ref;
4632 }
4633
4634 static inline struct LDKBlindedPath C2Tuple_BlindedPayInfoBlindedPathZ_get_b(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
4635         LDKBlindedPath ret = owner->b;
4636         ret.is_owned = false;
4637         return ret;
4638 }
4639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4640         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
4641         LDKBlindedPath ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_b(owner_conv);
4642         int64_t ret_ref = 0;
4643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4645         return ret_ref;
4646 }
4647
4648 static inline LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(const LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ *orig) {
4649         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ) * orig->datalen, "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ clone bytes"), .datalen = orig->datalen };
4650         for (size_t i = 0; i < ret.datalen; i++) {
4651                 ret.data[i] = C2Tuple_BlindedPayInfoBlindedPathZ_clone(&orig->data[i]);
4652         }
4653         return ret;
4654 }
4655 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
4656         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
4657         for (size_t i = 0; i < ret.datalen; i++) {
4658                 ret.data[i] = RouteHint_clone(&orig->data[i]);
4659         }
4660         return ret;
4661 }
4662 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
4663         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
4664         for (size_t i = 0; i < ret.datalen; i++) {
4665                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
4666         }
4667         return ret;
4668 }
4669 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
4670         LDKRouteHint ret = *owner->contents.result;
4671         ret.is_owned = false;
4672         return ret;
4673 }
4674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4675         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
4676         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
4677         int64_t ret_ref = 0;
4678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4680         return ret_ref;
4681 }
4682
4683 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
4684 CHECK(!owner->result_ok);
4685         return DecodeError_clone(&*owner->contents.err);
4686 }
4687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4688         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
4689         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4690         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
4691         int64_t ret_ref = tag_ptr(ret_copy, true);
4692         return ret_ref;
4693 }
4694
4695 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
4696         LDKRouteHintHop ret = *owner->contents.result;
4697         ret.is_owned = false;
4698         return ret;
4699 }
4700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4701         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
4702         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
4703         int64_t ret_ref = 0;
4704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4706         return ret_ref;
4707 }
4708
4709 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
4710 CHECK(!owner->result_ok);
4711         return DecodeError_clone(&*owner->contents.err);
4712 }
4713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4714         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
4715         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4716         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
4717         int64_t ret_ref = tag_ptr(ret_copy, true);
4718         return ret_ref;
4719 }
4720
4721 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
4722         LDKFixedPenaltyScorer ret = *owner->contents.result;
4723         ret.is_owned = false;
4724         return ret;
4725 }
4726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4727         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
4728         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
4729         int64_t ret_ref = 0;
4730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4732         return ret_ref;
4733 }
4734
4735 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
4736 CHECK(!owner->result_ok);
4737         return DecodeError_clone(&*owner->contents.err);
4738 }
4739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4740         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
4741         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4742         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
4743         int64_t ret_ref = tag_ptr(ret_copy, true);
4744         return ret_ref;
4745 }
4746
4747 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
4748         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
4749         for (size_t i = 0; i < ret.datalen; i++) {
4750                 ret.data[i] = NodeId_clone(&orig->data[i]);
4751         }
4752         return ret;
4753 }
4754 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
4755         return owner->a;
4756 }
4757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4758         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
4759         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
4760         return ret_conv;
4761 }
4762
4763 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
4764         return owner->b;
4765 }
4766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4767         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
4768         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
4769         return ret_conv;
4770 }
4771
4772 static jclass LDKCOption_C2Tuple_u64u64ZZ_Some_class = NULL;
4773 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_Some_meth = NULL;
4774 static jclass LDKCOption_C2Tuple_u64u64ZZ_None_class = NULL;
4775 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_None_meth = NULL;
4776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1u64u64ZZ_init (JNIEnv *env, jclass clz) {
4777         LDKCOption_C2Tuple_u64u64ZZ_Some_class =
4778                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$Some"));
4779         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_class != NULL);
4780         LDKCOption_C2Tuple_u64u64ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, "<init>", "(J)V");
4781         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_meth != NULL);
4782         LDKCOption_C2Tuple_u64u64ZZ_None_class =
4783                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$None"));
4784         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_class != NULL);
4785         LDKCOption_C2Tuple_u64u64ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, "<init>", "()V");
4786         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_meth != NULL);
4787 }
4788 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u64ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4789         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
4790         switch(obj->tag) {
4791                 case LDKCOption_C2Tuple_u64u64ZZ_Some: {
4792                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
4793                         *some_conv = obj->some;
4794                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
4795                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, LDKCOption_C2Tuple_u64u64ZZ_Some_meth, tag_ptr(some_conv, true));
4796                 }
4797                 case LDKCOption_C2Tuple_u64u64ZZ_None: {
4798                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, LDKCOption_C2Tuple_u64u64ZZ_None_meth);
4799                 }
4800                 default: abort();
4801         }
4802 }
4803 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
4804         return owner->a;
4805 }
4806 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4807         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
4808         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
4809         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple_Z_get_a(owner_conv).data);
4810         return ret_arr;
4811 }
4812
4813 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
4814         return owner->b;
4815 }
4816 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4817         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
4818         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
4819         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple_Z_get_b(owner_conv).data);
4820         return ret_arr;
4821 }
4822
4823 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_a(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
4824         return owner->a;
4825 }
4826 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4827         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
4828         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
4829         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple__u1632_u1632Z_get_a(owner_conv).data);
4830         return ret_arr;
4831 }
4832
4833 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_b(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
4834         return owner->b;
4835 }
4836 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4837         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
4838         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
4839         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple__u1632_u1632Z_get_b(owner_conv).data);
4840         return ret_arr;
4841 }
4842
4843 static jclass LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class = NULL;
4844 static jmethodID LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth = NULL;
4845 static jclass LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class = NULL;
4846 static jmethodID LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth = NULL;
4847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_init (JNIEnv *env, jclass clz) {
4848         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class =
4849                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ$Some"));
4850         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class != NULL);
4851         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class, "<init>", "(J)V");
4852         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth != NULL);
4853         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class =
4854                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ$None"));
4855         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class != NULL);
4856         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class, "<init>", "()V");
4857         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth != NULL);
4858 }
4859 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4860         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
4861         switch(obj->tag) {
4862                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some: {
4863                         LDKC2Tuple__u1632_u1632Z* some_conv = &obj->some;
4864                         // WARNING: we really need to clone here, but no clone is available for LDKC2Tuple__u1632_u1632Z
4865                         return (*env)->NewObject(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth, tag_ptr(some_conv, false));
4866                 }
4867                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None: {
4868                         return (*env)->NewObject(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth);
4869                 }
4870                 default: abort();
4871         }
4872 }
4873 static jclass LDKCOption_f64Z_Some_class = NULL;
4874 static jmethodID LDKCOption_f64Z_Some_meth = NULL;
4875 static jclass LDKCOption_f64Z_None_class = NULL;
4876 static jmethodID LDKCOption_f64Z_None_meth = NULL;
4877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1f64Z_init (JNIEnv *env, jclass clz) {
4878         LDKCOption_f64Z_Some_class =
4879                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_f64Z$Some"));
4880         CHECK(LDKCOption_f64Z_Some_class != NULL);
4881         LDKCOption_f64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_f64Z_Some_class, "<init>", "(D)V");
4882         CHECK(LDKCOption_f64Z_Some_meth != NULL);
4883         LDKCOption_f64Z_None_class =
4884                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_f64Z$None"));
4885         CHECK(LDKCOption_f64Z_None_class != NULL);
4886         LDKCOption_f64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_f64Z_None_class, "<init>", "()V");
4887         CHECK(LDKCOption_f64Z_None_meth != NULL);
4888 }
4889 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1f64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4890         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
4891         switch(obj->tag) {
4892                 case LDKCOption_f64Z_Some: {
4893                         double some_conv = obj->some;
4894                         return (*env)->NewObject(env, LDKCOption_f64Z_Some_class, LDKCOption_f64Z_Some_meth, some_conv);
4895                 }
4896                 case LDKCOption_f64Z_None: {
4897                         return (*env)->NewObject(env, LDKCOption_f64Z_None_class, LDKCOption_f64Z_None_meth);
4898                 }
4899                 default: abort();
4900         }
4901 }
4902 typedef struct LDKLogger_JCalls {
4903         atomic_size_t refcnt;
4904         JavaVM *vm;
4905         jweak o;
4906         jmethodID log_meth;
4907 } LDKLogger_JCalls;
4908 static void LDKLogger_JCalls_free(void* this_arg) {
4909         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4910         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4911                 JNIEnv *env;
4912                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4913                 if (get_jenv_res == JNI_EDETACHED) {
4914                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4915                 } else {
4916                         DO_ASSERT(get_jenv_res == JNI_OK);
4917                 }
4918                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4919                 if (get_jenv_res == JNI_EDETACHED) {
4920                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4921                 }
4922                 FREE(j_calls);
4923         }
4924 }
4925 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
4926         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4927         JNIEnv *env;
4928         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4929         if (get_jenv_res == JNI_EDETACHED) {
4930                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4931         } else {
4932                 DO_ASSERT(get_jenv_res == JNI_OK);
4933         }
4934         LDKRecord record_var = *record;
4935         int64_t record_ref = 0;
4936         record_var = Record_clone(&record_var);
4937         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
4938         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
4939         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4940         CHECK(obj != NULL);
4941         (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_ref);
4942         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4943                 (*env)->ExceptionDescribe(env);
4944                 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
4945         }
4946         if (get_jenv_res == JNI_EDETACHED) {
4947                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4948         }
4949 }
4950 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
4951         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
4952         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4953 }
4954 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
4955         jclass c = (*env)->GetObjectClass(env, o);
4956         CHECK(c != NULL);
4957         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
4958         atomic_init(&calls->refcnt, 1);
4959         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4960         calls->o = (*env)->NewWeakGlobalRef(env, o);
4961         calls->log_meth = (*env)->GetMethodID(env, c, "log", "(J)V");
4962         CHECK(calls->log_meth != NULL);
4963
4964         LDKLogger ret = {
4965                 .this_arg = (void*) calls,
4966                 .log = log_LDKLogger_jcall,
4967                 .free = LDKLogger_JCalls_free,
4968         };
4969         return ret;
4970 }
4971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
4972         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
4973         *res_ptr = LDKLogger_init(env, clz, o);
4974         return tag_ptr(res_ptr, true);
4975 }
4976 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
4977         LDKProbabilisticScorer ret = *owner->contents.result;
4978         ret.is_owned = false;
4979         return ret;
4980 }
4981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4982         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
4983         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
4984         int64_t ret_ref = 0;
4985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4987         return ret_ref;
4988 }
4989
4990 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
4991 CHECK(!owner->result_ok);
4992         return DecodeError_clone(&*owner->contents.err);
4993 }
4994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4995         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
4996         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4997         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
4998         int64_t ret_ref = tag_ptr(ret_copy, true);
4999         return ret_ref;
5000 }
5001
5002 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
5003         return owner->a;
5004 }
5005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5006         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
5007         int64_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
5008         return ret_conv;
5009 }
5010
5011 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
5012         return owner->b;
5013 }
5014 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5015         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
5016         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
5017         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5018         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5019         return ret_arr;
5020 }
5021
5022 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
5023         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
5024         for (size_t i = 0; i < ret.datalen; i++) {
5025                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
5026         }
5027         return ret;
5028 }
5029 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
5030         return ThirtyTwoBytes_clone(&owner->a);
5031 }
5032 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCOption_1ThirtyTwoBytesZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5033         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(owner);
5034         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5035         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_a(owner_conv).data);
5036         return ret_arr;
5037 }
5038
5039 static inline struct LDKCOption_ThirtyTwoBytesZ C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
5040         return COption_ThirtyTwoBytesZ_clone(&owner->b);
5041 }
5042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCOption_1ThirtyTwoBytesZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5043         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(owner);
5044         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
5045         *ret_copy = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_b(owner_conv);
5046         int64_t ret_ref = tag_ptr(ret_copy, true);
5047         return ret_ref;
5048 }
5049
5050 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ *orig) {
5051         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ clone bytes"), .datalen = orig->datalen };
5052         for (size_t i = 0; i < ret.datalen; i++) {
5053                 ret.data[i] = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(&orig->data[i]);
5054         }
5055         return ret;
5056 }
5057 static inline enum LDKChannelMonitorUpdateStatus CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
5058 CHECK(owner->result_ok);
5059         return ChannelMonitorUpdateStatus_clone(&*owner->contents.result);
5060 }
5061 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5062         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
5063         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(owner_conv));
5064         return ret_conv;
5065 }
5066
5067 static inline void CResult_ChannelMonitorUpdateStatusNoneZ_get_err(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
5068 CHECK(!owner->result_ok);
5069         return *owner->contents.err;
5070 }
5071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5072         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
5073         CResult_ChannelMonitorUpdateStatusNoneZ_get_err(owner_conv);
5074 }
5075
5076 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
5077 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
5078 static jclass LDKMonitorEvent_HolderForceClosed_class = NULL;
5079 static jmethodID LDKMonitorEvent_HolderForceClosed_meth = NULL;
5080 static jclass LDKMonitorEvent_Completed_class = NULL;
5081 static jmethodID LDKMonitorEvent_Completed_meth = NULL;
5082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
5083         LDKMonitorEvent_HTLCEvent_class =
5084                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent"));
5085         CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
5086         LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
5087         CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
5088         LDKMonitorEvent_HolderForceClosed_class =
5089                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HolderForceClosed"));
5090         CHECK(LDKMonitorEvent_HolderForceClosed_class != NULL);
5091         LDKMonitorEvent_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HolderForceClosed_class, "<init>", "(J)V");
5092         CHECK(LDKMonitorEvent_HolderForceClosed_meth != NULL);
5093         LDKMonitorEvent_Completed_class =
5094                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$Completed"));
5095         CHECK(LDKMonitorEvent_Completed_class != NULL);
5096         LDKMonitorEvent_Completed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_Completed_class, "<init>", "(JJ)V");
5097         CHECK(LDKMonitorEvent_Completed_meth != NULL);
5098 }
5099 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5100         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
5101         switch(obj->tag) {
5102                 case LDKMonitorEvent_HTLCEvent: {
5103                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
5104                         int64_t htlc_event_ref = 0;
5105                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
5106                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
5107                         return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
5108                 }
5109                 case LDKMonitorEvent_HolderForceClosed: {
5110                         LDKOutPoint holder_force_closed_var = obj->holder_force_closed;
5111                         int64_t holder_force_closed_ref = 0;
5112                         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_force_closed_var);
5113                         holder_force_closed_ref = tag_ptr(holder_force_closed_var.inner, false);
5114                         return (*env)->NewObject(env, LDKMonitorEvent_HolderForceClosed_class, LDKMonitorEvent_HolderForceClosed_meth, holder_force_closed_ref);
5115                 }
5116                 case LDKMonitorEvent_Completed: {
5117                         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
5118                         int64_t funding_txo_ref = 0;
5119                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5120                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
5121                         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
5122                         return (*env)->NewObject(env, LDKMonitorEvent_Completed_class, LDKMonitorEvent_Completed_meth, funding_txo_ref, monitor_update_id_conv);
5123                 }
5124                 default: abort();
5125         }
5126 }
5127 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
5128         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
5129         for (size_t i = 0; i < ret.datalen; i++) {
5130                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
5131         }
5132         return ret;
5133 }
5134 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
5135         LDKOutPoint ret = owner->a;
5136         ret.is_owned = false;
5137         return ret;
5138 }
5139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5140         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
5141         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
5142         int64_t ret_ref = 0;
5143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5145         return ret_ref;
5146 }
5147
5148 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
5149         return CVec_MonitorEventZ_clone(&owner->b);
5150 }
5151 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5152         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
5153         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
5154         int64_tArray ret_arr = NULL;
5155         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5156         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5157         for (size_t o = 0; o < ret_var.datalen; o++) {
5158                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
5159                 *ret_conv_14_copy = ret_var.data[o];
5160                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
5161                 ret_arr_ptr[o] = ret_conv_14_ref;
5162         }
5163         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5164         FREE(ret_var.data);
5165         return ret_arr;
5166 }
5167
5168 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
5169         return owner->c;
5170 }
5171 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
5172         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
5173         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
5174         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form);
5175         return ret_arr;
5176 }
5177
5178 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
5179         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
5180         for (size_t i = 0; i < ret.datalen; i++) {
5181                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
5182         }
5183         return ret;
5184 }
5185 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
5186         LDKInitFeatures ret = *owner->contents.result;
5187         ret.is_owned = false;
5188         return ret;
5189 }
5190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5191         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
5192         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
5193         int64_t ret_ref = 0;
5194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5196         return ret_ref;
5197 }
5198
5199 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
5200 CHECK(!owner->result_ok);
5201         return DecodeError_clone(&*owner->contents.err);
5202 }
5203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5204         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
5205         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5206         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
5207         int64_t ret_ref = tag_ptr(ret_copy, true);
5208         return ret_ref;
5209 }
5210
5211 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
5212         LDKChannelFeatures ret = *owner->contents.result;
5213         ret.is_owned = false;
5214         return ret;
5215 }
5216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5217         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
5218         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
5219         int64_t ret_ref = 0;
5220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5222         return ret_ref;
5223 }
5224
5225 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
5226 CHECK(!owner->result_ok);
5227         return DecodeError_clone(&*owner->contents.err);
5228 }
5229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5230         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
5231         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5232         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
5233         int64_t ret_ref = tag_ptr(ret_copy, true);
5234         return ret_ref;
5235 }
5236
5237 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
5238         LDKNodeFeatures ret = *owner->contents.result;
5239         ret.is_owned = false;
5240         return ret;
5241 }
5242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5243         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
5244         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
5245         int64_t ret_ref = 0;
5246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5248         return ret_ref;
5249 }
5250
5251 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
5252 CHECK(!owner->result_ok);
5253         return DecodeError_clone(&*owner->contents.err);
5254 }
5255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5256         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
5257         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5258         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
5259         int64_t ret_ref = tag_ptr(ret_copy, true);
5260         return ret_ref;
5261 }
5262
5263 static inline struct LDKBolt11InvoiceFeatures CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
5264         LDKBolt11InvoiceFeatures ret = *owner->contents.result;
5265         ret.is_owned = false;
5266         return ret;
5267 }
5268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5269         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
5270         LDKBolt11InvoiceFeatures ret_var = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
5271         int64_t ret_ref = 0;
5272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5274         return ret_ref;
5275 }
5276
5277 static inline struct LDKDecodeError CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
5278 CHECK(!owner->result_ok);
5279         return DecodeError_clone(&*owner->contents.err);
5280 }
5281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5282         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
5283         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5284         *ret_copy = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
5285         int64_t ret_ref = tag_ptr(ret_copy, true);
5286         return ret_ref;
5287 }
5288
5289 static inline struct LDKBolt12InvoiceFeatures CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
5290         LDKBolt12InvoiceFeatures ret = *owner->contents.result;
5291         ret.is_owned = false;
5292         return ret;
5293 }
5294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5295         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
5296         LDKBolt12InvoiceFeatures ret_var = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
5297         int64_t ret_ref = 0;
5298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5300         return ret_ref;
5301 }
5302
5303 static inline struct LDKDecodeError CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
5304 CHECK(!owner->result_ok);
5305         return DecodeError_clone(&*owner->contents.err);
5306 }
5307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5308         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
5309         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5310         *ret_copy = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
5311         int64_t ret_ref = tag_ptr(ret_copy, true);
5312         return ret_ref;
5313 }
5314
5315 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
5316         LDKBlindedHopFeatures ret = *owner->contents.result;
5317         ret.is_owned = false;
5318         return ret;
5319 }
5320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5321         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
5322         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
5323         int64_t ret_ref = 0;
5324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5326         return ret_ref;
5327 }
5328
5329 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
5330 CHECK(!owner->result_ok);
5331         return DecodeError_clone(&*owner->contents.err);
5332 }
5333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5334         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
5335         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5336         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
5337         int64_t ret_ref = tag_ptr(ret_copy, true);
5338         return ret_ref;
5339 }
5340
5341 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
5342         LDKChannelTypeFeatures ret = *owner->contents.result;
5343         ret.is_owned = false;
5344         return ret;
5345 }
5346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5347         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
5348         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
5349         int64_t ret_ref = 0;
5350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5352         return ret_ref;
5353 }
5354
5355 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
5356 CHECK(!owner->result_ok);
5357         return DecodeError_clone(&*owner->contents.err);
5358 }
5359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5360         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
5361         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5362         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
5363         int64_t ret_ref = tag_ptr(ret_copy, true);
5364         return ret_ref;
5365 }
5366
5367 static inline struct LDKOffer CResult_OfferBolt12ParseErrorZ_get_ok(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
5368         LDKOffer ret = *owner->contents.result;
5369         ret.is_owned = false;
5370         return ret;
5371 }
5372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5373         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
5374         LDKOffer ret_var = CResult_OfferBolt12ParseErrorZ_get_ok(owner_conv);
5375         int64_t ret_ref = 0;
5376         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5377         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5378         return ret_ref;
5379 }
5380
5381 static inline struct LDKBolt12ParseError CResult_OfferBolt12ParseErrorZ_get_err(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
5382         LDKBolt12ParseError ret = *owner->contents.err;
5383         ret.is_owned = false;
5384         return ret;
5385 }
5386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5387         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
5388         LDKBolt12ParseError ret_var = CResult_OfferBolt12ParseErrorZ_get_err(owner_conv);
5389         int64_t ret_ref = 0;
5390         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5391         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5392         return ret_ref;
5393 }
5394
5395 static inline struct LDKPublicKey CResult_PublicKeySecp256k1ErrorZ_get_ok(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
5396 CHECK(owner->result_ok);
5397         return *owner->contents.result;
5398 }
5399 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5400         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
5401         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
5402         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeySecp256k1ErrorZ_get_ok(owner_conv).compressed_form);
5403         return ret_arr;
5404 }
5405
5406 static inline enum LDKSecp256k1Error CResult_PublicKeySecp256k1ErrorZ_get_err(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
5407 CHECK(!owner->result_ok);
5408         return *owner->contents.err;
5409 }
5410 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5411         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
5412         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PublicKeySecp256k1ErrorZ_get_err(owner_conv));
5413         return ret_conv;
5414 }
5415
5416 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
5417         LDKNodeId ret = *owner->contents.result;
5418         ret.is_owned = false;
5419         return ret;
5420 }
5421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5422         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
5423         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
5424         int64_t ret_ref = 0;
5425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5427         return ret_ref;
5428 }
5429
5430 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
5431 CHECK(!owner->result_ok);
5432         return DecodeError_clone(&*owner->contents.err);
5433 }
5434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5435         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
5436         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5437         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
5438         int64_t ret_ref = tag_ptr(ret_copy, true);
5439         return ret_ref;
5440 }
5441
5442 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
5443 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
5444 static jclass LDKNetworkUpdate_ChannelFailure_class = NULL;
5445 static jmethodID LDKNetworkUpdate_ChannelFailure_meth = NULL;
5446 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
5447 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
5448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
5449         LDKNetworkUpdate_ChannelUpdateMessage_class =
5450                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage"));
5451         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
5452         LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
5453         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
5454         LDKNetworkUpdate_ChannelFailure_class =
5455                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelFailure"));
5456         CHECK(LDKNetworkUpdate_ChannelFailure_class != NULL);
5457         LDKNetworkUpdate_ChannelFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelFailure_class, "<init>", "(JZ)V");
5458         CHECK(LDKNetworkUpdate_ChannelFailure_meth != NULL);
5459         LDKNetworkUpdate_NodeFailure_class =
5460                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure"));
5461         CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
5462         LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
5463         CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
5464 }
5465 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5466         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
5467         switch(obj->tag) {
5468                 case LDKNetworkUpdate_ChannelUpdateMessage: {
5469                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
5470                         int64_t msg_ref = 0;
5471                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5472                         msg_ref = tag_ptr(msg_var.inner, false);
5473                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
5474                 }
5475                 case LDKNetworkUpdate_ChannelFailure: {
5476                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
5477                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
5478                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelFailure_class, LDKNetworkUpdate_ChannelFailure_meth, short_channel_id_conv, is_permanent_conv);
5479                 }
5480                 case LDKNetworkUpdate_NodeFailure: {
5481                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5482                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
5483                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
5484                         return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, is_permanent_conv);
5485                 }
5486                 default: abort();
5487         }
5488 }
5489 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
5490 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
5491 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
5492 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
5493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
5494         LDKCOption_NetworkUpdateZ_Some_class =
5495                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some"));
5496         CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
5497         LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
5498         CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
5499         LDKCOption_NetworkUpdateZ_None_class =
5500                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None"));
5501         CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
5502         LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
5503         CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
5504 }
5505 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5506         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
5507         switch(obj->tag) {
5508                 case LDKCOption_NetworkUpdateZ_Some: {
5509                         int64_t some_ref = tag_ptr(&obj->some, false);
5510                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
5511                 }
5512                 case LDKCOption_NetworkUpdateZ_None: {
5513                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
5514                 }
5515                 default: abort();
5516         }
5517 }
5518 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
5519 CHECK(owner->result_ok);
5520         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
5521 }
5522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5523         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
5524         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
5525         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
5526         int64_t ret_ref = tag_ptr(ret_copy, true);
5527         return ret_ref;
5528 }
5529
5530 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
5531 CHECK(!owner->result_ok);
5532         return DecodeError_clone(&*owner->contents.err);
5533 }
5534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5535         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
5536         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5537         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
5538         int64_t ret_ref = tag_ptr(ret_copy, true);
5539         return ret_ref;
5540 }
5541
5542 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
5543 CHECK(owner->result_ok);
5544         return TxOut_clone(&*owner->contents.result);
5545 }
5546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5547         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
5548         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
5549         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
5550         return tag_ptr(ret_ref, true);
5551 }
5552
5553 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
5554 CHECK(!owner->result_ok);
5555         return UtxoLookupError_clone(&*owner->contents.err);
5556 }
5557 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5558         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
5559         jclass ret_conv = LDKUtxoLookupError_to_java(env, CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
5560         return ret_conv;
5561 }
5562
5563 static jclass LDKUtxoResult_Sync_class = NULL;
5564 static jmethodID LDKUtxoResult_Sync_meth = NULL;
5565 static jclass LDKUtxoResult_Async_class = NULL;
5566 static jmethodID LDKUtxoResult_Async_meth = NULL;
5567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKUtxoResult_init (JNIEnv *env, jclass clz) {
5568         LDKUtxoResult_Sync_class =
5569                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUtxoResult$Sync"));
5570         CHECK(LDKUtxoResult_Sync_class != NULL);
5571         LDKUtxoResult_Sync_meth = (*env)->GetMethodID(env, LDKUtxoResult_Sync_class, "<init>", "(J)V");
5572         CHECK(LDKUtxoResult_Sync_meth != NULL);
5573         LDKUtxoResult_Async_class =
5574                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUtxoResult$Async"));
5575         CHECK(LDKUtxoResult_Async_class != NULL);
5576         LDKUtxoResult_Async_meth = (*env)->GetMethodID(env, LDKUtxoResult_Async_class, "<init>", "(J)V");
5577         CHECK(LDKUtxoResult_Async_meth != NULL);
5578 }
5579 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKUtxoResult_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5580         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
5581         switch(obj->tag) {
5582                 case LDKUtxoResult_Sync: {
5583                         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
5584                         *sync_conv = obj->sync;
5585                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
5586                         return (*env)->NewObject(env, LDKUtxoResult_Sync_class, LDKUtxoResult_Sync_meth, tag_ptr(sync_conv, true));
5587                 }
5588                 case LDKUtxoResult_Async: {
5589                         LDKUtxoFuture async_var = obj->async;
5590                         int64_t async_ref = 0;
5591                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
5592                         async_ref = tag_ptr(async_var.inner, false);
5593                         return (*env)->NewObject(env, LDKUtxoResult_Async_class, LDKUtxoResult_Async_meth, async_ref);
5594                 }
5595                 default: abort();
5596         }
5597 }
5598 typedef struct LDKUtxoLookup_JCalls {
5599         atomic_size_t refcnt;
5600         JavaVM *vm;
5601         jweak o;
5602         jmethodID get_utxo_meth;
5603 } LDKUtxoLookup_JCalls;
5604 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
5605         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
5606         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5607                 JNIEnv *env;
5608                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5609                 if (get_jenv_res == JNI_EDETACHED) {
5610                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5611                 } else {
5612                         DO_ASSERT(get_jenv_res == JNI_OK);
5613                 }
5614                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5615                 if (get_jenv_res == JNI_EDETACHED) {
5616                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5617                 }
5618                 FREE(j_calls);
5619         }
5620 }
5621 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* chain_hash)[32], uint64_t short_channel_id) {
5622         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
5623         JNIEnv *env;
5624         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5625         if (get_jenv_res == JNI_EDETACHED) {
5626                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5627         } else {
5628                 DO_ASSERT(get_jenv_res == JNI_OK);
5629         }
5630         int8_tArray chain_hash_arr = (*env)->NewByteArray(env, 32);
5631         (*env)->SetByteArrayRegion(env, chain_hash_arr, 0, 32, *chain_hash);
5632         int64_t short_channel_id_conv = short_channel_id;
5633         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5634         CHECK(obj != NULL);
5635         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, chain_hash_arr, short_channel_id_conv);
5636         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5637                 (*env)->ExceptionDescribe(env);
5638                 (*env)->FatalError(env, "A call to get_utxo in LDKUtxoLookup from rust threw an exception.");
5639         }
5640         void* ret_ptr = untag_ptr(ret);
5641         CHECK_ACCESS(ret_ptr);
5642         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
5643         FREE(untag_ptr(ret));
5644         if (get_jenv_res == JNI_EDETACHED) {
5645                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5646         }
5647         return ret_conv;
5648 }
5649 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
5650         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
5651         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5652 }
5653 static inline LDKUtxoLookup LDKUtxoLookup_init (JNIEnv *env, jclass clz, jobject o) {
5654         jclass c = (*env)->GetObjectClass(env, o);
5655         CHECK(c != NULL);
5656         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
5657         atomic_init(&calls->refcnt, 1);
5658         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5659         calls->o = (*env)->NewWeakGlobalRef(env, o);
5660         calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
5661         CHECK(calls->get_utxo_meth != NULL);
5662
5663         LDKUtxoLookup ret = {
5664                 .this_arg = (void*) calls,
5665                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
5666                 .free = LDKUtxoLookup_JCalls_free,
5667         };
5668         return ret;
5669 }
5670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKUtxoLookup_1new(JNIEnv *env, jclass clz, jobject o) {
5671         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
5672         *res_ptr = LDKUtxoLookup_init(env, clz, o);
5673         return tag_ptr(res_ptr, true);
5674 }
5675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoLookup_1get_1utxo(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray chain_hash, int64_t short_channel_id) {
5676         void* this_arg_ptr = untag_ptr(this_arg);
5677         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5678         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
5679         uint8_t chain_hash_arr[32];
5680         CHECK((*env)->GetArrayLength(env, chain_hash) == 32);
5681         (*env)->GetByteArrayRegion(env, chain_hash, 0, 32, chain_hash_arr);
5682         uint8_t (*chain_hash_ref)[32] = &chain_hash_arr;
5683         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
5684         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, chain_hash_ref, short_channel_id);
5685         int64_t ret_ref = tag_ptr(ret_copy, true);
5686         return ret_ref;
5687 }
5688
5689 static jclass LDKCOption_UtxoLookupZ_Some_class = NULL;
5690 static jmethodID LDKCOption_UtxoLookupZ_Some_meth = NULL;
5691 static jclass LDKCOption_UtxoLookupZ_None_class = NULL;
5692 static jmethodID LDKCOption_UtxoLookupZ_None_meth = NULL;
5693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1UtxoLookupZ_init (JNIEnv *env, jclass clz) {
5694         LDKCOption_UtxoLookupZ_Some_class =
5695                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_UtxoLookupZ$Some"));
5696         CHECK(LDKCOption_UtxoLookupZ_Some_class != NULL);
5697         LDKCOption_UtxoLookupZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_UtxoLookupZ_Some_class, "<init>", "(J)V");
5698         CHECK(LDKCOption_UtxoLookupZ_Some_meth != NULL);
5699         LDKCOption_UtxoLookupZ_None_class =
5700                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_UtxoLookupZ$None"));
5701         CHECK(LDKCOption_UtxoLookupZ_None_class != NULL);
5702         LDKCOption_UtxoLookupZ_None_meth = (*env)->GetMethodID(env, LDKCOption_UtxoLookupZ_None_class, "<init>", "()V");
5703         CHECK(LDKCOption_UtxoLookupZ_None_meth != NULL);
5704 }
5705 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1UtxoLookupZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5706         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
5707         switch(obj->tag) {
5708                 case LDKCOption_UtxoLookupZ_Some: {
5709                         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
5710                         *some_ret = obj->some;
5711                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
5712                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
5713                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5714                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
5715                         }
5716                         return (*env)->NewObject(env, LDKCOption_UtxoLookupZ_Some_class, LDKCOption_UtxoLookupZ_Some_meth, tag_ptr(some_ret, true));
5717                 }
5718                 case LDKCOption_UtxoLookupZ_None: {
5719                         return (*env)->NewObject(env, LDKCOption_UtxoLookupZ_None_class, LDKCOption_UtxoLookupZ_None_meth);
5720                 }
5721                 default: abort();
5722         }
5723 }
5724 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
5725 CHECK(owner->result_ok);
5726         return *owner->contents.result;
5727 }
5728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5729         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
5730         CResult_NoneLightningErrorZ_get_ok(owner_conv);
5731 }
5732
5733 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
5734         LDKLightningError ret = *owner->contents.err;
5735         ret.is_owned = false;
5736         return ret;
5737 }
5738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5739         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
5740         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
5741         int64_t ret_ref = 0;
5742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5744         return ret_ref;
5745 }
5746
5747 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
5748 CHECK(owner->result_ok);
5749         return *owner->contents.result;
5750 }
5751 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5752         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
5753         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
5754         return ret_conv;
5755 }
5756
5757 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
5758         LDKLightningError ret = *owner->contents.err;
5759         ret.is_owned = false;
5760         return ret;
5761 }
5762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5763         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
5764         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
5765         int64_t ret_ref = 0;
5766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5768         return ret_ref;
5769 }
5770
5771 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5772         LDKChannelAnnouncement ret = owner->a;
5773         ret.is_owned = false;
5774         return ret;
5775 }
5776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5777         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5778         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
5779         int64_t ret_ref = 0;
5780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5782         return ret_ref;
5783 }
5784
5785 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5786         LDKChannelUpdate ret = owner->b;
5787         ret.is_owned = false;
5788         return ret;
5789 }
5790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5791         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5792         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
5793         int64_t ret_ref = 0;
5794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5796         return ret_ref;
5797 }
5798
5799 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5800         LDKChannelUpdate ret = owner->c;
5801         ret.is_owned = false;
5802         return ret;
5803 }
5804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
5805         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5806         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
5807         int64_t ret_ref = 0;
5808         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5809         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5810         return ret_ref;
5811 }
5812
5813 static jclass LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class = NULL;
5814 static jmethodID LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth = NULL;
5815 static jclass LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class = NULL;
5816 static jmethodID LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth = NULL;
5817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_init (JNIEnv *env, jclass clz) {
5818         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class =
5819                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ$Some"));
5820         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class != NULL);
5821         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class, "<init>", "(J)V");
5822         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth != NULL);
5823         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class =
5824                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ$None"));
5825         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class != NULL);
5826         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class, "<init>", "()V");
5827         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth != NULL);
5828 }
5829 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5830         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
5831         switch(obj->tag) {
5832                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: {
5833                         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5834                         *some_conv = obj->some;
5835                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
5836                         return (*env)->NewObject(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth, tag_ptr(some_conv, true));
5837                 }
5838                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: {
5839                         return (*env)->NewObject(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth);
5840                 }
5841                 default: abort();
5842         }
5843 }
5844 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
5845 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
5846 static jclass LDKErrorAction_DisconnectPeerWithWarning_class = NULL;
5847 static jmethodID LDKErrorAction_DisconnectPeerWithWarning_meth = NULL;
5848 static jclass LDKErrorAction_IgnoreError_class = NULL;
5849 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
5850 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
5851 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
5852 static jclass LDKErrorAction_IgnoreDuplicateGossip_class = NULL;
5853 static jmethodID LDKErrorAction_IgnoreDuplicateGossip_meth = NULL;
5854 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
5855 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
5856 static jclass LDKErrorAction_SendWarningMessage_class = NULL;
5857 static jmethodID LDKErrorAction_SendWarningMessage_meth = NULL;
5858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
5859         LDKErrorAction_DisconnectPeer_class =
5860                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeer"));
5861         CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
5862         LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
5863         CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
5864         LDKErrorAction_DisconnectPeerWithWarning_class =
5865                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeerWithWarning"));
5866         CHECK(LDKErrorAction_DisconnectPeerWithWarning_class != NULL);
5867         LDKErrorAction_DisconnectPeerWithWarning_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeerWithWarning_class, "<init>", "(J)V");
5868         CHECK(LDKErrorAction_DisconnectPeerWithWarning_meth != NULL);
5869         LDKErrorAction_IgnoreError_class =
5870                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreError"));
5871         CHECK(LDKErrorAction_IgnoreError_class != NULL);
5872         LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
5873         CHECK(LDKErrorAction_IgnoreError_meth != NULL);
5874         LDKErrorAction_IgnoreAndLog_class =
5875                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog"));
5876         CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
5877         LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
5878         CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
5879         LDKErrorAction_IgnoreDuplicateGossip_class =
5880                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreDuplicateGossip"));
5881         CHECK(LDKErrorAction_IgnoreDuplicateGossip_class != NULL);
5882         LDKErrorAction_IgnoreDuplicateGossip_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreDuplicateGossip_class, "<init>", "()V");
5883         CHECK(LDKErrorAction_IgnoreDuplicateGossip_meth != NULL);
5884         LDKErrorAction_SendErrorMessage_class =
5885                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendErrorMessage"));
5886         CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
5887         LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
5888         CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
5889         LDKErrorAction_SendWarningMessage_class =
5890                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendWarningMessage"));
5891         CHECK(LDKErrorAction_SendWarningMessage_class != NULL);
5892         LDKErrorAction_SendWarningMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendWarningMessage_class, "<init>", "(JLorg/ldk/enums/Level;)V");
5893         CHECK(LDKErrorAction_SendWarningMessage_meth != NULL);
5894 }
5895 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5896         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
5897         switch(obj->tag) {
5898                 case LDKErrorAction_DisconnectPeer: {
5899                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
5900                         int64_t msg_ref = 0;
5901                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5902                         msg_ref = tag_ptr(msg_var.inner, false);
5903                         return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
5904                 }
5905                 case LDKErrorAction_DisconnectPeerWithWarning: {
5906                         LDKWarningMessage msg_var = obj->disconnect_peer_with_warning.msg;
5907                         int64_t msg_ref = 0;
5908                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5909                         msg_ref = tag_ptr(msg_var.inner, false);
5910                         return (*env)->NewObject(env, LDKErrorAction_DisconnectPeerWithWarning_class, LDKErrorAction_DisconnectPeerWithWarning_meth, msg_ref);
5911                 }
5912                 case LDKErrorAction_IgnoreError: {
5913                         return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
5914                 }
5915                 case LDKErrorAction_IgnoreAndLog: {
5916                         jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
5917                         return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
5918                 }
5919                 case LDKErrorAction_IgnoreDuplicateGossip: {
5920                         return (*env)->NewObject(env, LDKErrorAction_IgnoreDuplicateGossip_class, LDKErrorAction_IgnoreDuplicateGossip_meth);
5921                 }
5922                 case LDKErrorAction_SendErrorMessage: {
5923                         LDKErrorMessage msg_var = obj->send_error_message.msg;
5924                         int64_t msg_ref = 0;
5925                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5926                         msg_ref = tag_ptr(msg_var.inner, false);
5927                         return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
5928                 }
5929                 case LDKErrorAction_SendWarningMessage: {
5930                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
5931                         int64_t msg_ref = 0;
5932                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5933                         msg_ref = tag_ptr(msg_var.inner, false);
5934                         jclass log_level_conv = LDKLevel_to_java(env, obj->send_warning_message.log_level);
5935                         return (*env)->NewObject(env, LDKErrorAction_SendWarningMessage_class, LDKErrorAction_SendWarningMessage_meth, msg_ref, log_level_conv);
5936                 }
5937                 default: abort();
5938         }
5939 }
5940 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
5941 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
5942 static jclass LDKMessageSendEvent_SendAcceptChannelV2_class = NULL;
5943 static jmethodID LDKMessageSendEvent_SendAcceptChannelV2_meth = NULL;
5944 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
5945 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
5946 static jclass LDKMessageSendEvent_SendOpenChannelV2_class = NULL;
5947 static jmethodID LDKMessageSendEvent_SendOpenChannelV2_meth = NULL;
5948 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
5949 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
5950 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
5951 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
5952 static jclass LDKMessageSendEvent_SendTxAddInput_class = NULL;
5953 static jmethodID LDKMessageSendEvent_SendTxAddInput_meth = NULL;
5954 static jclass LDKMessageSendEvent_SendTxAddOutput_class = NULL;
5955 static jmethodID LDKMessageSendEvent_SendTxAddOutput_meth = NULL;
5956 static jclass LDKMessageSendEvent_SendTxRemoveInput_class = NULL;
5957 static jmethodID LDKMessageSendEvent_SendTxRemoveInput_meth = NULL;
5958 static jclass LDKMessageSendEvent_SendTxRemoveOutput_class = NULL;
5959 static jmethodID LDKMessageSendEvent_SendTxRemoveOutput_meth = NULL;
5960 static jclass LDKMessageSendEvent_SendTxComplete_class = NULL;
5961 static jmethodID LDKMessageSendEvent_SendTxComplete_meth = NULL;
5962 static jclass LDKMessageSendEvent_SendTxSignatures_class = NULL;
5963 static jmethodID LDKMessageSendEvent_SendTxSignatures_meth = NULL;
5964 static jclass LDKMessageSendEvent_SendTxInitRbf_class = NULL;
5965 static jmethodID LDKMessageSendEvent_SendTxInitRbf_meth = NULL;
5966 static jclass LDKMessageSendEvent_SendTxAckRbf_class = NULL;
5967 static jmethodID LDKMessageSendEvent_SendTxAckRbf_meth = NULL;
5968 static jclass LDKMessageSendEvent_SendTxAbort_class = NULL;
5969 static jmethodID LDKMessageSendEvent_SendTxAbort_meth = NULL;
5970 static jclass LDKMessageSendEvent_SendChannelReady_class = NULL;
5971 static jmethodID LDKMessageSendEvent_SendChannelReady_meth = NULL;
5972 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
5973 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
5974 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
5975 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
5976 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
5977 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
5978 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
5979 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
5980 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
5981 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
5982 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
5983 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
5984 static jclass LDKMessageSendEvent_SendChannelAnnouncement_class = NULL;
5985 static jmethodID LDKMessageSendEvent_SendChannelAnnouncement_meth = NULL;
5986 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
5987 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
5988 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
5989 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
5990 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
5991 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
5992 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
5993 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
5994 static jclass LDKMessageSendEvent_HandleError_class = NULL;
5995 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
5996 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
5997 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
5998 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
5999 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
6000 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
6001 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
6002 static jclass LDKMessageSendEvent_SendGossipTimestampFilter_class = NULL;
6003 static jmethodID LDKMessageSendEvent_SendGossipTimestampFilter_meth = NULL;
6004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
6005         LDKMessageSendEvent_SendAcceptChannel_class =
6006                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel"));
6007         CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
6008         LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
6009         CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
6010         LDKMessageSendEvent_SendAcceptChannelV2_class =
6011                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannelV2"));
6012         CHECK(LDKMessageSendEvent_SendAcceptChannelV2_class != NULL);
6013         LDKMessageSendEvent_SendAcceptChannelV2_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannelV2_class, "<init>", "([BJ)V");
6014         CHECK(LDKMessageSendEvent_SendAcceptChannelV2_meth != NULL);
6015         LDKMessageSendEvent_SendOpenChannel_class =
6016                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel"));
6017         CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
6018         LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
6019         CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
6020         LDKMessageSendEvent_SendOpenChannelV2_class =
6021                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannelV2"));
6022         CHECK(LDKMessageSendEvent_SendOpenChannelV2_class != NULL);
6023         LDKMessageSendEvent_SendOpenChannelV2_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannelV2_class, "<init>", "([BJ)V");
6024         CHECK(LDKMessageSendEvent_SendOpenChannelV2_meth != NULL);
6025         LDKMessageSendEvent_SendFundingCreated_class =
6026                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated"));
6027         CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
6028         LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
6029         CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
6030         LDKMessageSendEvent_SendFundingSigned_class =
6031                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned"));
6032         CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
6033         LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
6034         CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
6035         LDKMessageSendEvent_SendTxAddInput_class =
6036                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAddInput"));
6037         CHECK(LDKMessageSendEvent_SendTxAddInput_class != NULL);
6038         LDKMessageSendEvent_SendTxAddInput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAddInput_class, "<init>", "([BJ)V");
6039         CHECK(LDKMessageSendEvent_SendTxAddInput_meth != NULL);
6040         LDKMessageSendEvent_SendTxAddOutput_class =
6041                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAddOutput"));
6042         CHECK(LDKMessageSendEvent_SendTxAddOutput_class != NULL);
6043         LDKMessageSendEvent_SendTxAddOutput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAddOutput_class, "<init>", "([BJ)V");
6044         CHECK(LDKMessageSendEvent_SendTxAddOutput_meth != NULL);
6045         LDKMessageSendEvent_SendTxRemoveInput_class =
6046                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxRemoveInput"));
6047         CHECK(LDKMessageSendEvent_SendTxRemoveInput_class != NULL);
6048         LDKMessageSendEvent_SendTxRemoveInput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxRemoveInput_class, "<init>", "([BJ)V");
6049         CHECK(LDKMessageSendEvent_SendTxRemoveInput_meth != NULL);
6050         LDKMessageSendEvent_SendTxRemoveOutput_class =
6051                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxRemoveOutput"));
6052         CHECK(LDKMessageSendEvent_SendTxRemoveOutput_class != NULL);
6053         LDKMessageSendEvent_SendTxRemoveOutput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxRemoveOutput_class, "<init>", "([BJ)V");
6054         CHECK(LDKMessageSendEvent_SendTxRemoveOutput_meth != NULL);
6055         LDKMessageSendEvent_SendTxComplete_class =
6056                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxComplete"));
6057         CHECK(LDKMessageSendEvent_SendTxComplete_class != NULL);
6058         LDKMessageSendEvent_SendTxComplete_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxComplete_class, "<init>", "([BJ)V");
6059         CHECK(LDKMessageSendEvent_SendTxComplete_meth != NULL);
6060         LDKMessageSendEvent_SendTxSignatures_class =
6061                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxSignatures"));
6062         CHECK(LDKMessageSendEvent_SendTxSignatures_class != NULL);
6063         LDKMessageSendEvent_SendTxSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxSignatures_class, "<init>", "([BJ)V");
6064         CHECK(LDKMessageSendEvent_SendTxSignatures_meth != NULL);
6065         LDKMessageSendEvent_SendTxInitRbf_class =
6066                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxInitRbf"));
6067         CHECK(LDKMessageSendEvent_SendTxInitRbf_class != NULL);
6068         LDKMessageSendEvent_SendTxInitRbf_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxInitRbf_class, "<init>", "([BJ)V");
6069         CHECK(LDKMessageSendEvent_SendTxInitRbf_meth != NULL);
6070         LDKMessageSendEvent_SendTxAckRbf_class =
6071                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAckRbf"));
6072         CHECK(LDKMessageSendEvent_SendTxAckRbf_class != NULL);
6073         LDKMessageSendEvent_SendTxAckRbf_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAckRbf_class, "<init>", "([BJ)V");
6074         CHECK(LDKMessageSendEvent_SendTxAckRbf_meth != NULL);
6075         LDKMessageSendEvent_SendTxAbort_class =
6076                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAbort"));
6077         CHECK(LDKMessageSendEvent_SendTxAbort_class != NULL);
6078         LDKMessageSendEvent_SendTxAbort_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAbort_class, "<init>", "([BJ)V");
6079         CHECK(LDKMessageSendEvent_SendTxAbort_meth != NULL);
6080         LDKMessageSendEvent_SendChannelReady_class =
6081                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReady"));
6082         CHECK(LDKMessageSendEvent_SendChannelReady_class != NULL);
6083         LDKMessageSendEvent_SendChannelReady_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReady_class, "<init>", "([BJ)V");
6084         CHECK(LDKMessageSendEvent_SendChannelReady_meth != NULL);
6085         LDKMessageSendEvent_SendAnnouncementSignatures_class =
6086                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures"));
6087         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
6088         LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
6089         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
6090         LDKMessageSendEvent_UpdateHTLCs_class =
6091                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs"));
6092         CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
6093         LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
6094         CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
6095         LDKMessageSendEvent_SendRevokeAndACK_class =
6096                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK"));
6097         CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
6098         LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
6099         CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
6100         LDKMessageSendEvent_SendClosingSigned_class =
6101                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned"));
6102         CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
6103         LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
6104         CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
6105         LDKMessageSendEvent_SendShutdown_class =
6106                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown"));
6107         CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
6108         LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
6109         CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
6110         LDKMessageSendEvent_SendChannelReestablish_class =
6111                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish"));
6112         CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
6113         LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
6114         CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
6115         LDKMessageSendEvent_SendChannelAnnouncement_class =
6116                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelAnnouncement"));
6117         CHECK(LDKMessageSendEvent_SendChannelAnnouncement_class != NULL);
6118         LDKMessageSendEvent_SendChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelAnnouncement_class, "<init>", "([BJJ)V");
6119         CHECK(LDKMessageSendEvent_SendChannelAnnouncement_meth != NULL);
6120         LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
6121                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement"));
6122         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
6123         LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
6124         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
6125         LDKMessageSendEvent_BroadcastChannelUpdate_class =
6126                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate"));
6127         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
6128         LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
6129         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
6130         LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
6131                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement"));
6132         CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
6133         LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
6134         CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
6135         LDKMessageSendEvent_SendChannelUpdate_class =
6136                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate"));
6137         CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
6138         LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
6139         CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
6140         LDKMessageSendEvent_HandleError_class =
6141                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$HandleError"));
6142         CHECK(LDKMessageSendEvent_HandleError_class != NULL);
6143         LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
6144         CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
6145         LDKMessageSendEvent_SendChannelRangeQuery_class =
6146                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery"));
6147         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
6148         LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
6149         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
6150         LDKMessageSendEvent_SendShortIdsQuery_class =
6151                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery"));
6152         CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
6153         LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
6154         CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
6155         LDKMessageSendEvent_SendReplyChannelRange_class =
6156                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange"));
6157         CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
6158         LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
6159         CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
6160         LDKMessageSendEvent_SendGossipTimestampFilter_class =
6161                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendGossipTimestampFilter"));
6162         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_class != NULL);
6163         LDKMessageSendEvent_SendGossipTimestampFilter_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, "<init>", "([BJ)V");
6164         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_meth != NULL);
6165 }
6166 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6167         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
6168         switch(obj->tag) {
6169                 case LDKMessageSendEvent_SendAcceptChannel: {
6170                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6171                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
6172                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
6173                         int64_t msg_ref = 0;
6174                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6175                         msg_ref = tag_ptr(msg_var.inner, false);
6176                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
6177                 }
6178                 case LDKMessageSendEvent_SendAcceptChannelV2: {
6179                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6180                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel_v2.node_id.compressed_form);
6181                         LDKAcceptChannelV2 msg_var = obj->send_accept_channel_v2.msg;
6182                         int64_t msg_ref = 0;
6183                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6184                         msg_ref = tag_ptr(msg_var.inner, false);
6185                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannelV2_class, LDKMessageSendEvent_SendAcceptChannelV2_meth, node_id_arr, msg_ref);
6186                 }
6187                 case LDKMessageSendEvent_SendOpenChannel: {
6188                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6189                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
6190                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
6191                         int64_t msg_ref = 0;
6192                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6193                         msg_ref = tag_ptr(msg_var.inner, false);
6194                         return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
6195                 }
6196                 case LDKMessageSendEvent_SendOpenChannelV2: {
6197                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6198                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel_v2.node_id.compressed_form);
6199                         LDKOpenChannelV2 msg_var = obj->send_open_channel_v2.msg;
6200                         int64_t msg_ref = 0;
6201                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6202                         msg_ref = tag_ptr(msg_var.inner, false);
6203                         return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannelV2_class, LDKMessageSendEvent_SendOpenChannelV2_meth, node_id_arr, msg_ref);
6204                 }
6205                 case LDKMessageSendEvent_SendFundingCreated: {
6206                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6207                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
6208                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
6209                         int64_t msg_ref = 0;
6210                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6211                         msg_ref = tag_ptr(msg_var.inner, false);
6212                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
6213                 }
6214                 case LDKMessageSendEvent_SendFundingSigned: {
6215                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6216                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
6217                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
6218                         int64_t msg_ref = 0;
6219                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6220                         msg_ref = tag_ptr(msg_var.inner, false);
6221                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
6222                 }
6223                 case LDKMessageSendEvent_SendTxAddInput: {
6224                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6225                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_add_input.node_id.compressed_form);
6226                         LDKTxAddInput msg_var = obj->send_tx_add_input.msg;
6227                         int64_t msg_ref = 0;
6228                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6229                         msg_ref = tag_ptr(msg_var.inner, false);
6230                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAddInput_class, LDKMessageSendEvent_SendTxAddInput_meth, node_id_arr, msg_ref);
6231                 }
6232                 case LDKMessageSendEvent_SendTxAddOutput: {
6233                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6234                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_add_output.node_id.compressed_form);
6235                         LDKTxAddOutput msg_var = obj->send_tx_add_output.msg;
6236                         int64_t msg_ref = 0;
6237                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6238                         msg_ref = tag_ptr(msg_var.inner, false);
6239                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAddOutput_class, LDKMessageSendEvent_SendTxAddOutput_meth, node_id_arr, msg_ref);
6240                 }
6241                 case LDKMessageSendEvent_SendTxRemoveInput: {
6242                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6243                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_remove_input.node_id.compressed_form);
6244                         LDKTxRemoveInput msg_var = obj->send_tx_remove_input.msg;
6245                         int64_t msg_ref = 0;
6246                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6247                         msg_ref = tag_ptr(msg_var.inner, false);
6248                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxRemoveInput_class, LDKMessageSendEvent_SendTxRemoveInput_meth, node_id_arr, msg_ref);
6249                 }
6250                 case LDKMessageSendEvent_SendTxRemoveOutput: {
6251                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6252                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_remove_output.node_id.compressed_form);
6253                         LDKTxRemoveOutput msg_var = obj->send_tx_remove_output.msg;
6254                         int64_t msg_ref = 0;
6255                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6256                         msg_ref = tag_ptr(msg_var.inner, false);
6257                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxRemoveOutput_class, LDKMessageSendEvent_SendTxRemoveOutput_meth, node_id_arr, msg_ref);
6258                 }
6259                 case LDKMessageSendEvent_SendTxComplete: {
6260                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6261                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_complete.node_id.compressed_form);
6262                         LDKTxComplete msg_var = obj->send_tx_complete.msg;
6263                         int64_t msg_ref = 0;
6264                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6265                         msg_ref = tag_ptr(msg_var.inner, false);
6266                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxComplete_class, LDKMessageSendEvent_SendTxComplete_meth, node_id_arr, msg_ref);
6267                 }
6268                 case LDKMessageSendEvent_SendTxSignatures: {
6269                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6270                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_signatures.node_id.compressed_form);
6271                         LDKTxSignatures msg_var = obj->send_tx_signatures.msg;
6272                         int64_t msg_ref = 0;
6273                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6274                         msg_ref = tag_ptr(msg_var.inner, false);
6275                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxSignatures_class, LDKMessageSendEvent_SendTxSignatures_meth, node_id_arr, msg_ref);
6276                 }
6277                 case LDKMessageSendEvent_SendTxInitRbf: {
6278                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6279                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_init_rbf.node_id.compressed_form);
6280                         LDKTxInitRbf msg_var = obj->send_tx_init_rbf.msg;
6281                         int64_t msg_ref = 0;
6282                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6283                         msg_ref = tag_ptr(msg_var.inner, false);
6284                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxInitRbf_class, LDKMessageSendEvent_SendTxInitRbf_meth, node_id_arr, msg_ref);
6285                 }
6286                 case LDKMessageSendEvent_SendTxAckRbf: {
6287                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6288                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_ack_rbf.node_id.compressed_form);
6289                         LDKTxAckRbf msg_var = obj->send_tx_ack_rbf.msg;
6290                         int64_t msg_ref = 0;
6291                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6292                         msg_ref = tag_ptr(msg_var.inner, false);
6293                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAckRbf_class, LDKMessageSendEvent_SendTxAckRbf_meth, node_id_arr, msg_ref);
6294                 }
6295                 case LDKMessageSendEvent_SendTxAbort: {
6296                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6297                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_abort.node_id.compressed_form);
6298                         LDKTxAbort msg_var = obj->send_tx_abort.msg;
6299                         int64_t msg_ref = 0;
6300                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6301                         msg_ref = tag_ptr(msg_var.inner, false);
6302                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAbort_class, LDKMessageSendEvent_SendTxAbort_meth, node_id_arr, msg_ref);
6303                 }
6304                 case LDKMessageSendEvent_SendChannelReady: {
6305                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6306                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_ready.node_id.compressed_form);
6307                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
6308                         int64_t msg_ref = 0;
6309                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6310                         msg_ref = tag_ptr(msg_var.inner, false);
6311                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReady_class, LDKMessageSendEvent_SendChannelReady_meth, node_id_arr, msg_ref);
6312                 }
6313                 case LDKMessageSendEvent_SendAnnouncementSignatures: {
6314                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6315                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
6316                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.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_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
6321                 }
6322                 case LDKMessageSendEvent_UpdateHTLCs: {
6323                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6324                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
6325                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
6326                         int64_t updates_ref = 0;
6327                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
6328                         updates_ref = tag_ptr(updates_var.inner, false);
6329                         return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
6330                 }
6331                 case LDKMessageSendEvent_SendRevokeAndACK: {
6332                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6333                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
6334                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
6335                         int64_t msg_ref = 0;
6336                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6337                         msg_ref = tag_ptr(msg_var.inner, false);
6338                         return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
6339                 }
6340                 case LDKMessageSendEvent_SendClosingSigned: {
6341                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6342                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
6343                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
6344                         int64_t msg_ref = 0;
6345                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6346                         msg_ref = tag_ptr(msg_var.inner, false);
6347                         return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
6348                 }
6349                 case LDKMessageSendEvent_SendShutdown: {
6350                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6351                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
6352                         LDKShutdown msg_var = obj->send_shutdown.msg;
6353                         int64_t msg_ref = 0;
6354                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6355                         msg_ref = tag_ptr(msg_var.inner, false);
6356                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
6357                 }
6358                 case LDKMessageSendEvent_SendChannelReestablish: {
6359                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6360                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
6361                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
6362                         int64_t msg_ref = 0;
6363                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6364                         msg_ref = tag_ptr(msg_var.inner, false);
6365                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
6366                 }
6367                 case LDKMessageSendEvent_SendChannelAnnouncement: {
6368                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6369                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_announcement.node_id.compressed_form);
6370                         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
6371                         int64_t msg_ref = 0;
6372                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6373                         msg_ref = tag_ptr(msg_var.inner, false);
6374                         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
6375                         int64_t update_msg_ref = 0;
6376                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
6377                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
6378                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelAnnouncement_class, LDKMessageSendEvent_SendChannelAnnouncement_meth, node_id_arr, msg_ref, update_msg_ref);
6379                 }
6380                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
6381                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
6382                         int64_t msg_ref = 0;
6383                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6384                         msg_ref = tag_ptr(msg_var.inner, false);
6385                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
6386                         int64_t update_msg_ref = 0;
6387                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
6388                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
6389                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
6390                 }
6391                 case LDKMessageSendEvent_BroadcastChannelUpdate: {
6392                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
6393                         int64_t msg_ref = 0;
6394                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6395                         msg_ref = tag_ptr(msg_var.inner, false);
6396                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
6397                 }
6398                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
6399                         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
6400                         int64_t msg_ref = 0;
6401                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6402                         msg_ref = tag_ptr(msg_var.inner, false);
6403                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
6404                 }
6405                 case LDKMessageSendEvent_SendChannelUpdate: {
6406                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6407                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
6408                         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
6409                         int64_t msg_ref = 0;
6410                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6411                         msg_ref = tag_ptr(msg_var.inner, false);
6412                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
6413                 }
6414                 case LDKMessageSendEvent_HandleError: {
6415                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6416                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
6417                         int64_t action_ref = tag_ptr(&obj->handle_error.action, false);
6418                         return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
6419                 }
6420                 case LDKMessageSendEvent_SendChannelRangeQuery: {
6421                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6422                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
6423                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
6424                         int64_t msg_ref = 0;
6425                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6426                         msg_ref = tag_ptr(msg_var.inner, false);
6427                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
6428                 }
6429                 case LDKMessageSendEvent_SendShortIdsQuery: {
6430                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6431                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
6432                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
6433                         int64_t msg_ref = 0;
6434                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6435                         msg_ref = tag_ptr(msg_var.inner, false);
6436                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
6437                 }
6438                 case LDKMessageSendEvent_SendReplyChannelRange: {
6439                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6440                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
6441                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
6442                         int64_t msg_ref = 0;
6443                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6444                         msg_ref = tag_ptr(msg_var.inner, false);
6445                         return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
6446                 }
6447                 case LDKMessageSendEvent_SendGossipTimestampFilter: {
6448                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6449                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_gossip_timestamp_filter.node_id.compressed_form);
6450                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
6451                         int64_t msg_ref = 0;
6452                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6453                         msg_ref = tag_ptr(msg_var.inner, false);
6454                         return (*env)->NewObject(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, LDKMessageSendEvent_SendGossipTimestampFilter_meth, node_id_arr, msg_ref);
6455                 }
6456                 default: abort();
6457         }
6458 }
6459 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
6460         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
6461         for (size_t i = 0; i < ret.datalen; i++) {
6462                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
6463         }
6464         return ret;
6465 }
6466 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
6467         LDKChannelUpdateInfo ret = *owner->contents.result;
6468         ret.is_owned = false;
6469         return ret;
6470 }
6471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6472         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
6473         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
6474         int64_t ret_ref = 0;
6475         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6476         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6477         return ret_ref;
6478 }
6479
6480 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
6481 CHECK(!owner->result_ok);
6482         return DecodeError_clone(&*owner->contents.err);
6483 }
6484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6485         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
6486         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6487         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
6488         int64_t ret_ref = tag_ptr(ret_copy, true);
6489         return ret_ref;
6490 }
6491
6492 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
6493         LDKChannelInfo ret = *owner->contents.result;
6494         ret.is_owned = false;
6495         return ret;
6496 }
6497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6498         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
6499         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
6500         int64_t ret_ref = 0;
6501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6503         return ret_ref;
6504 }
6505
6506 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
6507 CHECK(!owner->result_ok);
6508         return DecodeError_clone(&*owner->contents.err);
6509 }
6510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6511         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
6512         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6513         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
6514         int64_t ret_ref = tag_ptr(ret_copy, true);
6515         return ret_ref;
6516 }
6517
6518 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
6519         LDKRoutingFees ret = *owner->contents.result;
6520         ret.is_owned = false;
6521         return ret;
6522 }
6523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6524         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
6525         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
6526         int64_t ret_ref = 0;
6527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6529         return ret_ref;
6530 }
6531
6532 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
6533 CHECK(!owner->result_ok);
6534         return DecodeError_clone(&*owner->contents.err);
6535 }
6536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6537         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
6538         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6539         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
6540         int64_t ret_ref = tag_ptr(ret_copy, true);
6541         return ret_ref;
6542 }
6543
6544 static jclass LDKSocketAddress_TcpIpV4_class = NULL;
6545 static jmethodID LDKSocketAddress_TcpIpV4_meth = NULL;
6546 static jclass LDKSocketAddress_TcpIpV6_class = NULL;
6547 static jmethodID LDKSocketAddress_TcpIpV6_meth = NULL;
6548 static jclass LDKSocketAddress_OnionV2_class = NULL;
6549 static jmethodID LDKSocketAddress_OnionV2_meth = NULL;
6550 static jclass LDKSocketAddress_OnionV3_class = NULL;
6551 static jmethodID LDKSocketAddress_OnionV3_meth = NULL;
6552 static jclass LDKSocketAddress_Hostname_class = NULL;
6553 static jmethodID LDKSocketAddress_Hostname_meth = NULL;
6554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSocketAddress_init (JNIEnv *env, jclass clz) {
6555         LDKSocketAddress_TcpIpV4_class =
6556                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$TcpIpV4"));
6557         CHECK(LDKSocketAddress_TcpIpV4_class != NULL);
6558         LDKSocketAddress_TcpIpV4_meth = (*env)->GetMethodID(env, LDKSocketAddress_TcpIpV4_class, "<init>", "([BS)V");
6559         CHECK(LDKSocketAddress_TcpIpV4_meth != NULL);
6560         LDKSocketAddress_TcpIpV6_class =
6561                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$TcpIpV6"));
6562         CHECK(LDKSocketAddress_TcpIpV6_class != NULL);
6563         LDKSocketAddress_TcpIpV6_meth = (*env)->GetMethodID(env, LDKSocketAddress_TcpIpV6_class, "<init>", "([BS)V");
6564         CHECK(LDKSocketAddress_TcpIpV6_meth != NULL);
6565         LDKSocketAddress_OnionV2_class =
6566                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$OnionV2"));
6567         CHECK(LDKSocketAddress_OnionV2_class != NULL);
6568         LDKSocketAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKSocketAddress_OnionV2_class, "<init>", "([B)V");
6569         CHECK(LDKSocketAddress_OnionV2_meth != NULL);
6570         LDKSocketAddress_OnionV3_class =
6571                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$OnionV3"));
6572         CHECK(LDKSocketAddress_OnionV3_class != NULL);
6573         LDKSocketAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKSocketAddress_OnionV3_class, "<init>", "([BSBS)V");
6574         CHECK(LDKSocketAddress_OnionV3_meth != NULL);
6575         LDKSocketAddress_Hostname_class =
6576                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$Hostname"));
6577         CHECK(LDKSocketAddress_Hostname_class != NULL);
6578         LDKSocketAddress_Hostname_meth = (*env)->GetMethodID(env, LDKSocketAddress_Hostname_class, "<init>", "(JS)V");
6579         CHECK(LDKSocketAddress_Hostname_meth != NULL);
6580 }
6581 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6582         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
6583         switch(obj->tag) {
6584                 case LDKSocketAddress_TcpIpV4: {
6585                         int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
6586                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->tcp_ip_v4.addr.data);
6587                         int16_t port_conv = obj->tcp_ip_v4.port;
6588                         return (*env)->NewObject(env, LDKSocketAddress_TcpIpV4_class, LDKSocketAddress_TcpIpV4_meth, addr_arr, port_conv);
6589                 }
6590                 case LDKSocketAddress_TcpIpV6: {
6591                         int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
6592                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->tcp_ip_v6.addr.data);
6593                         int16_t port_conv = obj->tcp_ip_v6.port;
6594                         return (*env)->NewObject(env, LDKSocketAddress_TcpIpV6_class, LDKSocketAddress_TcpIpV6_meth, addr_arr, port_conv);
6595                 }
6596                 case LDKSocketAddress_OnionV2: {
6597                         int8_tArray onion_v2_arr = (*env)->NewByteArray(env, 12);
6598                         (*env)->SetByteArrayRegion(env, onion_v2_arr, 0, 12, obj->onion_v2.data);
6599                         return (*env)->NewObject(env, LDKSocketAddress_OnionV2_class, LDKSocketAddress_OnionV2_meth, onion_v2_arr);
6600                 }
6601                 case LDKSocketAddress_OnionV3: {
6602                         int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
6603                         (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
6604                         int16_t checksum_conv = obj->onion_v3.checksum;
6605                         int8_t version_conv = obj->onion_v3.version;
6606                         int16_t port_conv = obj->onion_v3.port;
6607                         return (*env)->NewObject(env, LDKSocketAddress_OnionV3_class, LDKSocketAddress_OnionV3_meth, ed25519_pubkey_arr, checksum_conv, version_conv, port_conv);
6608                 }
6609                 case LDKSocketAddress_Hostname: {
6610                         LDKHostname hostname_var = obj->hostname.hostname;
6611                         int64_t hostname_ref = 0;
6612                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
6613                         hostname_ref = tag_ptr(hostname_var.inner, false);
6614                         int16_t port_conv = obj->hostname.port;
6615                         return (*env)->NewObject(env, LDKSocketAddress_Hostname_class, LDKSocketAddress_Hostname_meth, hostname_ref, port_conv);
6616                 }
6617                 default: abort();
6618         }
6619 }
6620 static inline LDKCVec_SocketAddressZ CVec_SocketAddressZ_clone(const LDKCVec_SocketAddressZ *orig) {
6621         LDKCVec_SocketAddressZ ret = { .data = MALLOC(sizeof(LDKSocketAddress) * orig->datalen, "LDKCVec_SocketAddressZ clone bytes"), .datalen = orig->datalen };
6622         for (size_t i = 0; i < ret.datalen; i++) {
6623                 ret.data[i] = SocketAddress_clone(&orig->data[i]);
6624         }
6625         return ret;
6626 }
6627 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
6628         LDKNodeAnnouncementInfo ret = *owner->contents.result;
6629         ret.is_owned = false;
6630         return ret;
6631 }
6632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6633         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
6634         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
6635         int64_t ret_ref = 0;
6636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6638         return ret_ref;
6639 }
6640
6641 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
6642 CHECK(!owner->result_ok);
6643         return DecodeError_clone(&*owner->contents.err);
6644 }
6645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6646         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
6647         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6648         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
6649         int64_t ret_ref = tag_ptr(ret_copy, true);
6650         return ret_ref;
6651 }
6652
6653 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
6654         LDKNodeAlias ret = *owner->contents.result;
6655         ret.is_owned = false;
6656         return ret;
6657 }
6658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6659         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
6660         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
6661         int64_t ret_ref = 0;
6662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6664         return ret_ref;
6665 }
6666
6667 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
6668 CHECK(!owner->result_ok);
6669         return DecodeError_clone(&*owner->contents.err);
6670 }
6671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6672         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
6673         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6674         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
6675         int64_t ret_ref = tag_ptr(ret_copy, true);
6676         return ret_ref;
6677 }
6678
6679 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
6680         LDKNodeInfo ret = *owner->contents.result;
6681         ret.is_owned = false;
6682         return ret;
6683 }
6684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6685         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
6686         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
6687         int64_t ret_ref = 0;
6688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6690         return ret_ref;
6691 }
6692
6693 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
6694 CHECK(!owner->result_ok);
6695         return DecodeError_clone(&*owner->contents.err);
6696 }
6697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6698         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
6699         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6700         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
6701         int64_t ret_ref = tag_ptr(ret_copy, true);
6702         return ret_ref;
6703 }
6704
6705 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
6706         LDKNetworkGraph ret = *owner->contents.result;
6707         ret.is_owned = false;
6708         return ret;
6709 }
6710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6711         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
6712         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
6713         int64_t ret_ref = 0;
6714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6716         return ret_ref;
6717 }
6718
6719 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
6720 CHECK(!owner->result_ok);
6721         return DecodeError_clone(&*owner->contents.err);
6722 }
6723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6724         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
6725         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6726         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
6727         int64_t ret_ref = tag_ptr(ret_copy, true);
6728         return ret_ref;
6729 }
6730
6731 static jclass LDKCOption_CVec_SocketAddressZZ_Some_class = NULL;
6732 static jmethodID LDKCOption_CVec_SocketAddressZZ_Some_meth = NULL;
6733 static jclass LDKCOption_CVec_SocketAddressZZ_None_class = NULL;
6734 static jmethodID LDKCOption_CVec_SocketAddressZZ_None_meth = NULL;
6735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1SocketAddressZZ_init (JNIEnv *env, jclass clz) {
6736         LDKCOption_CVec_SocketAddressZZ_Some_class =
6737                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_SocketAddressZZ$Some"));
6738         CHECK(LDKCOption_CVec_SocketAddressZZ_Some_class != NULL);
6739         LDKCOption_CVec_SocketAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_SocketAddressZZ_Some_class, "<init>", "([J)V");
6740         CHECK(LDKCOption_CVec_SocketAddressZZ_Some_meth != NULL);
6741         LDKCOption_CVec_SocketAddressZZ_None_class =
6742                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_SocketAddressZZ$None"));
6743         CHECK(LDKCOption_CVec_SocketAddressZZ_None_class != NULL);
6744         LDKCOption_CVec_SocketAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_SocketAddressZZ_None_class, "<init>", "()V");
6745         CHECK(LDKCOption_CVec_SocketAddressZZ_None_meth != NULL);
6746 }
6747 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1SocketAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6748         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
6749         switch(obj->tag) {
6750                 case LDKCOption_CVec_SocketAddressZZ_Some: {
6751                         LDKCVec_SocketAddressZ some_var = obj->some;
6752                         int64_tArray some_arr = NULL;
6753                         some_arr = (*env)->NewLongArray(env, some_var.datalen);
6754                         int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL);
6755                         for (size_t p = 0; p < some_var.datalen; p++) {
6756                                 int64_t some_conv_15_ref = tag_ptr(&some_var.data[p], false);
6757                                 some_arr_ptr[p] = some_conv_15_ref;
6758                         }
6759                         (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0);
6760                         return (*env)->NewObject(env, LDKCOption_CVec_SocketAddressZZ_Some_class, LDKCOption_CVec_SocketAddressZZ_Some_meth, some_arr);
6761                 }
6762                 case LDKCOption_CVec_SocketAddressZZ_None: {
6763                         return (*env)->NewObject(env, LDKCOption_CVec_SocketAddressZZ_None_class, LDKCOption_CVec_SocketAddressZZ_None_meth);
6764                 }
6765                 default: abort();
6766         }
6767 }
6768 static inline LDKCVec_HTLCOutputInCommitmentZ CVec_HTLCOutputInCommitmentZ_clone(const LDKCVec_HTLCOutputInCommitmentZ *orig) {
6769         LDKCVec_HTLCOutputInCommitmentZ ret = { .data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * orig->datalen, "LDKCVec_HTLCOutputInCommitmentZ clone bytes"), .datalen = orig->datalen };
6770         for (size_t i = 0; i < ret.datalen; i++) {
6771                 ret.data[i] = HTLCOutputInCommitment_clone(&orig->data[i]);
6772         }
6773         return ret;
6774 }
6775 static inline LDKCVec_HTLCDescriptorZ CVec_HTLCDescriptorZ_clone(const LDKCVec_HTLCDescriptorZ *orig) {
6776         LDKCVec_HTLCDescriptorZ ret = { .data = MALLOC(sizeof(LDKHTLCDescriptor) * orig->datalen, "LDKCVec_HTLCDescriptorZ clone bytes"), .datalen = orig->datalen };
6777         for (size_t i = 0; i < ret.datalen; i++) {
6778                 ret.data[i] = HTLCDescriptor_clone(&orig->data[i]);
6779         }
6780         return ret;
6781 }
6782 static inline LDKCVec_UtxoZ CVec_UtxoZ_clone(const LDKCVec_UtxoZ *orig) {
6783         LDKCVec_UtxoZ ret = { .data = MALLOC(sizeof(LDKUtxo) * orig->datalen, "LDKCVec_UtxoZ clone bytes"), .datalen = orig->datalen };
6784         for (size_t i = 0; i < ret.datalen; i++) {
6785                 ret.data[i] = Utxo_clone(&orig->data[i]);
6786         }
6787         return ret;
6788 }
6789 static jclass LDKCOption_TxOutZ_Some_class = NULL;
6790 static jmethodID LDKCOption_TxOutZ_Some_meth = NULL;
6791 static jclass LDKCOption_TxOutZ_None_class = NULL;
6792 static jmethodID LDKCOption_TxOutZ_None_meth = NULL;
6793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TxOutZ_init (JNIEnv *env, jclass clz) {
6794         LDKCOption_TxOutZ_Some_class =
6795                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TxOutZ$Some"));
6796         CHECK(LDKCOption_TxOutZ_Some_class != NULL);
6797         LDKCOption_TxOutZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TxOutZ_Some_class, "<init>", "(J)V");
6798         CHECK(LDKCOption_TxOutZ_Some_meth != NULL);
6799         LDKCOption_TxOutZ_None_class =
6800                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TxOutZ$None"));
6801         CHECK(LDKCOption_TxOutZ_None_class != NULL);
6802         LDKCOption_TxOutZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TxOutZ_None_class, "<init>", "()V");
6803         CHECK(LDKCOption_TxOutZ_None_meth != NULL);
6804 }
6805 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TxOutZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6806         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
6807         switch(obj->tag) {
6808                 case LDKCOption_TxOutZ_Some: {
6809                         LDKTxOut* some_ref = &obj->some;
6810                         return (*env)->NewObject(env, LDKCOption_TxOutZ_Some_class, LDKCOption_TxOutZ_Some_meth, tag_ptr(some_ref, false));
6811                 }
6812                 case LDKCOption_TxOutZ_None: {
6813                         return (*env)->NewObject(env, LDKCOption_TxOutZ_None_class, LDKCOption_TxOutZ_None_meth);
6814                 }
6815                 default: abort();
6816         }
6817 }
6818 static inline LDKCVec_InputZ CVec_InputZ_clone(const LDKCVec_InputZ *orig) {
6819         LDKCVec_InputZ ret = { .data = MALLOC(sizeof(LDKInput) * orig->datalen, "LDKCVec_InputZ clone bytes"), .datalen = orig->datalen };
6820         for (size_t i = 0; i < ret.datalen; i++) {
6821                 ret.data[i] = Input_clone(&orig->data[i]);
6822         }
6823         return ret;
6824 }
6825 static inline struct LDKCoinSelection CResult_CoinSelectionNoneZ_get_ok(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
6826         LDKCoinSelection ret = *owner->contents.result;
6827         ret.is_owned = false;
6828         return ret;
6829 }
6830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6831         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
6832         LDKCoinSelection ret_var = CResult_CoinSelectionNoneZ_get_ok(owner_conv);
6833         int64_t ret_ref = 0;
6834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6836         return ret_ref;
6837 }
6838
6839 static inline void CResult_CoinSelectionNoneZ_get_err(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
6840 CHECK(!owner->result_ok);
6841         return *owner->contents.err;
6842 }
6843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6844         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
6845         CResult_CoinSelectionNoneZ_get_err(owner_conv);
6846 }
6847
6848 static inline struct LDKCVec_UtxoZ CResult_CVec_UtxoZNoneZ_get_ok(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
6849 CHECK(owner->result_ok);
6850         return CVec_UtxoZ_clone(&*owner->contents.result);
6851 }
6852 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6853         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
6854         LDKCVec_UtxoZ ret_var = CResult_CVec_UtxoZNoneZ_get_ok(owner_conv);
6855         int64_tArray ret_arr = NULL;
6856         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6857         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6858         for (size_t g = 0; g < ret_var.datalen; g++) {
6859                 LDKUtxo ret_conv_6_var = ret_var.data[g];
6860                 int64_t ret_conv_6_ref = 0;
6861                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
6862                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
6863                 ret_arr_ptr[g] = ret_conv_6_ref;
6864         }
6865         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6866         FREE(ret_var.data);
6867         return ret_arr;
6868 }
6869
6870 static inline void CResult_CVec_UtxoZNoneZ_get_err(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
6871 CHECK(!owner->result_ok);
6872         return *owner->contents.err;
6873 }
6874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6875         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
6876         CResult_CVec_UtxoZNoneZ_get_err(owner_conv);
6877 }
6878
6879 static inline uint64_t C2Tuple_u64u16Z_get_a(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
6880         return owner->a;
6881 }
6882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6883         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
6884         int64_t ret_conv = C2Tuple_u64u16Z_get_a(owner_conv);
6885         return ret_conv;
6886 }
6887
6888 static inline uint16_t C2Tuple_u64u16Z_get_b(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
6889         return owner->b;
6890 }
6891 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6892         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
6893         int16_t ret_conv = C2Tuple_u64u16Z_get_b(owner_conv);
6894         return ret_conv;
6895 }
6896
6897 static jclass LDKCOption_C2Tuple_u64u16ZZ_Some_class = NULL;
6898 static jmethodID LDKCOption_C2Tuple_u64u16ZZ_Some_meth = NULL;
6899 static jclass LDKCOption_C2Tuple_u64u16ZZ_None_class = NULL;
6900 static jmethodID LDKCOption_C2Tuple_u64u16ZZ_None_meth = NULL;
6901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1u64u16ZZ_init (JNIEnv *env, jclass clz) {
6902         LDKCOption_C2Tuple_u64u16ZZ_Some_class =
6903                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u16ZZ$Some"));
6904         CHECK(LDKCOption_C2Tuple_u64u16ZZ_Some_class != NULL);
6905         LDKCOption_C2Tuple_u64u16ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u16ZZ_Some_class, "<init>", "(J)V");
6906         CHECK(LDKCOption_C2Tuple_u64u16ZZ_Some_meth != NULL);
6907         LDKCOption_C2Tuple_u64u16ZZ_None_class =
6908                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u16ZZ$None"));
6909         CHECK(LDKCOption_C2Tuple_u64u16ZZ_None_class != NULL);
6910         LDKCOption_C2Tuple_u64u16ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u16ZZ_None_class, "<init>", "()V");
6911         CHECK(LDKCOption_C2Tuple_u64u16ZZ_None_meth != NULL);
6912 }
6913 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u16ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6914         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
6915         switch(obj->tag) {
6916                 case LDKCOption_C2Tuple_u64u16ZZ_Some: {
6917                         LDKC2Tuple_u64u16Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
6918                         *some_conv = obj->some;
6919                         *some_conv = C2Tuple_u64u16Z_clone(some_conv);
6920                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u16ZZ_Some_class, LDKCOption_C2Tuple_u64u16ZZ_Some_meth, tag_ptr(some_conv, true));
6921                 }
6922                 case LDKCOption_C2Tuple_u64u16ZZ_None: {
6923                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u16ZZ_None_class, LDKCOption_C2Tuple_u64u16ZZ_None_meth);
6924                 }
6925                 default: abort();
6926         }
6927 }
6928 static jclass LDKCOption_ChannelShutdownStateZ_Some_class = NULL;
6929 static jmethodID LDKCOption_ChannelShutdownStateZ_Some_meth = NULL;
6930 static jclass LDKCOption_ChannelShutdownStateZ_None_class = NULL;
6931 static jmethodID LDKCOption_ChannelShutdownStateZ_None_meth = NULL;
6932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ChannelShutdownStateZ_init (JNIEnv *env, jclass clz) {
6933         LDKCOption_ChannelShutdownStateZ_Some_class =
6934                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ChannelShutdownStateZ$Some"));
6935         CHECK(LDKCOption_ChannelShutdownStateZ_Some_class != NULL);
6936         LDKCOption_ChannelShutdownStateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ChannelShutdownStateZ_Some_class, "<init>", "(Lorg/ldk/enums/ChannelShutdownState;)V");
6937         CHECK(LDKCOption_ChannelShutdownStateZ_Some_meth != NULL);
6938         LDKCOption_ChannelShutdownStateZ_None_class =
6939                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ChannelShutdownStateZ$None"));
6940         CHECK(LDKCOption_ChannelShutdownStateZ_None_class != NULL);
6941         LDKCOption_ChannelShutdownStateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ChannelShutdownStateZ_None_class, "<init>", "()V");
6942         CHECK(LDKCOption_ChannelShutdownStateZ_None_meth != NULL);
6943 }
6944 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ChannelShutdownStateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6945         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
6946         switch(obj->tag) {
6947                 case LDKCOption_ChannelShutdownStateZ_Some: {
6948                         jclass some_conv = LDKChannelShutdownState_to_java(env, obj->some);
6949                         return (*env)->NewObject(env, LDKCOption_ChannelShutdownStateZ_Some_class, LDKCOption_ChannelShutdownStateZ_Some_meth, some_conv);
6950                 }
6951                 case LDKCOption_ChannelShutdownStateZ_None: {
6952                         return (*env)->NewObject(env, LDKCOption_ChannelShutdownStateZ_None_class, LDKCOption_ChannelShutdownStateZ_None_meth);
6953                 }
6954                 default: abort();
6955         }
6956 }
6957 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesAPIErrorZ_get_ok(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
6958 CHECK(owner->result_ok);
6959         return ThirtyTwoBytes_clone(&*owner->contents.result);
6960 }
6961 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6962         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
6963         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6964         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesAPIErrorZ_get_ok(owner_conv).data);
6965         return ret_arr;
6966 }
6967
6968 static inline struct LDKAPIError CResult_ThirtyTwoBytesAPIErrorZ_get_err(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
6969 CHECK(!owner->result_ok);
6970         return APIError_clone(&*owner->contents.err);
6971 }
6972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6973         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
6974         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6975         *ret_copy = CResult_ThirtyTwoBytesAPIErrorZ_get_err(owner_conv);
6976         int64_t ret_ref = tag_ptr(ret_copy, true);
6977         return ret_ref;
6978 }
6979
6980 static jclass LDKRecentPaymentDetails_AwaitingInvoice_class = NULL;
6981 static jmethodID LDKRecentPaymentDetails_AwaitingInvoice_meth = NULL;
6982 static jclass LDKRecentPaymentDetails_Pending_class = NULL;
6983 static jmethodID LDKRecentPaymentDetails_Pending_meth = NULL;
6984 static jclass LDKRecentPaymentDetails_Fulfilled_class = NULL;
6985 static jmethodID LDKRecentPaymentDetails_Fulfilled_meth = NULL;
6986 static jclass LDKRecentPaymentDetails_Abandoned_class = NULL;
6987 static jmethodID LDKRecentPaymentDetails_Abandoned_meth = NULL;
6988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRecentPaymentDetails_init (JNIEnv *env, jclass clz) {
6989         LDKRecentPaymentDetails_AwaitingInvoice_class =
6990                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$AwaitingInvoice"));
6991         CHECK(LDKRecentPaymentDetails_AwaitingInvoice_class != NULL);
6992         LDKRecentPaymentDetails_AwaitingInvoice_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_AwaitingInvoice_class, "<init>", "([B)V");
6993         CHECK(LDKRecentPaymentDetails_AwaitingInvoice_meth != NULL);
6994         LDKRecentPaymentDetails_Pending_class =
6995                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Pending"));
6996         CHECK(LDKRecentPaymentDetails_Pending_class != NULL);
6997         LDKRecentPaymentDetails_Pending_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Pending_class, "<init>", "([B[BJ)V");
6998         CHECK(LDKRecentPaymentDetails_Pending_meth != NULL);
6999         LDKRecentPaymentDetails_Fulfilled_class =
7000                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Fulfilled"));
7001         CHECK(LDKRecentPaymentDetails_Fulfilled_class != NULL);
7002         LDKRecentPaymentDetails_Fulfilled_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Fulfilled_class, "<init>", "([BJ)V");
7003         CHECK(LDKRecentPaymentDetails_Fulfilled_meth != NULL);
7004         LDKRecentPaymentDetails_Abandoned_class =
7005                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Abandoned"));
7006         CHECK(LDKRecentPaymentDetails_Abandoned_class != NULL);
7007         LDKRecentPaymentDetails_Abandoned_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Abandoned_class, "<init>", "([B[B)V");
7008         CHECK(LDKRecentPaymentDetails_Abandoned_meth != NULL);
7009 }
7010 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRecentPaymentDetails_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7011         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
7012         switch(obj->tag) {
7013                 case LDKRecentPaymentDetails_AwaitingInvoice: {
7014                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
7015                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->awaiting_invoice.payment_id.data);
7016                         return (*env)->NewObject(env, LDKRecentPaymentDetails_AwaitingInvoice_class, LDKRecentPaymentDetails_AwaitingInvoice_meth, payment_id_arr);
7017                 }
7018                 case LDKRecentPaymentDetails_Pending: {
7019                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
7020                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->pending.payment_id.data);
7021                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
7022                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->pending.payment_hash.data);
7023                         int64_t total_msat_conv = obj->pending.total_msat;
7024                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Pending_class, LDKRecentPaymentDetails_Pending_meth, payment_id_arr, payment_hash_arr, total_msat_conv);
7025                 }
7026                 case LDKRecentPaymentDetails_Fulfilled: {
7027                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
7028                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->fulfilled.payment_id.data);
7029                         int64_t payment_hash_ref = tag_ptr(&obj->fulfilled.payment_hash, false);
7030                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Fulfilled_class, LDKRecentPaymentDetails_Fulfilled_meth, payment_id_arr, payment_hash_ref);
7031                 }
7032                 case LDKRecentPaymentDetails_Abandoned: {
7033                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
7034                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->abandoned.payment_id.data);
7035                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
7036                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->abandoned.payment_hash.data);
7037                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Abandoned_class, LDKRecentPaymentDetails_Abandoned_meth, payment_id_arr, payment_hash_arr);
7038                 }
7039                 default: abort();
7040         }
7041 }
7042 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
7043         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
7044         for (size_t i = 0; i < ret.datalen; i++) {
7045                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
7046         }
7047         return ret;
7048 }
7049 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
7050 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
7051 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
7052 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
7053 static jclass LDKPaymentSendFailure_AllFailedResendSafe_class = NULL;
7054 static jmethodID LDKPaymentSendFailure_AllFailedResendSafe_meth = NULL;
7055 static jclass LDKPaymentSendFailure_DuplicatePayment_class = NULL;
7056 static jmethodID LDKPaymentSendFailure_DuplicatePayment_meth = NULL;
7057 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
7058 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
7059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
7060         LDKPaymentSendFailure_ParameterError_class =
7061                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError"));
7062         CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
7063         LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
7064         CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
7065         LDKPaymentSendFailure_PathParameterError_class =
7066                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError"));
7067         CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
7068         LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
7069         CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
7070         LDKPaymentSendFailure_AllFailedResendSafe_class =
7071                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedResendSafe"));
7072         CHECK(LDKPaymentSendFailure_AllFailedResendSafe_class != NULL);
7073         LDKPaymentSendFailure_AllFailedResendSafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedResendSafe_class, "<init>", "([J)V");
7074         CHECK(LDKPaymentSendFailure_AllFailedResendSafe_meth != NULL);
7075         LDKPaymentSendFailure_DuplicatePayment_class =
7076                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$DuplicatePayment"));
7077         CHECK(LDKPaymentSendFailure_DuplicatePayment_class != NULL);
7078         LDKPaymentSendFailure_DuplicatePayment_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_DuplicatePayment_class, "<init>", "()V");
7079         CHECK(LDKPaymentSendFailure_DuplicatePayment_meth != NULL);
7080         LDKPaymentSendFailure_PartialFailure_class =
7081                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure"));
7082         CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
7083         LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([JJ[B)V");
7084         CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
7085 }
7086 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7087         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
7088         switch(obj->tag) {
7089                 case LDKPaymentSendFailure_ParameterError: {
7090                         int64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
7091                         return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
7092                 }
7093                 case LDKPaymentSendFailure_PathParameterError: {
7094                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
7095                         int64_tArray path_parameter_error_arr = NULL;
7096                         path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
7097                         int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
7098                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
7099                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7100                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
7101                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
7102                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
7103                         }
7104                         (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
7105                         return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
7106                 }
7107                 case LDKPaymentSendFailure_AllFailedResendSafe: {
7108                         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
7109                         int64_tArray all_failed_resend_safe_arr = NULL;
7110                         all_failed_resend_safe_arr = (*env)->NewLongArray(env, all_failed_resend_safe_var.datalen);
7111                         int64_t *all_failed_resend_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_resend_safe_arr, NULL);
7112                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
7113                                 int64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
7114                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
7115                         }
7116                         (*env)->ReleasePrimitiveArrayCritical(env, all_failed_resend_safe_arr, all_failed_resend_safe_arr_ptr, 0);
7117                         return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedResendSafe_class, LDKPaymentSendFailure_AllFailedResendSafe_meth, all_failed_resend_safe_arr);
7118                 }
7119                 case LDKPaymentSendFailure_DuplicatePayment: {
7120                         return (*env)->NewObject(env, LDKPaymentSendFailure_DuplicatePayment_class, LDKPaymentSendFailure_DuplicatePayment_meth);
7121                 }
7122                 case LDKPaymentSendFailure_PartialFailure: {
7123                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
7124                         int64_tArray results_arr = NULL;
7125                         results_arr = (*env)->NewLongArray(env, results_var.datalen);
7126                         int64_t *results_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, results_arr, NULL);
7127                         for (size_t w = 0; w < results_var.datalen; w++) {
7128                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7129                                 *results_conv_22_conv = results_var.data[w];
7130                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
7131                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
7132                         }
7133                         (*env)->ReleasePrimitiveArrayCritical(env, results_arr, results_arr_ptr, 0);
7134                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
7135                         int64_t failed_paths_retry_ref = 0;
7136                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
7137                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
7138                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
7139                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->partial_failure.payment_id.data);
7140                         return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, results_arr, failed_paths_retry_ref, payment_id_arr);
7141                 }
7142                 default: abort();
7143         }
7144 }
7145 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
7146 CHECK(owner->result_ok);
7147         return *owner->contents.result;
7148 }
7149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7150         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
7151         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
7152 }
7153
7154 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
7155 CHECK(!owner->result_ok);
7156         return PaymentSendFailure_clone(&*owner->contents.err);
7157 }
7158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7159         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
7160         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
7161         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
7162         int64_t ret_ref = tag_ptr(ret_copy, true);
7163         return ret_ref;
7164 }
7165
7166 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
7167 CHECK(owner->result_ok);
7168         return *owner->contents.result;
7169 }
7170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7171         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
7172         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
7173 }
7174
7175 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
7176 CHECK(!owner->result_ok);
7177         return RetryableSendFailure_clone(&*owner->contents.err);
7178 }
7179 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7180         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
7181         jclass ret_conv = LDKRetryableSendFailure_to_java(env, CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
7182         return ret_conv;
7183 }
7184
7185 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
7186 CHECK(owner->result_ok);
7187         return ThirtyTwoBytes_clone(&*owner->contents.result);
7188 }
7189 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7190         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
7191         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7192         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(owner_conv).data);
7193         return ret_arr;
7194 }
7195
7196 static inline struct LDKPaymentSendFailure CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
7197 CHECK(!owner->result_ok);
7198         return PaymentSendFailure_clone(&*owner->contents.err);
7199 }
7200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7201         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
7202         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
7203         *ret_copy = CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(owner_conv);
7204         int64_t ret_ref = tag_ptr(ret_copy, true);
7205         return ret_ref;
7206 }
7207
7208 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
7209 CHECK(owner->result_ok);
7210         return ThirtyTwoBytes_clone(&*owner->contents.result);
7211 }
7212 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7213         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
7214         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7215         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(owner_conv).data);
7216         return ret_arr;
7217 }
7218
7219 static inline enum LDKRetryableSendFailure CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
7220 CHECK(!owner->result_ok);
7221         return RetryableSendFailure_clone(&*owner->contents.err);
7222 }
7223 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7224         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
7225         jclass ret_conv = LDKRetryableSendFailure_to_java(env, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(owner_conv));
7226         return ret_conv;
7227 }
7228
7229 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
7230         return ThirtyTwoBytes_clone(&owner->a);
7231 }
7232 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7233         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
7234         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7235         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(owner_conv).data);
7236         return ret_arr;
7237 }
7238
7239 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
7240         return ThirtyTwoBytes_clone(&owner->b);
7241 }
7242 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7243         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
7244         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7245         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(owner_conv).data);
7246         return ret_arr;
7247 }
7248
7249 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
7250 CHECK(owner->result_ok);
7251         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
7252 }
7253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7254         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
7255         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
7256         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(owner_conv);
7257         return tag_ptr(ret_conv, true);
7258 }
7259
7260 static inline struct LDKPaymentSendFailure CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
7261 CHECK(!owner->result_ok);
7262         return PaymentSendFailure_clone(&*owner->contents.err);
7263 }
7264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7265         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
7266         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
7267         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(owner_conv);
7268         int64_t ret_ref = tag_ptr(ret_copy, true);
7269         return ret_ref;
7270 }
7271
7272 static inline LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ *orig) {
7273         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ clone bytes"), .datalen = orig->datalen };
7274         for (size_t i = 0; i < ret.datalen; i++) {
7275                 ret.data[i] = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&orig->data[i]);
7276         }
7277         return ret;
7278 }
7279 static jclass LDKProbeSendFailure_RouteNotFound_class = NULL;
7280 static jmethodID LDKProbeSendFailure_RouteNotFound_meth = NULL;
7281 static jclass LDKProbeSendFailure_SendingFailed_class = NULL;
7282 static jmethodID LDKProbeSendFailure_SendingFailed_meth = NULL;
7283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKProbeSendFailure_init (JNIEnv *env, jclass clz) {
7284         LDKProbeSendFailure_RouteNotFound_class =
7285                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKProbeSendFailure$RouteNotFound"));
7286         CHECK(LDKProbeSendFailure_RouteNotFound_class != NULL);
7287         LDKProbeSendFailure_RouteNotFound_meth = (*env)->GetMethodID(env, LDKProbeSendFailure_RouteNotFound_class, "<init>", "()V");
7288         CHECK(LDKProbeSendFailure_RouteNotFound_meth != NULL);
7289         LDKProbeSendFailure_SendingFailed_class =
7290                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKProbeSendFailure$SendingFailed"));
7291         CHECK(LDKProbeSendFailure_SendingFailed_class != NULL);
7292         LDKProbeSendFailure_SendingFailed_meth = (*env)->GetMethodID(env, LDKProbeSendFailure_SendingFailed_class, "<init>", "(J)V");
7293         CHECK(LDKProbeSendFailure_SendingFailed_meth != NULL);
7294 }
7295 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKProbeSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7296         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
7297         switch(obj->tag) {
7298                 case LDKProbeSendFailure_RouteNotFound: {
7299                         return (*env)->NewObject(env, LDKProbeSendFailure_RouteNotFound_class, LDKProbeSendFailure_RouteNotFound_meth);
7300                 }
7301                 case LDKProbeSendFailure_SendingFailed: {
7302                         int64_t sending_failed_ref = tag_ptr(&obj->sending_failed, false);
7303                         return (*env)->NewObject(env, LDKProbeSendFailure_SendingFailed_class, LDKProbeSendFailure_SendingFailed_meth, sending_failed_ref);
7304                 }
7305                 default: abort();
7306         }
7307 }
7308 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
7309 CHECK(owner->result_ok);
7310         return CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(&*owner->contents.result);
7311 }
7312 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7313         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
7314         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(owner_conv);
7315         int64_tArray ret_arr = NULL;
7316         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7317         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7318         for (size_t o = 0; o < ret_var.datalen; o++) {
7319                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
7320                 *ret_conv_40_conv = ret_var.data[o];
7321                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
7322         }
7323         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7324         FREE(ret_var.data);
7325         return ret_arr;
7326 }
7327
7328 static inline struct LDKProbeSendFailure CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
7329 CHECK(!owner->result_ok);
7330         return ProbeSendFailure_clone(&*owner->contents.err);
7331 }
7332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7333         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
7334         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
7335         *ret_copy = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(owner_conv);
7336         int64_t ret_ref = tag_ptr(ret_copy, true);
7337         return ret_ref;
7338 }
7339
7340 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR owner){
7341         return ThirtyTwoBytes_clone(&owner->a);
7342 }
7343 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7344         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(owner);
7345         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7346         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(owner_conv).data);
7347         return ret_arr;
7348 }
7349
7350 static inline struct LDKPublicKey C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR owner){
7351         return owner->b;
7352 }
7353 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7354         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(owner);
7355         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
7356         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(owner_conv).compressed_form);
7357         return ret_arr;
7358 }
7359
7360 static inline LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ *orig) {
7361         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ clone bytes"), .datalen = orig->datalen };
7362         for (size_t i = 0; i < ret.datalen; i++) {
7363                 ret.data[i] = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(&orig->data[i]);
7364         }
7365         return ret;
7366 }
7367 static jclass LDKCOption_StrZ_Some_class = NULL;
7368 static jmethodID LDKCOption_StrZ_Some_meth = NULL;
7369 static jclass LDKCOption_StrZ_None_class = NULL;
7370 static jmethodID LDKCOption_StrZ_None_meth = NULL;
7371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1StrZ_init (JNIEnv *env, jclass clz) {
7372         LDKCOption_StrZ_Some_class =
7373                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_StrZ$Some"));
7374         CHECK(LDKCOption_StrZ_Some_class != NULL);
7375         LDKCOption_StrZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_StrZ_Some_class, "<init>", "(Ljava/lang/String;)V");
7376         CHECK(LDKCOption_StrZ_Some_meth != NULL);
7377         LDKCOption_StrZ_None_class =
7378                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_StrZ$None"));
7379         CHECK(LDKCOption_StrZ_None_class != NULL);
7380         LDKCOption_StrZ_None_meth = (*env)->GetMethodID(env, LDKCOption_StrZ_None_class, "<init>", "()V");
7381         CHECK(LDKCOption_StrZ_None_meth != NULL);
7382 }
7383 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1StrZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7384         LDKCOption_StrZ *obj = (LDKCOption_StrZ*)untag_ptr(ptr);
7385         switch(obj->tag) {
7386                 case LDKCOption_StrZ_Some: {
7387                         LDKStr some_str = obj->some;
7388                         jstring some_conv = str_ref_to_java(env, some_str.chars, some_str.len);
7389                         return (*env)->NewObject(env, LDKCOption_StrZ_Some_class, LDKCOption_StrZ_Some_meth, some_conv);
7390                 }
7391                 case LDKCOption_StrZ_None: {
7392                         return (*env)->NewObject(env, LDKCOption_StrZ_None_class, LDKCOption_StrZ_None_meth);
7393                 }
7394                 default: abort();
7395         }
7396 }
7397 static inline void CResult_NoneBolt12SemanticErrorZ_get_ok(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
7398 CHECK(owner->result_ok);
7399         return *owner->contents.result;
7400 }
7401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7402         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
7403         CResult_NoneBolt12SemanticErrorZ_get_ok(owner_conv);
7404 }
7405
7406 static inline enum LDKBolt12SemanticError CResult_NoneBolt12SemanticErrorZ_get_err(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
7407 CHECK(!owner->result_ok);
7408         return Bolt12SemanticError_clone(&*owner->contents.err);
7409 }
7410 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7411         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
7412         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_NoneBolt12SemanticErrorZ_get_err(owner_conv));
7413         return ret_conv;
7414 }
7415
7416 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
7417 CHECK(owner->result_ok);
7418         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
7419 }
7420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7421         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
7422         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
7423         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(owner_conv);
7424         return tag_ptr(ret_conv, true);
7425 }
7426
7427 static inline void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
7428 CHECK(!owner->result_ok);
7429         return *owner->contents.err;
7430 }
7431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7432         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
7433         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(owner_conv);
7434 }
7435
7436 static jclass LDKOffersMessage_InvoiceRequest_class = NULL;
7437 static jmethodID LDKOffersMessage_InvoiceRequest_meth = NULL;
7438 static jclass LDKOffersMessage_Invoice_class = NULL;
7439 static jmethodID LDKOffersMessage_Invoice_meth = NULL;
7440 static jclass LDKOffersMessage_InvoiceError_class = NULL;
7441 static jmethodID LDKOffersMessage_InvoiceError_meth = NULL;
7442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKOffersMessage_init (JNIEnv *env, jclass clz) {
7443         LDKOffersMessage_InvoiceRequest_class =
7444                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$InvoiceRequest"));
7445         CHECK(LDKOffersMessage_InvoiceRequest_class != NULL);
7446         LDKOffersMessage_InvoiceRequest_meth = (*env)->GetMethodID(env, LDKOffersMessage_InvoiceRequest_class, "<init>", "(J)V");
7447         CHECK(LDKOffersMessage_InvoiceRequest_meth != NULL);
7448         LDKOffersMessage_Invoice_class =
7449                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$Invoice"));
7450         CHECK(LDKOffersMessage_Invoice_class != NULL);
7451         LDKOffersMessage_Invoice_meth = (*env)->GetMethodID(env, LDKOffersMessage_Invoice_class, "<init>", "(J)V");
7452         CHECK(LDKOffersMessage_Invoice_meth != NULL);
7453         LDKOffersMessage_InvoiceError_class =
7454                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$InvoiceError"));
7455         CHECK(LDKOffersMessage_InvoiceError_class != NULL);
7456         LDKOffersMessage_InvoiceError_meth = (*env)->GetMethodID(env, LDKOffersMessage_InvoiceError_class, "<init>", "(J)V");
7457         CHECK(LDKOffersMessage_InvoiceError_meth != NULL);
7458 }
7459 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKOffersMessage_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7460         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
7461         switch(obj->tag) {
7462                 case LDKOffersMessage_InvoiceRequest: {
7463                         LDKInvoiceRequest invoice_request_var = obj->invoice_request;
7464                         int64_t invoice_request_ref = 0;
7465                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
7466                         invoice_request_ref = tag_ptr(invoice_request_var.inner, false);
7467                         return (*env)->NewObject(env, LDKOffersMessage_InvoiceRequest_class, LDKOffersMessage_InvoiceRequest_meth, invoice_request_ref);
7468                 }
7469                 case LDKOffersMessage_Invoice: {
7470                         LDKBolt12Invoice invoice_var = obj->invoice;
7471                         int64_t invoice_ref = 0;
7472                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
7473                         invoice_ref = tag_ptr(invoice_var.inner, false);
7474                         return (*env)->NewObject(env, LDKOffersMessage_Invoice_class, LDKOffersMessage_Invoice_meth, invoice_ref);
7475                 }
7476                 case LDKOffersMessage_InvoiceError: {
7477                         LDKInvoiceError invoice_error_var = obj->invoice_error;
7478                         int64_t invoice_error_ref = 0;
7479                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_error_var);
7480                         invoice_error_ref = tag_ptr(invoice_error_var.inner, false);
7481                         return (*env)->NewObject(env, LDKOffersMessage_InvoiceError_class, LDKOffersMessage_InvoiceError_meth, invoice_error_ref);
7482                 }
7483                 default: abort();
7484         }
7485 }
7486 static jclass LDKCOption_OffersMessageZ_Some_class = NULL;
7487 static jmethodID LDKCOption_OffersMessageZ_Some_meth = NULL;
7488 static jclass LDKCOption_OffersMessageZ_None_class = NULL;
7489 static jmethodID LDKCOption_OffersMessageZ_None_meth = NULL;
7490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1OffersMessageZ_init (JNIEnv *env, jclass clz) {
7491         LDKCOption_OffersMessageZ_Some_class =
7492                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OffersMessageZ$Some"));
7493         CHECK(LDKCOption_OffersMessageZ_Some_class != NULL);
7494         LDKCOption_OffersMessageZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_OffersMessageZ_Some_class, "<init>", "(J)V");
7495         CHECK(LDKCOption_OffersMessageZ_Some_meth != NULL);
7496         LDKCOption_OffersMessageZ_None_class =
7497                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OffersMessageZ$None"));
7498         CHECK(LDKCOption_OffersMessageZ_None_class != NULL);
7499         LDKCOption_OffersMessageZ_None_meth = (*env)->GetMethodID(env, LDKCOption_OffersMessageZ_None_class, "<init>", "()V");
7500         CHECK(LDKCOption_OffersMessageZ_None_meth != NULL);
7501 }
7502 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1OffersMessageZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7503         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
7504         switch(obj->tag) {
7505                 case LDKCOption_OffersMessageZ_Some: {
7506                         int64_t some_ref = tag_ptr(&obj->some, false);
7507                         return (*env)->NewObject(env, LDKCOption_OffersMessageZ_Some_class, LDKCOption_OffersMessageZ_Some_meth, some_ref);
7508                 }
7509                 case LDKCOption_OffersMessageZ_None: {
7510                         return (*env)->NewObject(env, LDKCOption_OffersMessageZ_None_class, LDKCOption_OffersMessageZ_None_meth);
7511                 }
7512                 default: abort();
7513         }
7514 }
7515 static jclass LDKDestination_Node_class = NULL;
7516 static jmethodID LDKDestination_Node_meth = NULL;
7517 static jclass LDKDestination_BlindedPath_class = NULL;
7518 static jmethodID LDKDestination_BlindedPath_meth = NULL;
7519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKDestination_init (JNIEnv *env, jclass clz) {
7520         LDKDestination_Node_class =
7521                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDestination$Node"));
7522         CHECK(LDKDestination_Node_class != NULL);
7523         LDKDestination_Node_meth = (*env)->GetMethodID(env, LDKDestination_Node_class, "<init>", "([B)V");
7524         CHECK(LDKDestination_Node_meth != NULL);
7525         LDKDestination_BlindedPath_class =
7526                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDestination$BlindedPath"));
7527         CHECK(LDKDestination_BlindedPath_class != NULL);
7528         LDKDestination_BlindedPath_meth = (*env)->GetMethodID(env, LDKDestination_BlindedPath_class, "<init>", "(J)V");
7529         CHECK(LDKDestination_BlindedPath_meth != NULL);
7530 }
7531 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7532         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
7533         switch(obj->tag) {
7534                 case LDKDestination_Node: {
7535                         int8_tArray node_arr = (*env)->NewByteArray(env, 33);
7536                         (*env)->SetByteArrayRegion(env, node_arr, 0, 33, obj->node.compressed_form);
7537                         return (*env)->NewObject(env, LDKDestination_Node_class, LDKDestination_Node_meth, node_arr);
7538                 }
7539                 case LDKDestination_BlindedPath: {
7540                         LDKBlindedPath blinded_path_var = obj->blinded_path;
7541                         int64_t blinded_path_ref = 0;
7542                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
7543                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
7544                         return (*env)->NewObject(env, LDKDestination_BlindedPath_class, LDKDestination_BlindedPath_meth, blinded_path_ref);
7545                 }
7546                 default: abort();
7547         }
7548 }
7549 static inline struct LDKOffersMessage C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
7550         return OffersMessage_clone(&owner->a);
7551 }
7552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7553         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
7554         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
7555         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(owner_conv);
7556         int64_t ret_ref = tag_ptr(ret_copy, true);
7557         return ret_ref;
7558 }
7559
7560 static inline struct LDKDestination C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
7561         return Destination_clone(&owner->b);
7562 }
7563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7564         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
7565         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
7566         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(owner_conv);
7567         int64_t ret_ref = tag_ptr(ret_copy, true);
7568         return ret_ref;
7569 }
7570
7571 static inline struct LDKBlindedPath C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
7572         LDKBlindedPath ret = owner->c;
7573         ret.is_owned = false;
7574         return ret;
7575 }
7576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
7577         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
7578         LDKBlindedPath ret_var = C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(owner_conv);
7579         int64_t ret_ref = 0;
7580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7582         return ret_ref;
7583 }
7584
7585 static inline LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ *orig) {
7586         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
7587         for (size_t i = 0; i < ret.datalen; i++) {
7588                 ret.data[i] = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(&orig->data[i]);
7589         }
7590         return ret;
7591 }
7592 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
7593         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
7594         ret.is_owned = false;
7595         return ret;
7596 }
7597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7598         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
7599         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
7600         int64_t ret_ref = 0;
7601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7603         return ret_ref;
7604 }
7605
7606 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
7607 CHECK(!owner->result_ok);
7608         return DecodeError_clone(&*owner->contents.err);
7609 }
7610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7611         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
7612         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7613         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
7614         int64_t ret_ref = tag_ptr(ret_copy, true);
7615         return ret_ref;
7616 }
7617
7618 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
7619         LDKChannelCounterparty ret = *owner->contents.result;
7620         ret.is_owned = false;
7621         return ret;
7622 }
7623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7624         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
7625         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
7626         int64_t ret_ref = 0;
7627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7629         return ret_ref;
7630 }
7631
7632 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
7633 CHECK(!owner->result_ok);
7634         return DecodeError_clone(&*owner->contents.err);
7635 }
7636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7637         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
7638         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7639         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
7640         int64_t ret_ref = tag_ptr(ret_copy, true);
7641         return ret_ref;
7642 }
7643
7644 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
7645         LDKChannelDetails ret = *owner->contents.result;
7646         ret.is_owned = false;
7647         return ret;
7648 }
7649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7650         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
7651         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
7652         int64_t ret_ref = 0;
7653         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7654         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7655         return ret_ref;
7656 }
7657
7658 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
7659 CHECK(!owner->result_ok);
7660         return DecodeError_clone(&*owner->contents.err);
7661 }
7662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7663         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
7664         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7665         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
7666         int64_t ret_ref = tag_ptr(ret_copy, true);
7667         return ret_ref;
7668 }
7669
7670 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
7671         LDKPhantomRouteHints ret = *owner->contents.result;
7672         ret.is_owned = false;
7673         return ret;
7674 }
7675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7676         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
7677         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
7678         int64_t ret_ref = 0;
7679         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7680         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7681         return ret_ref;
7682 }
7683
7684 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
7685 CHECK(!owner->result_ok);
7686         return DecodeError_clone(&*owner->contents.err);
7687 }
7688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7689         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
7690         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7691         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
7692         int64_t ret_ref = tag_ptr(ret_copy, true);
7693         return ret_ref;
7694 }
7695
7696 static inline enum LDKChannelShutdownState CResult_ChannelShutdownStateDecodeErrorZ_get_ok(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
7697 CHECK(owner->result_ok);
7698         return ChannelShutdownState_clone(&*owner->contents.result);
7699 }
7700 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7701         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
7702         jclass ret_conv = LDKChannelShutdownState_to_java(env, CResult_ChannelShutdownStateDecodeErrorZ_get_ok(owner_conv));
7703         return ret_conv;
7704 }
7705
7706 static inline struct LDKDecodeError CResult_ChannelShutdownStateDecodeErrorZ_get_err(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
7707 CHECK(!owner->result_ok);
7708         return DecodeError_clone(&*owner->contents.err);
7709 }
7710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7711         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
7712         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7713         *ret_copy = CResult_ChannelShutdownStateDecodeErrorZ_get_err(owner_conv);
7714         int64_t ret_ref = tag_ptr(ret_copy, true);
7715         return ret_ref;
7716 }
7717
7718 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
7719         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
7720         for (size_t i = 0; i < ret.datalen; i++) {
7721                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
7722         }
7723         return ret;
7724 }
7725 typedef struct LDKWatch_JCalls {
7726         atomic_size_t refcnt;
7727         JavaVM *vm;
7728         jweak o;
7729         jmethodID watch_channel_meth;
7730         jmethodID update_channel_meth;
7731         jmethodID release_pending_monitor_events_meth;
7732 } LDKWatch_JCalls;
7733 static void LDKWatch_JCalls_free(void* this_arg) {
7734         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
7735         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7736                 JNIEnv *env;
7737                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7738                 if (get_jenv_res == JNI_EDETACHED) {
7739                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7740                 } else {
7741                         DO_ASSERT(get_jenv_res == JNI_OK);
7742                 }
7743                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7744                 if (get_jenv_res == JNI_EDETACHED) {
7745                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7746                 }
7747                 FREE(j_calls);
7748         }
7749 }
7750 LDKCResult_ChannelMonitorUpdateStatusNoneZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
7751         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
7752         JNIEnv *env;
7753         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7754         if (get_jenv_res == JNI_EDETACHED) {
7755                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7756         } else {
7757                 DO_ASSERT(get_jenv_res == JNI_OK);
7758         }
7759         LDKOutPoint funding_txo_var = funding_txo;
7760         int64_t funding_txo_ref = 0;
7761         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
7762         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
7763         LDKChannelMonitor monitor_var = monitor;
7764         int64_t monitor_ref = 0;
7765         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
7766         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
7767         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7768         CHECK(obj != NULL);
7769         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
7770         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7771                 (*env)->ExceptionDescribe(env);
7772                 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
7773         }
7774         void* ret_ptr = untag_ptr(ret);
7775         CHECK_ACCESS(ret_ptr);
7776         LDKCResult_ChannelMonitorUpdateStatusNoneZ ret_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(ret_ptr);
7777         FREE(untag_ptr(ret));
7778         if (get_jenv_res == JNI_EDETACHED) {
7779                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7780         }
7781         return ret_conv;
7782 }
7783 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
7784         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
7785         JNIEnv *env;
7786         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7787         if (get_jenv_res == JNI_EDETACHED) {
7788                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7789         } else {
7790                 DO_ASSERT(get_jenv_res == JNI_OK);
7791         }
7792         LDKOutPoint funding_txo_var = funding_txo;
7793         int64_t funding_txo_ref = 0;
7794         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
7795         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
7796         LDKChannelMonitorUpdate update_var = *update;
7797         int64_t update_ref = 0;
7798         update_var = ChannelMonitorUpdate_clone(&update_var);
7799         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
7800         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
7801         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7802         CHECK(obj != NULL);
7803         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
7804         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7805                 (*env)->ExceptionDescribe(env);
7806                 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
7807         }
7808         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
7809         if (get_jenv_res == JNI_EDETACHED) {
7810                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7811         }
7812         return ret_conv;
7813 }
7814 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
7815         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
7816         JNIEnv *env;
7817         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7818         if (get_jenv_res == JNI_EDETACHED) {
7819                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7820         } else {
7821                 DO_ASSERT(get_jenv_res == JNI_OK);
7822         }
7823         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7824         CHECK(obj != NULL);
7825         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
7826         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7827                 (*env)->ExceptionDescribe(env);
7828                 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
7829         }
7830         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
7831         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
7832         if (ret_constr.datalen > 0)
7833                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
7834         else
7835                 ret_constr.data = NULL;
7836         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
7837         for (size_t x = 0; x < ret_constr.datalen; x++) {
7838                 int64_t ret_conv_49 = ret_vals[x];
7839                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
7840                 CHECK_ACCESS(ret_conv_49_ptr);
7841                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
7842                 FREE(untag_ptr(ret_conv_49));
7843                 ret_constr.data[x] = ret_conv_49_conv;
7844         }
7845         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
7846         if (get_jenv_res == JNI_EDETACHED) {
7847                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7848         }
7849         return ret_constr;
7850 }
7851 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
7852         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
7853         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7854 }
7855 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
7856         jclass c = (*env)->GetObjectClass(env, o);
7857         CHECK(c != NULL);
7858         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
7859         atomic_init(&calls->refcnt, 1);
7860         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7861         calls->o = (*env)->NewWeakGlobalRef(env, o);
7862         calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
7863         CHECK(calls->watch_channel_meth != NULL);
7864         calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
7865         CHECK(calls->update_channel_meth != NULL);
7866         calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
7867         CHECK(calls->release_pending_monitor_events_meth != NULL);
7868
7869         LDKWatch ret = {
7870                 .this_arg = (void*) calls,
7871                 .watch_channel = watch_channel_LDKWatch_jcall,
7872                 .update_channel = update_channel_LDKWatch_jcall,
7873                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
7874                 .free = LDKWatch_JCalls_free,
7875         };
7876         return ret;
7877 }
7878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
7879         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
7880         *res_ptr = LDKWatch_init(env, clz, o);
7881         return tag_ptr(res_ptr, true);
7882 }
7883 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) {
7884         void* this_arg_ptr = untag_ptr(this_arg);
7885         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7886         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
7887         LDKOutPoint funding_txo_conv;
7888         funding_txo_conv.inner = untag_ptr(funding_txo);
7889         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
7890         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
7891         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
7892         LDKChannelMonitor monitor_conv;
7893         monitor_conv.inner = untag_ptr(monitor);
7894         monitor_conv.is_owned = ptr_is_owned(monitor);
7895         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
7896         monitor_conv = ChannelMonitor_clone(&monitor_conv);
7897         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
7898         *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
7899         return tag_ptr(ret_conv, true);
7900 }
7901
7902 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) {
7903         void* this_arg_ptr = untag_ptr(this_arg);
7904         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7905         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
7906         LDKOutPoint funding_txo_conv;
7907         funding_txo_conv.inner = untag_ptr(funding_txo);
7908         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
7909         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
7910         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
7911         LDKChannelMonitorUpdate update_conv;
7912         update_conv.inner = untag_ptr(update);
7913         update_conv.is_owned = ptr_is_owned(update);
7914         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
7915         update_conv.is_owned = false;
7916         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
7917         return ret_conv;
7918 }
7919
7920 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
7921         void* this_arg_ptr = untag_ptr(this_arg);
7922         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7923         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
7924         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
7925         int64_tArray ret_arr = NULL;
7926         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7927         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7928         for (size_t x = 0; x < ret_var.datalen; x++) {
7929                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
7930                 *ret_conv_49_conv = ret_var.data[x];
7931                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
7932         }
7933         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7934         FREE(ret_var.data);
7935         return ret_arr;
7936 }
7937
7938 typedef struct LDKBroadcasterInterface_JCalls {
7939         atomic_size_t refcnt;
7940         JavaVM *vm;
7941         jweak o;
7942         jmethodID broadcast_transactions_meth;
7943 } LDKBroadcasterInterface_JCalls;
7944 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
7945         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
7946         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7947                 JNIEnv *env;
7948                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7949                 if (get_jenv_res == JNI_EDETACHED) {
7950                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7951                 } else {
7952                         DO_ASSERT(get_jenv_res == JNI_OK);
7953                 }
7954                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7955                 if (get_jenv_res == JNI_EDETACHED) {
7956                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7957                 }
7958                 FREE(j_calls);
7959         }
7960 }
7961 void broadcast_transactions_LDKBroadcasterInterface_jcall(const void* this_arg, LDKCVec_TransactionZ txs) {
7962         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
7963         JNIEnv *env;
7964         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7965         if (get_jenv_res == JNI_EDETACHED) {
7966                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7967         } else {
7968                 DO_ASSERT(get_jenv_res == JNI_OK);
7969         }
7970         LDKCVec_TransactionZ txs_var = txs;
7971         jobjectArray txs_arr = NULL;
7972         txs_arr = (*env)->NewObjectArray(env, txs_var.datalen, arr_of_B_clz, NULL);
7973         ;
7974         for (size_t i = 0; i < txs_var.datalen; i++) {
7975                 LDKTransaction txs_conv_8_var = txs_var.data[i];
7976                 int8_tArray txs_conv_8_arr = (*env)->NewByteArray(env, txs_conv_8_var.datalen);
7977                 (*env)->SetByteArrayRegion(env, txs_conv_8_arr, 0, txs_conv_8_var.datalen, txs_conv_8_var.data);
7978                 Transaction_free(txs_conv_8_var);
7979                 (*env)->SetObjectArrayElement(env, txs_arr, i, txs_conv_8_arr);
7980         }
7981         
7982         FREE(txs_var.data);
7983         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7984         CHECK(obj != NULL);
7985         (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transactions_meth, txs_arr);
7986         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7987                 (*env)->ExceptionDescribe(env);
7988                 (*env)->FatalError(env, "A call to broadcast_transactions in LDKBroadcasterInterface from rust threw an exception.");
7989         }
7990         if (get_jenv_res == JNI_EDETACHED) {
7991                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7992         }
7993 }
7994 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
7995         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
7996         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7997 }
7998 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
7999         jclass c = (*env)->GetObjectClass(env, o);
8000         CHECK(c != NULL);
8001         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
8002         atomic_init(&calls->refcnt, 1);
8003         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8004         calls->o = (*env)->NewWeakGlobalRef(env, o);
8005         calls->broadcast_transactions_meth = (*env)->GetMethodID(env, c, "broadcast_transactions", "([[B)V");
8006         CHECK(calls->broadcast_transactions_meth != NULL);
8007
8008         LDKBroadcasterInterface ret = {
8009                 .this_arg = (void*) calls,
8010                 .broadcast_transactions = broadcast_transactions_LDKBroadcasterInterface_jcall,
8011                 .free = LDKBroadcasterInterface_JCalls_free,
8012         };
8013         return ret;
8014 }
8015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
8016         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
8017         *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
8018         return tag_ptr(res_ptr, true);
8019 }
8020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transactions(JNIEnv *env, jclass clz, int64_t this_arg, jobjectArray txs) {
8021         void* this_arg_ptr = untag_ptr(this_arg);
8022         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8023         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
8024         LDKCVec_TransactionZ txs_constr;
8025         txs_constr.datalen = (*env)->GetArrayLength(env, txs);
8026         if (txs_constr.datalen > 0)
8027                 txs_constr.data = MALLOC(txs_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
8028         else
8029                 txs_constr.data = NULL;
8030         for (size_t i = 0; i < txs_constr.datalen; i++) {
8031                 int8_tArray txs_conv_8 = (*env)->GetObjectArrayElement(env, txs, i);
8032                 LDKTransaction txs_conv_8_ref;
8033                 txs_conv_8_ref.datalen = (*env)->GetArrayLength(env, txs_conv_8);
8034                 txs_conv_8_ref.data = MALLOC(txs_conv_8_ref.datalen, "LDKTransaction Bytes");
8035                 (*env)->GetByteArrayRegion(env, txs_conv_8, 0, txs_conv_8_ref.datalen, txs_conv_8_ref.data);
8036                 txs_conv_8_ref.data_is_owned = true;
8037                 txs_constr.data[i] = txs_conv_8_ref;
8038         }
8039         (this_arg_conv->broadcast_transactions)(this_arg_conv->this_arg, txs_constr);
8040 }
8041
8042 typedef struct LDKEntropySource_JCalls {
8043         atomic_size_t refcnt;
8044         JavaVM *vm;
8045         jweak o;
8046         jmethodID get_secure_random_bytes_meth;
8047 } LDKEntropySource_JCalls;
8048 static void LDKEntropySource_JCalls_free(void* this_arg) {
8049         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
8050         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8051                 JNIEnv *env;
8052                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8053                 if (get_jenv_res == JNI_EDETACHED) {
8054                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8055                 } else {
8056                         DO_ASSERT(get_jenv_res == JNI_OK);
8057                 }
8058                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8059                 if (get_jenv_res == JNI_EDETACHED) {
8060                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8061                 }
8062                 FREE(j_calls);
8063         }
8064 }
8065 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
8066         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
8067         JNIEnv *env;
8068         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8069         if (get_jenv_res == JNI_EDETACHED) {
8070                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8071         } else {
8072                 DO_ASSERT(get_jenv_res == JNI_OK);
8073         }
8074         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8075         CHECK(obj != NULL);
8076         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
8077         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8078                 (*env)->ExceptionDescribe(env);
8079                 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKEntropySource from rust threw an exception.");
8080         }
8081         LDKThirtyTwoBytes ret_ref;
8082         CHECK((*env)->GetArrayLength(env, ret) == 32);
8083         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
8084         if (get_jenv_res == JNI_EDETACHED) {
8085                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8086         }
8087         return ret_ref;
8088 }
8089 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
8090         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
8091         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8092 }
8093 static inline LDKEntropySource LDKEntropySource_init (JNIEnv *env, jclass clz, jobject o) {
8094         jclass c = (*env)->GetObjectClass(env, o);
8095         CHECK(c != NULL);
8096         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
8097         atomic_init(&calls->refcnt, 1);
8098         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8099         calls->o = (*env)->NewWeakGlobalRef(env, o);
8100         calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
8101         CHECK(calls->get_secure_random_bytes_meth != NULL);
8102
8103         LDKEntropySource ret = {
8104                 .this_arg = (void*) calls,
8105                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
8106                 .free = LDKEntropySource_JCalls_free,
8107         };
8108         return ret;
8109 }
8110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEntropySource_1new(JNIEnv *env, jclass clz, jobject o) {
8111         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
8112         *res_ptr = LDKEntropySource_init(env, clz, o);
8113         return tag_ptr(res_ptr, true);
8114 }
8115 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_EntropySource_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
8116         void* this_arg_ptr = untag_ptr(this_arg);
8117         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8118         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
8119         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8120         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
8121         return ret_arr;
8122 }
8123
8124 static jclass LDKUnsignedGossipMessage_ChannelAnnouncement_class = NULL;
8125 static jmethodID LDKUnsignedGossipMessage_ChannelAnnouncement_meth = NULL;
8126 static jclass LDKUnsignedGossipMessage_ChannelUpdate_class = NULL;
8127 static jmethodID LDKUnsignedGossipMessage_ChannelUpdate_meth = NULL;
8128 static jclass LDKUnsignedGossipMessage_NodeAnnouncement_class = NULL;
8129 static jmethodID LDKUnsignedGossipMessage_NodeAnnouncement_meth = NULL;
8130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKUnsignedGossipMessage_init (JNIEnv *env, jclass clz) {
8131         LDKUnsignedGossipMessage_ChannelAnnouncement_class =
8132                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$ChannelAnnouncement"));
8133         CHECK(LDKUnsignedGossipMessage_ChannelAnnouncement_class != NULL);
8134         LDKUnsignedGossipMessage_ChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_ChannelAnnouncement_class, "<init>", "(J)V");
8135         CHECK(LDKUnsignedGossipMessage_ChannelAnnouncement_meth != NULL);
8136         LDKUnsignedGossipMessage_ChannelUpdate_class =
8137                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$ChannelUpdate"));
8138         CHECK(LDKUnsignedGossipMessage_ChannelUpdate_class != NULL);
8139         LDKUnsignedGossipMessage_ChannelUpdate_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_ChannelUpdate_class, "<init>", "(J)V");
8140         CHECK(LDKUnsignedGossipMessage_ChannelUpdate_meth != NULL);
8141         LDKUnsignedGossipMessage_NodeAnnouncement_class =
8142                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$NodeAnnouncement"));
8143         CHECK(LDKUnsignedGossipMessage_NodeAnnouncement_class != NULL);
8144         LDKUnsignedGossipMessage_NodeAnnouncement_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_NodeAnnouncement_class, "<init>", "(J)V");
8145         CHECK(LDKUnsignedGossipMessage_NodeAnnouncement_meth != NULL);
8146 }
8147 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKUnsignedGossipMessage_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8148         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
8149         switch(obj->tag) {
8150                 case LDKUnsignedGossipMessage_ChannelAnnouncement: {
8151                         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
8152                         int64_t channel_announcement_ref = 0;
8153                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
8154                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
8155                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_ChannelAnnouncement_class, LDKUnsignedGossipMessage_ChannelAnnouncement_meth, channel_announcement_ref);
8156                 }
8157                 case LDKUnsignedGossipMessage_ChannelUpdate: {
8158                         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
8159                         int64_t channel_update_ref = 0;
8160                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
8161                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
8162                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_ChannelUpdate_class, LDKUnsignedGossipMessage_ChannelUpdate_meth, channel_update_ref);
8163                 }
8164                 case LDKUnsignedGossipMessage_NodeAnnouncement: {
8165                         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
8166                         int64_t node_announcement_ref = 0;
8167                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
8168                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
8169                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_NodeAnnouncement_class, LDKUnsignedGossipMessage_NodeAnnouncement_meth, node_announcement_ref);
8170                 }
8171                 default: abort();
8172         }
8173 }
8174 typedef struct LDKNodeSigner_JCalls {
8175         atomic_size_t refcnt;
8176         JavaVM *vm;
8177         jweak o;
8178         jmethodID get_inbound_payment_key_material_meth;
8179         jmethodID get_node_id_meth;
8180         jmethodID ecdh_meth;
8181         jmethodID sign_invoice_meth;
8182         jmethodID sign_bolt12_invoice_request_meth;
8183         jmethodID sign_bolt12_invoice_meth;
8184         jmethodID sign_gossip_message_meth;
8185 } LDKNodeSigner_JCalls;
8186 static void LDKNodeSigner_JCalls_free(void* this_arg) {
8187         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8188         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8189                 JNIEnv *env;
8190                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8191                 if (get_jenv_res == JNI_EDETACHED) {
8192                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8193                 } else {
8194                         DO_ASSERT(get_jenv_res == JNI_OK);
8195                 }
8196                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8197                 if (get_jenv_res == JNI_EDETACHED) {
8198                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8199                 }
8200                 FREE(j_calls);
8201         }
8202 }
8203 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
8204         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8205         JNIEnv *env;
8206         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8207         if (get_jenv_res == JNI_EDETACHED) {
8208                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8209         } else {
8210                 DO_ASSERT(get_jenv_res == JNI_OK);
8211         }
8212         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8213         CHECK(obj != NULL);
8214         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth);
8215         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8216                 (*env)->ExceptionDescribe(env);
8217                 (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKNodeSigner from rust threw an exception.");
8218         }
8219         LDKThirtyTwoBytes ret_ref;
8220         CHECK((*env)->GetArrayLength(env, ret) == 32);
8221         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
8222         if (get_jenv_res == JNI_EDETACHED) {
8223                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8224         }
8225         return ret_ref;
8226 }
8227 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
8228         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8229         JNIEnv *env;
8230         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8231         if (get_jenv_res == JNI_EDETACHED) {
8232                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8233         } else {
8234                 DO_ASSERT(get_jenv_res == JNI_OK);
8235         }
8236         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
8237         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8238         CHECK(obj != NULL);
8239         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_node_id_meth, recipient_conv);
8240         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8241                 (*env)->ExceptionDescribe(env);
8242                 (*env)->FatalError(env, "A call to get_node_id in LDKNodeSigner from rust threw an exception.");
8243         }
8244         void* ret_ptr = untag_ptr(ret);
8245         CHECK_ACCESS(ret_ptr);
8246         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
8247         FREE(untag_ptr(ret));
8248         if (get_jenv_res == JNI_EDETACHED) {
8249                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8250         }
8251         return ret_conv;
8252 }
8253 LDKCResult_ThirtyTwoBytesNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_BigEndianScalarZ tweak) {
8254         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8255         JNIEnv *env;
8256         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8257         if (get_jenv_res == JNI_EDETACHED) {
8258                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8259         } else {
8260                 DO_ASSERT(get_jenv_res == JNI_OK);
8261         }
8262         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
8263         int8_tArray other_key_arr = (*env)->NewByteArray(env, 33);
8264         (*env)->SetByteArrayRegion(env, other_key_arr, 0, 33, other_key.compressed_form);
8265         LDKCOption_BigEndianScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
8266         *tweak_copy = tweak;
8267         int64_t tweak_ref = tag_ptr(tweak_copy, true);
8268         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8269         CHECK(obj != NULL);
8270         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->ecdh_meth, recipient_conv, other_key_arr, tweak_ref);
8271         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8272                 (*env)->ExceptionDescribe(env);
8273                 (*env)->FatalError(env, "A call to ecdh in LDKNodeSigner from rust threw an exception.");
8274         }
8275         void* ret_ptr = untag_ptr(ret);
8276         CHECK_ACCESS(ret_ptr);
8277         LDKCResult_ThirtyTwoBytesNoneZ ret_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(ret_ptr);
8278         FREE(untag_ptr(ret));
8279         if (get_jenv_res == JNI_EDETACHED) {
8280                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8281         }
8282         return ret_conv;
8283 }
8284 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
8285         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8286         JNIEnv *env;
8287         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8288         if (get_jenv_res == JNI_EDETACHED) {
8289                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8290         } else {
8291                 DO_ASSERT(get_jenv_res == JNI_OK);
8292         }
8293         LDKu8slice hrp_bytes_var = hrp_bytes;
8294         int8_tArray hrp_bytes_arr = (*env)->NewByteArray(env, hrp_bytes_var.datalen);
8295         (*env)->SetByteArrayRegion(env, hrp_bytes_arr, 0, hrp_bytes_var.datalen, hrp_bytes_var.data);
8296         LDKCVec_U5Z invoice_data_var = invoice_data;
8297         jobjectArray invoice_data_arr = NULL;
8298         invoice_data_arr = (*env)->NewByteArray(env, invoice_data_var.datalen);
8299         int8_t *invoice_data_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, invoice_data_arr, NULL);
8300         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
8301                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
8302                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
8303         }
8304         (*env)->ReleasePrimitiveArrayCritical(env, invoice_data_arr, invoice_data_arr_ptr, 0);
8305         FREE(invoice_data_var.data);
8306         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
8307         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8308         CHECK(obj != NULL);
8309         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, hrp_bytes_arr, invoice_data_arr, recipient_conv);
8310         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8311                 (*env)->ExceptionDescribe(env);
8312                 (*env)->FatalError(env, "A call to sign_invoice in LDKNodeSigner from rust threw an exception.");
8313         }
8314         void* ret_ptr = untag_ptr(ret);
8315         CHECK_ACCESS(ret_ptr);
8316         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
8317         FREE(untag_ptr(ret));
8318         if (get_jenv_res == JNI_EDETACHED) {
8319                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8320         }
8321         return ret_conv;
8322 }
8323 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_request_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedInvoiceRequest * invoice_request) {
8324         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8325         JNIEnv *env;
8326         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8327         if (get_jenv_res == JNI_EDETACHED) {
8328                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8329         } else {
8330                 DO_ASSERT(get_jenv_res == JNI_OK);
8331         }
8332         LDKUnsignedInvoiceRequest invoice_request_var = *invoice_request;
8333         int64_t invoice_request_ref = 0;
8334         // WARNING: we may need a move here but no clone is available for LDKUnsignedInvoiceRequest
8335         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
8336         invoice_request_ref = tag_ptr(invoice_request_var.inner, invoice_request_var.is_owned);
8337         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8338         CHECK(obj != NULL);
8339         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_bolt12_invoice_request_meth, invoice_request_ref);
8340         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8341                 (*env)->ExceptionDescribe(env);
8342                 (*env)->FatalError(env, "A call to sign_bolt12_invoice_request in LDKNodeSigner from rust threw an exception.");
8343         }
8344         void* ret_ptr = untag_ptr(ret);
8345         CHECK_ACCESS(ret_ptr);
8346         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
8347         FREE(untag_ptr(ret));
8348         if (get_jenv_res == JNI_EDETACHED) {
8349                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8350         }
8351         return ret_conv;
8352 }
8353 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedBolt12Invoice * invoice) {
8354         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8355         JNIEnv *env;
8356         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8357         if (get_jenv_res == JNI_EDETACHED) {
8358                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8359         } else {
8360                 DO_ASSERT(get_jenv_res == JNI_OK);
8361         }
8362         LDKUnsignedBolt12Invoice invoice_var = *invoice;
8363         int64_t invoice_ref = 0;
8364         // WARNING: we may need a move here but no clone is available for LDKUnsignedBolt12Invoice
8365         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
8366         invoice_ref = tag_ptr(invoice_var.inner, invoice_var.is_owned);
8367         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8368         CHECK(obj != NULL);
8369         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_bolt12_invoice_meth, invoice_ref);
8370         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8371                 (*env)->ExceptionDescribe(env);
8372                 (*env)->FatalError(env, "A call to sign_bolt12_invoice in LDKNodeSigner from rust threw an exception.");
8373         }
8374         void* ret_ptr = untag_ptr(ret);
8375         CHECK_ACCESS(ret_ptr);
8376         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
8377         FREE(untag_ptr(ret));
8378         if (get_jenv_res == JNI_EDETACHED) {
8379                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8380         }
8381         return ret_conv;
8382 }
8383 LDKCResult_ECDSASignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
8384         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8385         JNIEnv *env;
8386         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8387         if (get_jenv_res == JNI_EDETACHED) {
8388                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8389         } else {
8390                 DO_ASSERT(get_jenv_res == JNI_OK);
8391         }
8392         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
8393         *msg_copy = msg;
8394         int64_t msg_ref = tag_ptr(msg_copy, true);
8395         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8396         CHECK(obj != NULL);
8397         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_gossip_message_meth, msg_ref);
8398         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8399                 (*env)->ExceptionDescribe(env);
8400                 (*env)->FatalError(env, "A call to sign_gossip_message in LDKNodeSigner from rust threw an exception.");
8401         }
8402         void* ret_ptr = untag_ptr(ret);
8403         CHECK_ACCESS(ret_ptr);
8404         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
8405         FREE(untag_ptr(ret));
8406         if (get_jenv_res == JNI_EDETACHED) {
8407                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8408         }
8409         return ret_conv;
8410 }
8411 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
8412         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
8413         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8414 }
8415 static inline LDKNodeSigner LDKNodeSigner_init (JNIEnv *env, jclass clz, jobject o) {
8416         jclass c = (*env)->GetObjectClass(env, o);
8417         CHECK(c != NULL);
8418         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
8419         atomic_init(&calls->refcnt, 1);
8420         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8421         calls->o = (*env)->NewWeakGlobalRef(env, o);
8422         calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B");
8423         CHECK(calls->get_inbound_payment_key_material_meth != NULL);
8424         calls->get_node_id_meth = (*env)->GetMethodID(env, c, "get_node_id", "(Lorg/ldk/enums/Recipient;)J");
8425         CHECK(calls->get_node_id_meth != NULL);
8426         calls->ecdh_meth = (*env)->GetMethodID(env, c, "ecdh", "(Lorg/ldk/enums/Recipient;[BJ)J");
8427         CHECK(calls->ecdh_meth != NULL);
8428         calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B[BLorg/ldk/enums/Recipient;)J");
8429         CHECK(calls->sign_invoice_meth != NULL);
8430         calls->sign_bolt12_invoice_request_meth = (*env)->GetMethodID(env, c, "sign_bolt12_invoice_request", "(J)J");
8431         CHECK(calls->sign_bolt12_invoice_request_meth != NULL);
8432         calls->sign_bolt12_invoice_meth = (*env)->GetMethodID(env, c, "sign_bolt12_invoice", "(J)J");
8433         CHECK(calls->sign_bolt12_invoice_meth != NULL);
8434         calls->sign_gossip_message_meth = (*env)->GetMethodID(env, c, "sign_gossip_message", "(J)J");
8435         CHECK(calls->sign_gossip_message_meth != NULL);
8436
8437         LDKNodeSigner ret = {
8438                 .this_arg = (void*) calls,
8439                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
8440                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
8441                 .ecdh = ecdh_LDKNodeSigner_jcall,
8442                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
8443                 .sign_bolt12_invoice_request = sign_bolt12_invoice_request_LDKNodeSigner_jcall,
8444                 .sign_bolt12_invoice = sign_bolt12_invoice_LDKNodeSigner_jcall,
8445                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
8446                 .free = LDKNodeSigner_JCalls_free,
8447         };
8448         return ret;
8449 }
8450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKNodeSigner_1new(JNIEnv *env, jclass clz, jobject o) {
8451         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
8452         *res_ptr = LDKNodeSigner_init(env, clz, o);
8453         return tag_ptr(res_ptr, true);
8454 }
8455 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeSigner_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) {
8456         void* this_arg_ptr = untag_ptr(this_arg);
8457         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8458         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8459         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8460         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data);
8461         return ret_arr;
8462 }
8463
8464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient) {
8465         void* this_arg_ptr = untag_ptr(this_arg);
8466         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8467         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8468         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
8469         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
8470         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
8471         return tag_ptr(ret_conv, true);
8472 }
8473
8474 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) {
8475         void* this_arg_ptr = untag_ptr(this_arg);
8476         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8477         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8478         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
8479         LDKPublicKey other_key_ref;
8480         CHECK((*env)->GetArrayLength(env, other_key) == 33);
8481         (*env)->GetByteArrayRegion(env, other_key, 0, 33, other_key_ref.compressed_form);
8482         void* tweak_ptr = untag_ptr(tweak);
8483         CHECK_ACCESS(tweak_ptr);
8484         LDKCOption_BigEndianScalarZ tweak_conv = *(LDKCOption_BigEndianScalarZ*)(tweak_ptr);
8485         tweak_conv = COption_BigEndianScalarZ_clone((LDKCOption_BigEndianScalarZ*)untag_ptr(tweak));
8486         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
8487         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
8488         return tag_ptr(ret_conv, true);
8489 }
8490
8491 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) {
8492         void* this_arg_ptr = untag_ptr(this_arg);
8493         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8494         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8495         LDKu8slice hrp_bytes_ref;
8496         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
8497         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
8498         LDKCVec_U5Z invoice_data_constr;
8499         invoice_data_constr.datalen = (*env)->GetArrayLength(env, invoice_data);
8500         if (invoice_data_constr.datalen > 0)
8501                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
8502         else
8503                 invoice_data_constr.data = NULL;
8504         int8_t* invoice_data_vals = (*env)->GetByteArrayElements (env, invoice_data, NULL);
8505         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
8506                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
8507                 
8508                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
8509         }
8510         (*env)->ReleaseByteArrayElements(env, invoice_data, invoice_data_vals, 0);
8511         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
8512         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
8513         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
8514         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
8515         return tag_ptr(ret_conv, true);
8516 }
8517
8518 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) {
8519         void* this_arg_ptr = untag_ptr(this_arg);
8520         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8521         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8522         LDKUnsignedInvoiceRequest invoice_request_conv;
8523         invoice_request_conv.inner = untag_ptr(invoice_request);
8524         invoice_request_conv.is_owned = ptr_is_owned(invoice_request);
8525         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_conv);
8526         invoice_request_conv.is_owned = false;
8527         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
8528         *ret_conv = (this_arg_conv->sign_bolt12_invoice_request)(this_arg_conv->this_arg, &invoice_request_conv);
8529         return tag_ptr(ret_conv, true);
8530 }
8531
8532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1bolt12_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice) {
8533         void* this_arg_ptr = untag_ptr(this_arg);
8534         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8535         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8536         LDKUnsignedBolt12Invoice invoice_conv;
8537         invoice_conv.inner = untag_ptr(invoice);
8538         invoice_conv.is_owned = ptr_is_owned(invoice);
8539         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
8540         invoice_conv.is_owned = false;
8541         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
8542         *ret_conv = (this_arg_conv->sign_bolt12_invoice)(this_arg_conv->this_arg, &invoice_conv);
8543         return tag_ptr(ret_conv, true);
8544 }
8545
8546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1gossip_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8547         void* this_arg_ptr = untag_ptr(this_arg);
8548         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8549         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8550         void* msg_ptr = untag_ptr(msg);
8551         CHECK_ACCESS(msg_ptr);
8552         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
8553         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
8554         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
8555         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
8556         return tag_ptr(ret_conv, true);
8557 }
8558
8559 typedef struct LDKSignerProvider_JCalls {
8560         atomic_size_t refcnt;
8561         JavaVM *vm;
8562         jweak o;
8563         jmethodID generate_channel_keys_id_meth;
8564         jmethodID derive_channel_signer_meth;
8565         jmethodID read_chan_signer_meth;
8566         jmethodID get_destination_script_meth;
8567         jmethodID get_shutdown_scriptpubkey_meth;
8568 } LDKSignerProvider_JCalls;
8569 static void LDKSignerProvider_JCalls_free(void* this_arg) {
8570         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8571         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8572                 JNIEnv *env;
8573                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8574                 if (get_jenv_res == JNI_EDETACHED) {
8575                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8576                 } else {
8577                         DO_ASSERT(get_jenv_res == JNI_OK);
8578                 }
8579                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8580                 if (get_jenv_res == JNI_EDETACHED) {
8581                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8582                 }
8583                 FREE(j_calls);
8584         }
8585 }
8586 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
8587         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8588         JNIEnv *env;
8589         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8590         if (get_jenv_res == JNI_EDETACHED) {
8591                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8592         } else {
8593                 DO_ASSERT(get_jenv_res == JNI_OK);
8594         }
8595         jboolean inbound_conv = inbound;
8596         int64_t channel_value_satoshis_conv = channel_value_satoshis;
8597         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
8598         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, user_channel_id.le_bytes);
8599         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8600         CHECK(obj != NULL);
8601         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->generate_channel_keys_id_meth, inbound_conv, channel_value_satoshis_conv, user_channel_id_arr);
8602         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8603                 (*env)->ExceptionDescribe(env);
8604                 (*env)->FatalError(env, "A call to generate_channel_keys_id in LDKSignerProvider from rust threw an exception.");
8605         }
8606         LDKThirtyTwoBytes ret_ref;
8607         CHECK((*env)->GetArrayLength(env, ret) == 32);
8608         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
8609         if (get_jenv_res == JNI_EDETACHED) {
8610                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8611         }
8612         return ret_ref;
8613 }
8614 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
8615         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8616         JNIEnv *env;
8617         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8618         if (get_jenv_res == JNI_EDETACHED) {
8619                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8620         } else {
8621                 DO_ASSERT(get_jenv_res == JNI_OK);
8622         }
8623         int64_t channel_value_satoshis_conv = channel_value_satoshis;
8624         int8_tArray channel_keys_id_arr = (*env)->NewByteArray(env, 32);
8625         (*env)->SetByteArrayRegion(env, channel_keys_id_arr, 0, 32, channel_keys_id.data);
8626         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8627         CHECK(obj != NULL);
8628         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->derive_channel_signer_meth, channel_value_satoshis_conv, channel_keys_id_arr);
8629         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8630                 (*env)->ExceptionDescribe(env);
8631                 (*env)->FatalError(env, "A call to derive_channel_signer in LDKSignerProvider from rust threw an exception.");
8632         }
8633         void* ret_ptr = untag_ptr(ret);
8634         CHECK_ACCESS(ret_ptr);
8635         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
8636         FREE(untag_ptr(ret));
8637         if (get_jenv_res == JNI_EDETACHED) {
8638                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8639         }
8640         return ret_conv;
8641 }
8642 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
8643         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8644         JNIEnv *env;
8645         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8646         if (get_jenv_res == JNI_EDETACHED) {
8647                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8648         } else {
8649                 DO_ASSERT(get_jenv_res == JNI_OK);
8650         }
8651         LDKu8slice reader_var = reader;
8652         int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
8653         (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
8654         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8655         CHECK(obj != NULL);
8656         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
8657         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8658                 (*env)->ExceptionDescribe(env);
8659                 (*env)->FatalError(env, "A call to read_chan_signer in LDKSignerProvider from rust threw an exception.");
8660         }
8661         void* ret_ptr = untag_ptr(ret);
8662         CHECK_ACCESS(ret_ptr);
8663         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
8664         FREE(untag_ptr(ret));
8665         if (get_jenv_res == JNI_EDETACHED) {
8666                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8667         }
8668         return ret_conv;
8669 }
8670 LDKCResult_CVec_u8ZNoneZ get_destination_script_LDKSignerProvider_jcall(const void* this_arg) {
8671         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8672         JNIEnv *env;
8673         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8674         if (get_jenv_res == JNI_EDETACHED) {
8675                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8676         } else {
8677                 DO_ASSERT(get_jenv_res == JNI_OK);
8678         }
8679         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8680         CHECK(obj != NULL);
8681         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_destination_script_meth);
8682         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8683                 (*env)->ExceptionDescribe(env);
8684                 (*env)->FatalError(env, "A call to get_destination_script in LDKSignerProvider from rust threw an exception.");
8685         }
8686         void* ret_ptr = untag_ptr(ret);
8687         CHECK_ACCESS(ret_ptr);
8688         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
8689         FREE(untag_ptr(ret));
8690         if (get_jenv_res == JNI_EDETACHED) {
8691                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8692         }
8693         return ret_conv;
8694 }
8695 LDKCResult_ShutdownScriptNoneZ get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
8696         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8697         JNIEnv *env;
8698         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8699         if (get_jenv_res == JNI_EDETACHED) {
8700                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8701         } else {
8702                 DO_ASSERT(get_jenv_res == JNI_OK);
8703         }
8704         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8705         CHECK(obj != NULL);
8706         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
8707         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8708                 (*env)->ExceptionDescribe(env);
8709                 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKSignerProvider from rust threw an exception.");
8710         }
8711         void* ret_ptr = untag_ptr(ret);
8712         CHECK_ACCESS(ret_ptr);
8713         LDKCResult_ShutdownScriptNoneZ ret_conv = *(LDKCResult_ShutdownScriptNoneZ*)(ret_ptr);
8714         FREE(untag_ptr(ret));
8715         if (get_jenv_res == JNI_EDETACHED) {
8716                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8717         }
8718         return ret_conv;
8719 }
8720 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
8721         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
8722         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8723 }
8724 static inline LDKSignerProvider LDKSignerProvider_init (JNIEnv *env, jclass clz, jobject o) {
8725         jclass c = (*env)->GetObjectClass(env, o);
8726         CHECK(c != NULL);
8727         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
8728         atomic_init(&calls->refcnt, 1);
8729         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8730         calls->o = (*env)->NewWeakGlobalRef(env, o);
8731         calls->generate_channel_keys_id_meth = (*env)->GetMethodID(env, c, "generate_channel_keys_id", "(ZJ[B)[B");
8732         CHECK(calls->generate_channel_keys_id_meth != NULL);
8733         calls->derive_channel_signer_meth = (*env)->GetMethodID(env, c, "derive_channel_signer", "(J[B)J");
8734         CHECK(calls->derive_channel_signer_meth != NULL);
8735         calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
8736         CHECK(calls->read_chan_signer_meth != NULL);
8737         calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()J");
8738         CHECK(calls->get_destination_script_meth != NULL);
8739         calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
8740         CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
8741
8742         LDKSignerProvider ret = {
8743                 .this_arg = (void*) calls,
8744                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
8745                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
8746                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
8747                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
8748                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
8749                 .free = LDKSignerProvider_JCalls_free,
8750         };
8751         return ret;
8752 }
8753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSignerProvider_1new(JNIEnv *env, jclass clz, jobject o) {
8754         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
8755         *res_ptr = LDKSignerProvider_init(env, clz, o);
8756         return tag_ptr(res_ptr, true);
8757 }
8758 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) {
8759         void* this_arg_ptr = untag_ptr(this_arg);
8760         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8761         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8762         LDKU128 user_channel_id_ref;
8763         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
8764         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
8765         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8766         (*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);
8767         return ret_arr;
8768 }
8769
8770 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) {
8771         void* this_arg_ptr = untag_ptr(this_arg);
8772         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8773         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8774         LDKThirtyTwoBytes channel_keys_id_ref;
8775         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
8776         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
8777         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
8778         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
8779         return tag_ptr(ret_ret, true);
8780 }
8781
8782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
8783         void* this_arg_ptr = untag_ptr(this_arg);
8784         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8785         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8786         LDKu8slice reader_ref;
8787         reader_ref.datalen = (*env)->GetArrayLength(env, reader);
8788         reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
8789         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
8790         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
8791         (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
8792         return tag_ptr(ret_conv, true);
8793 }
8794
8795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
8796         void* this_arg_ptr = untag_ptr(this_arg);
8797         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8798         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8799         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
8800         *ret_conv = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
8801         return tag_ptr(ret_conv, true);
8802 }
8803
8804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
8805         void* this_arg_ptr = untag_ptr(this_arg);
8806         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8807         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8808         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
8809         *ret_conv = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
8810         return tag_ptr(ret_conv, true);
8811 }
8812
8813 typedef struct LDKFeeEstimator_JCalls {
8814         atomic_size_t refcnt;
8815         JavaVM *vm;
8816         jweak o;
8817         jmethodID get_est_sat_per_1000_weight_meth;
8818 } LDKFeeEstimator_JCalls;
8819 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
8820         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
8821         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8822                 JNIEnv *env;
8823                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8824                 if (get_jenv_res == JNI_EDETACHED) {
8825                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8826                 } else {
8827                         DO_ASSERT(get_jenv_res == JNI_OK);
8828                 }
8829                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8830                 if (get_jenv_res == JNI_EDETACHED) {
8831                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8832                 }
8833                 FREE(j_calls);
8834         }
8835 }
8836 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
8837         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
8838         JNIEnv *env;
8839         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8840         if (get_jenv_res == JNI_EDETACHED) {
8841                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8842         } else {
8843                 DO_ASSERT(get_jenv_res == JNI_OK);
8844         }
8845         jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
8846         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8847         CHECK(obj != NULL);
8848         int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
8849         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8850                 (*env)->ExceptionDescribe(env);
8851                 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
8852         }
8853         if (get_jenv_res == JNI_EDETACHED) {
8854                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8855         }
8856         return ret;
8857 }
8858 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
8859         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
8860         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8861 }
8862 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
8863         jclass c = (*env)->GetObjectClass(env, o);
8864         CHECK(c != NULL);
8865         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
8866         atomic_init(&calls->refcnt, 1);
8867         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8868         calls->o = (*env)->NewWeakGlobalRef(env, o);
8869         calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
8870         CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
8871
8872         LDKFeeEstimator ret = {
8873                 .this_arg = (void*) calls,
8874                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
8875                 .free = LDKFeeEstimator_JCalls_free,
8876         };
8877         return ret;
8878 }
8879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
8880         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
8881         *res_ptr = LDKFeeEstimator_init(env, clz, o);
8882         return tag_ptr(res_ptr, true);
8883 }
8884 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) {
8885         void* this_arg_ptr = untag_ptr(this_arg);
8886         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8887         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
8888         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
8889         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
8890         return ret_conv;
8891 }
8892
8893 typedef struct LDKRouter_JCalls {
8894         atomic_size_t refcnt;
8895         JavaVM *vm;
8896         jweak o;
8897         jmethodID find_route_meth;
8898         jmethodID find_route_with_id_meth;
8899 } LDKRouter_JCalls;
8900 static void LDKRouter_JCalls_free(void* this_arg) {
8901         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
8902         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8903                 JNIEnv *env;
8904                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8905                 if (get_jenv_res == JNI_EDETACHED) {
8906                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8907                 } else {
8908                         DO_ASSERT(get_jenv_res == JNI_OK);
8909                 }
8910                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8911                 if (get_jenv_res == JNI_EDETACHED) {
8912                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8913                 }
8914                 FREE(j_calls);
8915         }
8916 }
8917 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) {
8918         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
8919         JNIEnv *env;
8920         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8921         if (get_jenv_res == JNI_EDETACHED) {
8922                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8923         } else {
8924                 DO_ASSERT(get_jenv_res == JNI_OK);
8925         }
8926         int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
8927         (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
8928         LDKRouteParameters route_params_var = *route_params;
8929         int64_t route_params_ref = 0;
8930         route_params_var = RouteParameters_clone(&route_params_var);
8931         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
8932         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
8933         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
8934         int64_tArray first_hops_arr = NULL;
8935         if (first_hops != NULL) {
8936                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
8937                 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
8938                 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
8939                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
8940                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
8941                         int64_t first_hops_conv_16_ref = 0;
8942                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
8943                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
8944                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
8945                 }
8946                 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
8947         }
8948         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
8949         int64_t inflight_htlcs_ref = 0;
8950         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
8951         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
8952         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8953         CHECK(obj != NULL);
8954         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, route_params_ref, first_hops_arr, inflight_htlcs_ref);
8955         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8956                 (*env)->ExceptionDescribe(env);
8957                 (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception.");
8958         }
8959         void* ret_ptr = untag_ptr(ret);
8960         CHECK_ACCESS(ret_ptr);
8961         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
8962         FREE(untag_ptr(ret));
8963         if (get_jenv_res == JNI_EDETACHED) {
8964                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8965         }
8966         return ret_conv;
8967 }
8968 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) {
8969         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
8970         JNIEnv *env;
8971         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8972         if (get_jenv_res == JNI_EDETACHED) {
8973                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8974         } else {
8975                 DO_ASSERT(get_jenv_res == JNI_OK);
8976         }
8977         int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
8978         (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
8979         LDKRouteParameters route_params_var = *route_params;
8980         int64_t route_params_ref = 0;
8981         route_params_var = RouteParameters_clone(&route_params_var);
8982         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
8983         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
8984         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
8985         int64_tArray first_hops_arr = NULL;
8986         if (first_hops != NULL) {
8987                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
8988                 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
8989                 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
8990                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
8991                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
8992                         int64_t first_hops_conv_16_ref = 0;
8993                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
8994                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
8995                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
8996                 }
8997                 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
8998         }
8999         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
9000         int64_t inflight_htlcs_ref = 0;
9001         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
9002         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
9003         int8_tArray _payment_hash_arr = (*env)->NewByteArray(env, 32);
9004         (*env)->SetByteArrayRegion(env, _payment_hash_arr, 0, 32, _payment_hash.data);
9005         int8_tArray _payment_id_arr = (*env)->NewByteArray(env, 32);
9006         (*env)->SetByteArrayRegion(env, _payment_id_arr, 0, 32, _payment_id.data);
9007         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9008         CHECK(obj != NULL);
9009         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);
9010         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9011                 (*env)->ExceptionDescribe(env);
9012                 (*env)->FatalError(env, "A call to find_route_with_id in LDKRouter from rust threw an exception.");
9013         }
9014         void* ret_ptr = untag_ptr(ret);
9015         CHECK_ACCESS(ret_ptr);
9016         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
9017         FREE(untag_ptr(ret));
9018         if (get_jenv_res == JNI_EDETACHED) {
9019                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9020         }
9021         return ret_conv;
9022 }
9023 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
9024         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
9025         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9026 }
9027 static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o) {
9028         jclass c = (*env)->GetObjectClass(env, o);
9029         CHECK(c != NULL);
9030         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
9031         atomic_init(&calls->refcnt, 1);
9032         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9033         calls->o = (*env)->NewWeakGlobalRef(env, o);
9034         calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[JJ)J");
9035         CHECK(calls->find_route_meth != NULL);
9036         calls->find_route_with_id_meth = (*env)->GetMethodID(env, c, "find_route_with_id", "([BJ[JJ[B[B)J");
9037         CHECK(calls->find_route_with_id_meth != NULL);
9038
9039         LDKRouter ret = {
9040                 .this_arg = (void*) calls,
9041                 .find_route = find_route_LDKRouter_jcall,
9042                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
9043                 .free = LDKRouter_JCalls_free,
9044         };
9045         return ret;
9046 }
9047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o) {
9048         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
9049         *res_ptr = LDKRouter_init(env, clz, o);
9050         return tag_ptr(res_ptr, true);
9051 }
9052 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) {
9053         void* this_arg_ptr = untag_ptr(this_arg);
9054         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9055         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
9056         LDKPublicKey payer_ref;
9057         CHECK((*env)->GetArrayLength(env, payer) == 33);
9058         (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
9059         LDKRouteParameters route_params_conv;
9060         route_params_conv.inner = untag_ptr(route_params);
9061         route_params_conv.is_owned = ptr_is_owned(route_params);
9062         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
9063         route_params_conv.is_owned = false;
9064         LDKCVec_ChannelDetailsZ first_hops_constr;
9065         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
9066         if (first_hops != NULL) {
9067                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
9068                 if (first_hops_constr.datalen > 0)
9069                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
9070                 else
9071                         first_hops_constr.data = NULL;
9072                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
9073                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
9074                         int64_t first_hops_conv_16 = first_hops_vals[q];
9075                         LDKChannelDetails first_hops_conv_16_conv;
9076                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
9077                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
9078                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
9079                         first_hops_conv_16_conv.is_owned = false;
9080                         first_hops_constr.data[q] = first_hops_conv_16_conv;
9081                 }
9082                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
9083                 first_hops_ptr = &first_hops_constr;
9084         }
9085         LDKInFlightHtlcs inflight_htlcs_conv;
9086         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
9087         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
9088         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
9089         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
9090         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9091         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv);
9092         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
9093         return tag_ptr(ret_conv, true);
9094 }
9095
9096 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) {
9097         void* this_arg_ptr = untag_ptr(this_arg);
9098         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9099         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
9100         LDKPublicKey payer_ref;
9101         CHECK((*env)->GetArrayLength(env, payer) == 33);
9102         (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
9103         LDKRouteParameters route_params_conv;
9104         route_params_conv.inner = untag_ptr(route_params);
9105         route_params_conv.is_owned = ptr_is_owned(route_params);
9106         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
9107         route_params_conv.is_owned = false;
9108         LDKCVec_ChannelDetailsZ first_hops_constr;
9109         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
9110         if (first_hops != NULL) {
9111                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
9112                 if (first_hops_constr.datalen > 0)
9113                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
9114                 else
9115                         first_hops_constr.data = NULL;
9116                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
9117                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
9118                         int64_t first_hops_conv_16 = first_hops_vals[q];
9119                         LDKChannelDetails first_hops_conv_16_conv;
9120                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
9121                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
9122                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
9123                         first_hops_conv_16_conv.is_owned = false;
9124                         first_hops_constr.data[q] = first_hops_conv_16_conv;
9125                 }
9126                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
9127                 first_hops_ptr = &first_hops_constr;
9128         }
9129         LDKInFlightHtlcs inflight_htlcs_conv;
9130         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
9131         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
9132         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
9133         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
9134         LDKThirtyTwoBytes _payment_hash_ref;
9135         CHECK((*env)->GetArrayLength(env, _payment_hash) == 32);
9136         (*env)->GetByteArrayRegion(env, _payment_hash, 0, 32, _payment_hash_ref.data);
9137         LDKThirtyTwoBytes _payment_id_ref;
9138         CHECK((*env)->GetArrayLength(env, _payment_id) == 32);
9139         (*env)->GetByteArrayRegion(env, _payment_id, 0, 32, _payment_id_ref.data);
9140         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9141         *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);
9142         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
9143         return tag_ptr(ret_conv, true);
9144 }
9145
9146 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
9147         return ThirtyTwoBytes_clone(&owner->a);
9148 }
9149 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9150         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
9151         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9152         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(owner_conv).data);
9153         return ret_arr;
9154 }
9155
9156 static inline struct LDKChannelManager C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
9157         LDKChannelManager ret = owner->b;
9158         ret.is_owned = false;
9159         return ret;
9160 }
9161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9162         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
9163         LDKChannelManager ret_var = C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(owner_conv);
9164         int64_t ret_ref = 0;
9165         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9166         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9167         return ret_ref;
9168 }
9169
9170 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
9171 CHECK(owner->result_ok);
9172         return &*owner->contents.result;
9173 }
9174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9175         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
9176         int64_t ret_ret = tag_ptr(CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
9177         return ret_ret;
9178 }
9179
9180 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
9181 CHECK(!owner->result_ok);
9182         return DecodeError_clone(&*owner->contents.err);
9183 }
9184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9185         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
9186         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9187         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(owner_conv);
9188         int64_t ret_ref = tag_ptr(ret_copy, true);
9189         return ret_ref;
9190 }
9191
9192 static jclass LDKMaxDustHTLCExposure_FixedLimitMsat_class = NULL;
9193 static jmethodID LDKMaxDustHTLCExposure_FixedLimitMsat_meth = NULL;
9194 static jclass LDKMaxDustHTLCExposure_FeeRateMultiplier_class = NULL;
9195 static jmethodID LDKMaxDustHTLCExposure_FeeRateMultiplier_meth = NULL;
9196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMaxDustHTLCExposure_init (JNIEnv *env, jclass clz) {
9197         LDKMaxDustHTLCExposure_FixedLimitMsat_class =
9198                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMaxDustHTLCExposure$FixedLimitMsat"));
9199         CHECK(LDKMaxDustHTLCExposure_FixedLimitMsat_class != NULL);
9200         LDKMaxDustHTLCExposure_FixedLimitMsat_meth = (*env)->GetMethodID(env, LDKMaxDustHTLCExposure_FixedLimitMsat_class, "<init>", "(J)V");
9201         CHECK(LDKMaxDustHTLCExposure_FixedLimitMsat_meth != NULL);
9202         LDKMaxDustHTLCExposure_FeeRateMultiplier_class =
9203                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMaxDustHTLCExposure$FeeRateMultiplier"));
9204         CHECK(LDKMaxDustHTLCExposure_FeeRateMultiplier_class != NULL);
9205         LDKMaxDustHTLCExposure_FeeRateMultiplier_meth = (*env)->GetMethodID(env, LDKMaxDustHTLCExposure_FeeRateMultiplier_class, "<init>", "(J)V");
9206         CHECK(LDKMaxDustHTLCExposure_FeeRateMultiplier_meth != NULL);
9207 }
9208 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMaxDustHTLCExposure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9209         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
9210         switch(obj->tag) {
9211                 case LDKMaxDustHTLCExposure_FixedLimitMsat: {
9212                         int64_t fixed_limit_msat_conv = obj->fixed_limit_msat;
9213                         return (*env)->NewObject(env, LDKMaxDustHTLCExposure_FixedLimitMsat_class, LDKMaxDustHTLCExposure_FixedLimitMsat_meth, fixed_limit_msat_conv);
9214                 }
9215                 case LDKMaxDustHTLCExposure_FeeRateMultiplier: {
9216                         int64_t fee_rate_multiplier_conv = obj->fee_rate_multiplier;
9217                         return (*env)->NewObject(env, LDKMaxDustHTLCExposure_FeeRateMultiplier_class, LDKMaxDustHTLCExposure_FeeRateMultiplier_meth, fee_rate_multiplier_conv);
9218                 }
9219                 default: abort();
9220         }
9221 }
9222 static inline struct LDKMaxDustHTLCExposure CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
9223 CHECK(owner->result_ok);
9224         return MaxDustHTLCExposure_clone(&*owner->contents.result);
9225 }
9226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9227         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
9228         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
9229         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(owner_conv);
9230         int64_t ret_ref = tag_ptr(ret_copy, true);
9231         return ret_ref;
9232 }
9233
9234 static inline struct LDKDecodeError CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
9235 CHECK(!owner->result_ok);
9236         return DecodeError_clone(&*owner->contents.err);
9237 }
9238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9239         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
9240         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9241         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(owner_conv);
9242         int64_t ret_ref = tag_ptr(ret_copy, true);
9243         return ret_ref;
9244 }
9245
9246 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
9247         LDKChannelConfig ret = *owner->contents.result;
9248         ret.is_owned = false;
9249         return ret;
9250 }
9251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9252         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
9253         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
9254         int64_t ret_ref = 0;
9255         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9256         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9257         return ret_ref;
9258 }
9259
9260 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
9261 CHECK(!owner->result_ok);
9262         return DecodeError_clone(&*owner->contents.err);
9263 }
9264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9265         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
9266         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9267         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
9268         int64_t ret_ref = tag_ptr(ret_copy, true);
9269         return ret_ref;
9270 }
9271
9272 static jclass LDKCOption_MaxDustHTLCExposureZ_Some_class = NULL;
9273 static jmethodID LDKCOption_MaxDustHTLCExposureZ_Some_meth = NULL;
9274 static jclass LDKCOption_MaxDustHTLCExposureZ_None_class = NULL;
9275 static jmethodID LDKCOption_MaxDustHTLCExposureZ_None_meth = NULL;
9276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MaxDustHTLCExposureZ_init (JNIEnv *env, jclass clz) {
9277         LDKCOption_MaxDustHTLCExposureZ_Some_class =
9278                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MaxDustHTLCExposureZ$Some"));
9279         CHECK(LDKCOption_MaxDustHTLCExposureZ_Some_class != NULL);
9280         LDKCOption_MaxDustHTLCExposureZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MaxDustHTLCExposureZ_Some_class, "<init>", "(J)V");
9281         CHECK(LDKCOption_MaxDustHTLCExposureZ_Some_meth != NULL);
9282         LDKCOption_MaxDustHTLCExposureZ_None_class =
9283                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MaxDustHTLCExposureZ$None"));
9284         CHECK(LDKCOption_MaxDustHTLCExposureZ_None_class != NULL);
9285         LDKCOption_MaxDustHTLCExposureZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MaxDustHTLCExposureZ_None_class, "<init>", "()V");
9286         CHECK(LDKCOption_MaxDustHTLCExposureZ_None_meth != NULL);
9287 }
9288 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MaxDustHTLCExposureZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9289         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
9290         switch(obj->tag) {
9291                 case LDKCOption_MaxDustHTLCExposureZ_Some: {
9292                         int64_t some_ref = tag_ptr(&obj->some, false);
9293                         return (*env)->NewObject(env, LDKCOption_MaxDustHTLCExposureZ_Some_class, LDKCOption_MaxDustHTLCExposureZ_Some_meth, some_ref);
9294                 }
9295                 case LDKCOption_MaxDustHTLCExposureZ_None: {
9296                         return (*env)->NewObject(env, LDKCOption_MaxDustHTLCExposureZ_None_class, LDKCOption_MaxDustHTLCExposureZ_None_meth);
9297                 }
9298                 default: abort();
9299         }
9300 }
9301 static jclass LDKCOption_APIErrorZ_Some_class = NULL;
9302 static jmethodID LDKCOption_APIErrorZ_Some_meth = NULL;
9303 static jclass LDKCOption_APIErrorZ_None_class = NULL;
9304 static jmethodID LDKCOption_APIErrorZ_None_meth = NULL;
9305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1APIErrorZ_init (JNIEnv *env, jclass clz) {
9306         LDKCOption_APIErrorZ_Some_class =
9307                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_APIErrorZ$Some"));
9308         CHECK(LDKCOption_APIErrorZ_Some_class != NULL);
9309         LDKCOption_APIErrorZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_APIErrorZ_Some_class, "<init>", "(J)V");
9310         CHECK(LDKCOption_APIErrorZ_Some_meth != NULL);
9311         LDKCOption_APIErrorZ_None_class =
9312                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_APIErrorZ$None"));
9313         CHECK(LDKCOption_APIErrorZ_None_class != NULL);
9314         LDKCOption_APIErrorZ_None_meth = (*env)->GetMethodID(env, LDKCOption_APIErrorZ_None_class, "<init>", "()V");
9315         CHECK(LDKCOption_APIErrorZ_None_meth != NULL);
9316 }
9317 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1APIErrorZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9318         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
9319         switch(obj->tag) {
9320                 case LDKCOption_APIErrorZ_Some: {
9321                         int64_t some_ref = tag_ptr(&obj->some, false);
9322                         return (*env)->NewObject(env, LDKCOption_APIErrorZ_Some_class, LDKCOption_APIErrorZ_Some_meth, some_ref);
9323                 }
9324                 case LDKCOption_APIErrorZ_None: {
9325                         return (*env)->NewObject(env, LDKCOption_APIErrorZ_None_class, LDKCOption_APIErrorZ_None_meth);
9326                 }
9327                 default: abort();
9328         }
9329 }
9330 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
9331 CHECK(owner->result_ok);
9332         return COption_APIErrorZ_clone(&*owner->contents.result);
9333 }
9334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9335         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
9336         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
9337         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
9338         int64_t ret_ref = tag_ptr(ret_copy, true);
9339         return ret_ref;
9340 }
9341
9342 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
9343 CHECK(!owner->result_ok);
9344         return DecodeError_clone(&*owner->contents.err);
9345 }
9346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9347         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
9348         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9349         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
9350         int64_t ret_ref = tag_ptr(ret_copy, true);
9351         return ret_ref;
9352 }
9353
9354 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
9355         LDKChannelMonitorUpdate ret = *owner->contents.result;
9356         ret.is_owned = false;
9357         return ret;
9358 }
9359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9360         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
9361         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
9362         int64_t ret_ref = 0;
9363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9365         return ret_ref;
9366 }
9367
9368 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
9369 CHECK(!owner->result_ok);
9370         return DecodeError_clone(&*owner->contents.err);
9371 }
9372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9373         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
9374         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9375         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
9376         int64_t ret_ref = tag_ptr(ret_copy, true);
9377         return ret_ref;
9378 }
9379
9380 static jclass LDKCOption_MonitorEventZ_Some_class = NULL;
9381 static jmethodID LDKCOption_MonitorEventZ_Some_meth = NULL;
9382 static jclass LDKCOption_MonitorEventZ_None_class = NULL;
9383 static jmethodID LDKCOption_MonitorEventZ_None_meth = NULL;
9384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MonitorEventZ_init (JNIEnv *env, jclass clz) {
9385         LDKCOption_MonitorEventZ_Some_class =
9386                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$Some"));
9387         CHECK(LDKCOption_MonitorEventZ_Some_class != NULL);
9388         LDKCOption_MonitorEventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_Some_class, "<init>", "(J)V");
9389         CHECK(LDKCOption_MonitorEventZ_Some_meth != NULL);
9390         LDKCOption_MonitorEventZ_None_class =
9391                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$None"));
9392         CHECK(LDKCOption_MonitorEventZ_None_class != NULL);
9393         LDKCOption_MonitorEventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_None_class, "<init>", "()V");
9394         CHECK(LDKCOption_MonitorEventZ_None_meth != NULL);
9395 }
9396 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MonitorEventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9397         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
9398         switch(obj->tag) {
9399                 case LDKCOption_MonitorEventZ_Some: {
9400                         int64_t some_ref = tag_ptr(&obj->some, false);
9401                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_Some_class, LDKCOption_MonitorEventZ_Some_meth, some_ref);
9402                 }
9403                 case LDKCOption_MonitorEventZ_None: {
9404                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_None_class, LDKCOption_MonitorEventZ_None_meth);
9405                 }
9406                 default: abort();
9407         }
9408 }
9409 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
9410 CHECK(owner->result_ok);
9411         return COption_MonitorEventZ_clone(&*owner->contents.result);
9412 }
9413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9414         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
9415         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
9416         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
9417         int64_t ret_ref = tag_ptr(ret_copy, true);
9418         return ret_ref;
9419 }
9420
9421 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
9422 CHECK(!owner->result_ok);
9423         return DecodeError_clone(&*owner->contents.err);
9424 }
9425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9426         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
9427         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9428         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
9429         int64_t ret_ref = tag_ptr(ret_copy, true);
9430         return ret_ref;
9431 }
9432
9433 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
9434         LDKHTLCUpdate ret = *owner->contents.result;
9435         ret.is_owned = false;
9436         return ret;
9437 }
9438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9439         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
9440         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
9441         int64_t ret_ref = 0;
9442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9444         return ret_ref;
9445 }
9446
9447 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
9448 CHECK(!owner->result_ok);
9449         return DecodeError_clone(&*owner->contents.err);
9450 }
9451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9452         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
9453         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9454         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
9455         int64_t ret_ref = tag_ptr(ret_copy, true);
9456         return ret_ref;
9457 }
9458
9459 static inline struct LDKOutPoint C2Tuple_OutPointCVec_u8ZZ_get_a(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
9460         LDKOutPoint ret = owner->a;
9461         ret.is_owned = false;
9462         return ret;
9463 }
9464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9465         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
9466         LDKOutPoint ret_var = C2Tuple_OutPointCVec_u8ZZ_get_a(owner_conv);
9467         int64_t ret_ref = 0;
9468         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9469         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9470         return ret_ref;
9471 }
9472
9473 static inline struct LDKCVec_u8Z C2Tuple_OutPointCVec_u8ZZ_get_b(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
9474         return CVec_u8Z_clone(&owner->b);
9475 }
9476 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9477         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
9478         LDKCVec_u8Z ret_var = C2Tuple_OutPointCVec_u8ZZ_get_b(owner_conv);
9479         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
9480         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
9481         CVec_u8Z_free(ret_var);
9482         return ret_arr;
9483 }
9484
9485 static inline uint32_t C2Tuple_u32CVec_u8ZZ_get_a(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
9486         return owner->a;
9487 }
9488 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9489         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
9490         int32_t ret_conv = C2Tuple_u32CVec_u8ZZ_get_a(owner_conv);
9491         return ret_conv;
9492 }
9493
9494 static inline struct LDKCVec_u8Z C2Tuple_u32CVec_u8ZZ_get_b(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
9495         return CVec_u8Z_clone(&owner->b);
9496 }
9497 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9498         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
9499         LDKCVec_u8Z ret_var = C2Tuple_u32CVec_u8ZZ_get_b(owner_conv);
9500         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
9501         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
9502         CVec_u8Z_free(ret_var);
9503         return ret_arr;
9504 }
9505
9506 static inline LDKCVec_C2Tuple_u32CVec_u8ZZZ CVec_C2Tuple_u32CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u32CVec_u8ZZZ *orig) {
9507         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u32CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
9508         for (size_t i = 0; i < ret.datalen; i++) {
9509                 ret.data[i] = C2Tuple_u32CVec_u8ZZ_clone(&orig->data[i]);
9510         }
9511         return ret;
9512 }
9513 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
9514         return ThirtyTwoBytes_clone(&owner->a);
9515 }
9516 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9517         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
9518         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9519         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(owner_conv).data);
9520         return ret_arr;
9521 }
9522
9523 static inline struct LDKCVec_C2Tuple_u32CVec_u8ZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
9524         return CVec_C2Tuple_u32CVec_u8ZZZ_clone(&owner->b);
9525 }
9526 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9527         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
9528         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(owner_conv);
9529         int64_tArray ret_arr = NULL;
9530         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9531         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9532         for (size_t x = 0; x < ret_var.datalen; x++) {
9533                 LDKC2Tuple_u32CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
9534                 *ret_conv_23_conv = ret_var.data[x];
9535                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
9536         }
9537         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9538         FREE(ret_var.data);
9539         return ret_arr;
9540 }
9541
9542 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ *orig) {
9543         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 };
9544         for (size_t i = 0; i < ret.datalen; i++) {
9545                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(&orig->data[i]);
9546         }
9547         return ret;
9548 }
9549 static inline LDKCVec_CommitmentTransactionZ CVec_CommitmentTransactionZ_clone(const LDKCVec_CommitmentTransactionZ *orig) {
9550         LDKCVec_CommitmentTransactionZ ret = { .data = MALLOC(sizeof(LDKCommitmentTransaction) * orig->datalen, "LDKCVec_CommitmentTransactionZ clone bytes"), .datalen = orig->datalen };
9551         for (size_t i = 0; i < ret.datalen; i++) {
9552                 ret.data[i] = CommitmentTransaction_clone(&orig->data[i]);
9553         }
9554         return ret;
9555 }
9556 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
9557         return owner->a;
9558 }
9559 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9560         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
9561         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
9562         return ret_conv;
9563 }
9564
9565 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
9566         return TxOut_clone(&owner->b);
9567 }
9568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9569         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
9570         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
9571         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
9572         return tag_ptr(ret_ref, true);
9573 }
9574
9575 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
9576         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
9577         for (size_t i = 0; i < ret.datalen; i++) {
9578                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
9579         }
9580         return ret;
9581 }
9582 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
9583         return ThirtyTwoBytes_clone(&owner->a);
9584 }
9585 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9586         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
9587         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9588         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data);
9589         return ret_arr;
9590 }
9591
9592 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
9593         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
9594 }
9595 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9596         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
9597         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
9598         int64_tArray ret_arr = NULL;
9599         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9600         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9601         for (size_t u = 0; u < ret_var.datalen; u++) {
9602                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
9603                 *ret_conv_20_conv = ret_var.data[u];
9604                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
9605         }
9606         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9607         FREE(ret_var.data);
9608         return ret_arr;
9609 }
9610
9611 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ *orig) {
9612         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 };
9613         for (size_t i = 0; i < ret.datalen; i++) {
9614                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
9615         }
9616         return ret;
9617 }
9618 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
9619 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
9620 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
9621 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
9622 static jclass LDKBalance_ContentiousClaimable_class = NULL;
9623 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
9624 static jclass LDKBalance_MaybeTimeoutClaimableHTLC_class = NULL;
9625 static jmethodID LDKBalance_MaybeTimeoutClaimableHTLC_meth = NULL;
9626 static jclass LDKBalance_MaybePreimageClaimableHTLC_class = NULL;
9627 static jmethodID LDKBalance_MaybePreimageClaimableHTLC_meth = NULL;
9628 static jclass LDKBalance_CounterpartyRevokedOutputClaimable_class = NULL;
9629 static jmethodID LDKBalance_CounterpartyRevokedOutputClaimable_meth = NULL;
9630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
9631         LDKBalance_ClaimableOnChannelClose_class =
9632                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose"));
9633         CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
9634         LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
9635         CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
9636         LDKBalance_ClaimableAwaitingConfirmations_class =
9637                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations"));
9638         CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
9639         LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
9640         CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
9641         LDKBalance_ContentiousClaimable_class =
9642                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ContentiousClaimable"));
9643         CHECK(LDKBalance_ContentiousClaimable_class != NULL);
9644         LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI[B[B)V");
9645         CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
9646         LDKBalance_MaybeTimeoutClaimableHTLC_class =
9647                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybeTimeoutClaimableHTLC"));
9648         CHECK(LDKBalance_MaybeTimeoutClaimableHTLC_class != NULL);
9649         LDKBalance_MaybeTimeoutClaimableHTLC_meth = (*env)->GetMethodID(env, LDKBalance_MaybeTimeoutClaimableHTLC_class, "<init>", "(JI[B)V");
9650         CHECK(LDKBalance_MaybeTimeoutClaimableHTLC_meth != NULL);
9651         LDKBalance_MaybePreimageClaimableHTLC_class =
9652                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybePreimageClaimableHTLC"));
9653         CHECK(LDKBalance_MaybePreimageClaimableHTLC_class != NULL);
9654         LDKBalance_MaybePreimageClaimableHTLC_meth = (*env)->GetMethodID(env, LDKBalance_MaybePreimageClaimableHTLC_class, "<init>", "(JI[B)V");
9655         CHECK(LDKBalance_MaybePreimageClaimableHTLC_meth != NULL);
9656         LDKBalance_CounterpartyRevokedOutputClaimable_class =
9657                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$CounterpartyRevokedOutputClaimable"));
9658         CHECK(LDKBalance_CounterpartyRevokedOutputClaimable_class != NULL);
9659         LDKBalance_CounterpartyRevokedOutputClaimable_meth = (*env)->GetMethodID(env, LDKBalance_CounterpartyRevokedOutputClaimable_class, "<init>", "(J)V");
9660         CHECK(LDKBalance_CounterpartyRevokedOutputClaimable_meth != NULL);
9661 }
9662 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9663         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
9664         switch(obj->tag) {
9665                 case LDKBalance_ClaimableOnChannelClose: {
9666                         int64_t amount_satoshis_conv = obj->claimable_on_channel_close.amount_satoshis;
9667                         return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, amount_satoshis_conv);
9668                 }
9669                 case LDKBalance_ClaimableAwaitingConfirmations: {
9670                         int64_t amount_satoshis_conv = obj->claimable_awaiting_confirmations.amount_satoshis;
9671                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
9672                         return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, amount_satoshis_conv, confirmation_height_conv);
9673                 }
9674                 case LDKBalance_ContentiousClaimable: {
9675                         int64_t amount_satoshis_conv = obj->contentious_claimable.amount_satoshis;
9676                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
9677                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
9678                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->contentious_claimable.payment_hash.data);
9679                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
9680                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->contentious_claimable.payment_preimage.data);
9681                         return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, amount_satoshis_conv, timeout_height_conv, payment_hash_arr, payment_preimage_arr);
9682                 }
9683                 case LDKBalance_MaybeTimeoutClaimableHTLC: {
9684                         int64_t amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.amount_satoshis;
9685                         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
9686                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
9687                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->maybe_timeout_claimable_htlc.payment_hash.data);
9688                         return (*env)->NewObject(env, LDKBalance_MaybeTimeoutClaimableHTLC_class, LDKBalance_MaybeTimeoutClaimableHTLC_meth, amount_satoshis_conv, claimable_height_conv, payment_hash_arr);
9689                 }
9690                 case LDKBalance_MaybePreimageClaimableHTLC: {
9691                         int64_t amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.amount_satoshis;
9692                         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
9693                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
9694                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->maybe_preimage_claimable_htlc.payment_hash.data);
9695                         return (*env)->NewObject(env, LDKBalance_MaybePreimageClaimableHTLC_class, LDKBalance_MaybePreimageClaimableHTLC_meth, amount_satoshis_conv, expiry_height_conv, payment_hash_arr);
9696                 }
9697                 case LDKBalance_CounterpartyRevokedOutputClaimable: {
9698                         int64_t amount_satoshis_conv = obj->counterparty_revoked_output_claimable.amount_satoshis;
9699                         return (*env)->NewObject(env, LDKBalance_CounterpartyRevokedOutputClaimable_class, LDKBalance_CounterpartyRevokedOutputClaimable_meth, amount_satoshis_conv);
9700                 }
9701                 default: abort();
9702         }
9703 }
9704 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
9705         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
9706         for (size_t i = 0; i < ret.datalen; i++) {
9707                 ret.data[i] = Balance_clone(&orig->data[i]);
9708         }
9709         return ret;
9710 }
9711 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
9712         return ThirtyTwoBytes_clone(&owner->a);
9713 }
9714 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9715         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
9716         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9717         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(owner_conv).data);
9718         return ret_arr;
9719 }
9720
9721 static inline struct LDKChannelMonitor C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
9722         LDKChannelMonitor ret = owner->b;
9723         ret.is_owned = false;
9724         return ret;
9725 }
9726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9727         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
9728         LDKChannelMonitor ret_var = C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(owner_conv);
9729         int64_t ret_ref = 0;
9730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9732         return ret_ref;
9733 }
9734
9735 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
9736 CHECK(owner->result_ok);
9737         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
9738 }
9739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9740         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
9741         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
9742         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
9743         return tag_ptr(ret_conv, true);
9744 }
9745
9746 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
9747 CHECK(!owner->result_ok);
9748         return DecodeError_clone(&*owner->contents.err);
9749 }
9750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9751         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
9752         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9753         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(owner_conv);
9754         int64_t ret_ref = tag_ptr(ret_copy, true);
9755         return ret_ref;
9756 }
9757
9758 typedef struct LDKType_JCalls {
9759         atomic_size_t refcnt;
9760         JavaVM *vm;
9761         jweak o;
9762         jmethodID type_id_meth;
9763         jmethodID debug_str_meth;
9764         jmethodID write_meth;
9765 } LDKType_JCalls;
9766 static void LDKType_JCalls_free(void* this_arg) {
9767         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
9768         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9769                 JNIEnv *env;
9770                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9771                 if (get_jenv_res == JNI_EDETACHED) {
9772                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9773                 } else {
9774                         DO_ASSERT(get_jenv_res == JNI_OK);
9775                 }
9776                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9777                 if (get_jenv_res == JNI_EDETACHED) {
9778                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9779                 }
9780                 FREE(j_calls);
9781         }
9782 }
9783 uint16_t type_id_LDKType_jcall(const void* this_arg) {
9784         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
9785         JNIEnv *env;
9786         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9787         if (get_jenv_res == JNI_EDETACHED) {
9788                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9789         } else {
9790                 DO_ASSERT(get_jenv_res == JNI_OK);
9791         }
9792         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9793         CHECK(obj != NULL);
9794         int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
9795         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9796                 (*env)->ExceptionDescribe(env);
9797                 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
9798         }
9799         if (get_jenv_res == JNI_EDETACHED) {
9800                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9801         }
9802         return ret;
9803 }
9804 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
9805         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
9806         JNIEnv *env;
9807         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9808         if (get_jenv_res == JNI_EDETACHED) {
9809                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9810         } else {
9811                 DO_ASSERT(get_jenv_res == JNI_OK);
9812         }
9813         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9814         CHECK(obj != NULL);
9815         jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
9816         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9817                 (*env)->ExceptionDescribe(env);
9818                 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
9819         }
9820         LDKStr ret_conv = java_to_owned_str(env, ret);
9821         if (get_jenv_res == JNI_EDETACHED) {
9822                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9823         }
9824         return ret_conv;
9825 }
9826 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
9827         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
9828         JNIEnv *env;
9829         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9830         if (get_jenv_res == JNI_EDETACHED) {
9831                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9832         } else {
9833                 DO_ASSERT(get_jenv_res == JNI_OK);
9834         }
9835         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9836         CHECK(obj != NULL);
9837         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
9838         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9839                 (*env)->ExceptionDescribe(env);
9840                 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
9841         }
9842         LDKCVec_u8Z ret_ref;
9843         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
9844         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
9845         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
9846         if (get_jenv_res == JNI_EDETACHED) {
9847                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9848         }
9849         return ret_ref;
9850 }
9851 static void LDKType_JCalls_cloned(LDKType* new_obj) {
9852         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
9853         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9854 }
9855 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
9856         jclass c = (*env)->GetObjectClass(env, o);
9857         CHECK(c != NULL);
9858         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
9859         atomic_init(&calls->refcnt, 1);
9860         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9861         calls->o = (*env)->NewWeakGlobalRef(env, o);
9862         calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
9863         CHECK(calls->type_id_meth != NULL);
9864         calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
9865         CHECK(calls->debug_str_meth != NULL);
9866         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
9867         CHECK(calls->write_meth != NULL);
9868
9869         LDKType ret = {
9870                 .this_arg = (void*) calls,
9871                 .type_id = type_id_LDKType_jcall,
9872                 .debug_str = debug_str_LDKType_jcall,
9873                 .write = write_LDKType_jcall,
9874                 .cloned = LDKType_JCalls_cloned,
9875                 .free = LDKType_JCalls_free,
9876         };
9877         return ret;
9878 }
9879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
9880         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
9881         *res_ptr = LDKType_init(env, clz, o);
9882         return tag_ptr(res_ptr, true);
9883 }
9884 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
9885         void* this_arg_ptr = untag_ptr(this_arg);
9886         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9887         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
9888         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
9889         return ret_conv;
9890 }
9891
9892 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
9893         void* this_arg_ptr = untag_ptr(this_arg);
9894         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9895         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
9896         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
9897         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
9898         Str_free(ret_str);
9899         return ret_conv;
9900 }
9901
9902 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
9903         void* this_arg_ptr = untag_ptr(this_arg);
9904         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9905         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
9906         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
9907         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
9908         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
9909         CVec_u8Z_free(ret_var);
9910         return ret_arr;
9911 }
9912
9913 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
9914         return owner->a;
9915 }
9916 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9917         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
9918         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
9919         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form);
9920         return ret_arr;
9921 }
9922
9923 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
9924         return Type_clone(&owner->b);
9925 }
9926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9927         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
9928         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
9929         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
9930         return tag_ptr(ret_ret, true);
9931 }
9932
9933 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
9934         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
9935         for (size_t i = 0; i < ret.datalen; i++) {
9936                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
9937         }
9938         return ret;
9939 }
9940 typedef struct LDKOnionMessageContents_JCalls {
9941         atomic_size_t refcnt;
9942         JavaVM *vm;
9943         jweak o;
9944         jmethodID tlv_type_meth;
9945         jmethodID write_meth;
9946 } LDKOnionMessageContents_JCalls;
9947 static void LDKOnionMessageContents_JCalls_free(void* this_arg) {
9948         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
9949         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9950                 JNIEnv *env;
9951                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9952                 if (get_jenv_res == JNI_EDETACHED) {
9953                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9954                 } else {
9955                         DO_ASSERT(get_jenv_res == JNI_OK);
9956                 }
9957                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9958                 if (get_jenv_res == JNI_EDETACHED) {
9959                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9960                 }
9961                 FREE(j_calls);
9962         }
9963 }
9964 uint64_t tlv_type_LDKOnionMessageContents_jcall(const void* this_arg) {
9965         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
9966         JNIEnv *env;
9967         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9968         if (get_jenv_res == JNI_EDETACHED) {
9969                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9970         } else {
9971                 DO_ASSERT(get_jenv_res == JNI_OK);
9972         }
9973         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9974         CHECK(obj != NULL);
9975         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->tlv_type_meth);
9976         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9977                 (*env)->ExceptionDescribe(env);
9978                 (*env)->FatalError(env, "A call to tlv_type in LDKOnionMessageContents from rust threw an exception.");
9979         }
9980         if (get_jenv_res == JNI_EDETACHED) {
9981                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9982         }
9983         return ret;
9984 }
9985 LDKCVec_u8Z write_LDKOnionMessageContents_jcall(const void* this_arg) {
9986         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
9987         JNIEnv *env;
9988         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9989         if (get_jenv_res == JNI_EDETACHED) {
9990                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9991         } else {
9992                 DO_ASSERT(get_jenv_res == JNI_OK);
9993         }
9994         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9995         CHECK(obj != NULL);
9996         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
9997         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9998                 (*env)->ExceptionDescribe(env);
9999                 (*env)->FatalError(env, "A call to write in LDKOnionMessageContents from rust threw an exception.");
10000         }
10001         LDKCVec_u8Z ret_ref;
10002         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
10003         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
10004         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
10005         if (get_jenv_res == JNI_EDETACHED) {
10006                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10007         }
10008         return ret_ref;
10009 }
10010 static void LDKOnionMessageContents_JCalls_cloned(LDKOnionMessageContents* new_obj) {
10011         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) new_obj->this_arg;
10012         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10013 }
10014 static inline LDKOnionMessageContents LDKOnionMessageContents_init (JNIEnv *env, jclass clz, jobject o) {
10015         jclass c = (*env)->GetObjectClass(env, o);
10016         CHECK(c != NULL);
10017         LDKOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKOnionMessageContents_JCalls), "LDKOnionMessageContents_JCalls");
10018         atomic_init(&calls->refcnt, 1);
10019         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10020         calls->o = (*env)->NewWeakGlobalRef(env, o);
10021         calls->tlv_type_meth = (*env)->GetMethodID(env, c, "tlv_type", "()J");
10022         CHECK(calls->tlv_type_meth != NULL);
10023         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
10024         CHECK(calls->write_meth != NULL);
10025
10026         LDKOnionMessageContents ret = {
10027                 .this_arg = (void*) calls,
10028                 .tlv_type = tlv_type_LDKOnionMessageContents_jcall,
10029                 .write = write_LDKOnionMessageContents_jcall,
10030                 .cloned = LDKOnionMessageContents_JCalls_cloned,
10031                 .free = LDKOnionMessageContents_JCalls_free,
10032         };
10033         return ret;
10034 }
10035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageContents_1new(JNIEnv *env, jclass clz, jobject o) {
10036         LDKOnionMessageContents *res_ptr = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
10037         *res_ptr = LDKOnionMessageContents_init(env, clz, o);
10038         return tag_ptr(res_ptr, true);
10039 }
10040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1tlv_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
10041         void* this_arg_ptr = untag_ptr(this_arg);
10042         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10043         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
10044         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
10045         return ret_conv;
10046 }
10047
10048 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
10049         void* this_arg_ptr = untag_ptr(this_arg);
10050         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10051         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
10052         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
10053         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10054         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10055         CVec_u8Z_free(ret_var);
10056         return ret_arr;
10057 }
10058
10059 static jclass LDKCOption_OnionMessageContentsZ_Some_class = NULL;
10060 static jmethodID LDKCOption_OnionMessageContentsZ_Some_meth = NULL;
10061 static jclass LDKCOption_OnionMessageContentsZ_None_class = NULL;
10062 static jmethodID LDKCOption_OnionMessageContentsZ_None_meth = NULL;
10063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1OnionMessageContentsZ_init (JNIEnv *env, jclass clz) {
10064         LDKCOption_OnionMessageContentsZ_Some_class =
10065                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OnionMessageContentsZ$Some"));
10066         CHECK(LDKCOption_OnionMessageContentsZ_Some_class != NULL);
10067         LDKCOption_OnionMessageContentsZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_OnionMessageContentsZ_Some_class, "<init>", "(J)V");
10068         CHECK(LDKCOption_OnionMessageContentsZ_Some_meth != NULL);
10069         LDKCOption_OnionMessageContentsZ_None_class =
10070                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OnionMessageContentsZ$None"));
10071         CHECK(LDKCOption_OnionMessageContentsZ_None_class != NULL);
10072         LDKCOption_OnionMessageContentsZ_None_meth = (*env)->GetMethodID(env, LDKCOption_OnionMessageContentsZ_None_class, "<init>", "()V");
10073         CHECK(LDKCOption_OnionMessageContentsZ_None_meth != NULL);
10074 }
10075 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1OnionMessageContentsZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10076         LDKCOption_OnionMessageContentsZ *obj = (LDKCOption_OnionMessageContentsZ*)untag_ptr(ptr);
10077         switch(obj->tag) {
10078                 case LDKCOption_OnionMessageContentsZ_Some: {
10079                         LDKOnionMessageContents* some_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
10080                         *some_ret = OnionMessageContents_clone(&obj->some);
10081                         return (*env)->NewObject(env, LDKCOption_OnionMessageContentsZ_Some_class, LDKCOption_OnionMessageContentsZ_Some_meth, tag_ptr(some_ret, true));
10082                 }
10083                 case LDKCOption_OnionMessageContentsZ_None: {
10084                         return (*env)->NewObject(env, LDKCOption_OnionMessageContentsZ_None_class, LDKCOption_OnionMessageContentsZ_None_meth);
10085                 }
10086                 default: abort();
10087         }
10088 }
10089 static inline struct LDKCOption_OnionMessageContentsZ CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
10090 CHECK(owner->result_ok);
10091         return COption_OnionMessageContentsZ_clone(&*owner->contents.result);
10092 }
10093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10094         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
10095         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
10096         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
10097         int64_t ret_ref = tag_ptr(ret_copy, true);
10098         return ret_ref;
10099 }
10100
10101 static inline struct LDKDecodeError CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
10102 CHECK(!owner->result_ok);
10103         return DecodeError_clone(&*owner->contents.err);
10104 }
10105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10106         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
10107         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10108         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
10109         int64_t ret_ref = tag_ptr(ret_copy, true);
10110         return ret_ref;
10111 }
10112
10113 static inline struct LDKOnionMessageContents C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
10114         return OnionMessageContents_clone(&owner->a);
10115 }
10116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10117         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
10118         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
10119         *ret_ret = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(owner_conv);
10120         return tag_ptr(ret_ret, true);
10121 }
10122
10123 static inline struct LDKDestination C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
10124         return Destination_clone(&owner->b);
10125 }
10126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10127         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
10128         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
10129         *ret_copy = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(owner_conv);
10130         int64_t ret_ref = tag_ptr(ret_copy, true);
10131         return ret_ref;
10132 }
10133
10134 static inline struct LDKBlindedPath C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
10135         LDKBlindedPath ret = owner->c;
10136         ret.is_owned = false;
10137         return ret;
10138 }
10139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
10140         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
10141         LDKBlindedPath ret_var = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(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 inline LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ *orig) {
10149         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
10150         for (size_t i = 0; i < ret.datalen; i++) {
10151                 ret.data[i] = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(&orig->data[i]);
10152         }
10153         return ret;
10154 }
10155 static jclass LDKCOption_TypeZ_Some_class = NULL;
10156 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
10157 static jclass LDKCOption_TypeZ_None_class = NULL;
10158 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
10159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
10160         LDKCOption_TypeZ_Some_class =
10161                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$Some"));
10162         CHECK(LDKCOption_TypeZ_Some_class != NULL);
10163         LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
10164         CHECK(LDKCOption_TypeZ_Some_meth != NULL);
10165         LDKCOption_TypeZ_None_class =
10166                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$None"));
10167         CHECK(LDKCOption_TypeZ_None_class != NULL);
10168         LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
10169         CHECK(LDKCOption_TypeZ_None_meth != NULL);
10170 }
10171 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10172         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
10173         switch(obj->tag) {
10174                 case LDKCOption_TypeZ_Some: {
10175                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
10176                         *some_ret = Type_clone(&obj->some);
10177                         return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, tag_ptr(some_ret, true));
10178                 }
10179                 case LDKCOption_TypeZ_None: {
10180                         return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
10181                 }
10182                 default: abort();
10183         }
10184 }
10185 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
10186 CHECK(owner->result_ok);
10187         return COption_TypeZ_clone(&*owner->contents.result);
10188 }
10189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10190         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
10191         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
10192         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
10193         int64_t ret_ref = tag_ptr(ret_copy, true);
10194         return ret_ref;
10195 }
10196
10197 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
10198 CHECK(!owner->result_ok);
10199         return DecodeError_clone(&*owner->contents.err);
10200 }
10201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10202         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
10203         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10204         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
10205         int64_t ret_ref = tag_ptr(ret_copy, true);
10206         return ret_ref;
10207 }
10208
10209 static jclass LDKCOption_SocketAddressZ_Some_class = NULL;
10210 static jmethodID LDKCOption_SocketAddressZ_Some_meth = NULL;
10211 static jclass LDKCOption_SocketAddressZ_None_class = NULL;
10212 static jmethodID LDKCOption_SocketAddressZ_None_meth = NULL;
10213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1SocketAddressZ_init (JNIEnv *env, jclass clz) {
10214         LDKCOption_SocketAddressZ_Some_class =
10215                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SocketAddressZ$Some"));
10216         CHECK(LDKCOption_SocketAddressZ_Some_class != NULL);
10217         LDKCOption_SocketAddressZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_SocketAddressZ_Some_class, "<init>", "(J)V");
10218         CHECK(LDKCOption_SocketAddressZ_Some_meth != NULL);
10219         LDKCOption_SocketAddressZ_None_class =
10220                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SocketAddressZ$None"));
10221         CHECK(LDKCOption_SocketAddressZ_None_class != NULL);
10222         LDKCOption_SocketAddressZ_None_meth = (*env)->GetMethodID(env, LDKCOption_SocketAddressZ_None_class, "<init>", "()V");
10223         CHECK(LDKCOption_SocketAddressZ_None_meth != NULL);
10224 }
10225 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1SocketAddressZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10226         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
10227         switch(obj->tag) {
10228                 case LDKCOption_SocketAddressZ_Some: {
10229                         int64_t some_ref = tag_ptr(&obj->some, false);
10230                         return (*env)->NewObject(env, LDKCOption_SocketAddressZ_Some_class, LDKCOption_SocketAddressZ_Some_meth, some_ref);
10231                 }
10232                 case LDKCOption_SocketAddressZ_None: {
10233                         return (*env)->NewObject(env, LDKCOption_SocketAddressZ_None_class, LDKCOption_SocketAddressZ_None_meth);
10234                 }
10235                 default: abort();
10236         }
10237 }
10238 static inline struct LDKPublicKey C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR owner){
10239         return owner->a;
10240 }
10241 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10242         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(owner);
10243         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
10244         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(owner_conv).compressed_form);
10245         return ret_arr;
10246 }
10247
10248 static inline struct LDKCOption_SocketAddressZ C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR owner){
10249         return COption_SocketAddressZ_clone(&owner->b);
10250 }
10251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10252         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(owner);
10253         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
10254         *ret_copy = C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(owner_conv);
10255         int64_t ret_ref = tag_ptr(ret_copy, true);
10256         return ret_ref;
10257 }
10258
10259 static inline LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ *orig) {
10260         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ clone bytes"), .datalen = orig->datalen };
10261         for (size_t i = 0; i < ret.datalen; i++) {
10262                 ret.data[i] = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(&orig->data[i]);
10263         }
10264         return ret;
10265 }
10266 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
10267 CHECK(owner->result_ok);
10268         return CVec_u8Z_clone(&*owner->contents.result);
10269 }
10270 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10271         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
10272         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
10273         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10274         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10275         CVec_u8Z_free(ret_var);
10276         return ret_arr;
10277 }
10278
10279 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
10280         LDKPeerHandleError ret = *owner->contents.err;
10281         ret.is_owned = false;
10282         return ret;
10283 }
10284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10285         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
10286         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
10287         int64_t ret_ref = 0;
10288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10289         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10290         return ret_ref;
10291 }
10292
10293 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
10294 CHECK(owner->result_ok);
10295         return *owner->contents.result;
10296 }
10297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10298         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
10299         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
10300 }
10301
10302 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
10303         LDKPeerHandleError ret = *owner->contents.err;
10304         ret.is_owned = false;
10305         return ret;
10306 }
10307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10308         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
10309         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
10310         int64_t ret_ref = 0;
10311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10313         return ret_ref;
10314 }
10315
10316 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
10317 CHECK(owner->result_ok);
10318         return *owner->contents.result;
10319 }
10320 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10321         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
10322         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
10323         return ret_conv;
10324 }
10325
10326 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
10327         LDKPeerHandleError ret = *owner->contents.err;
10328         ret.is_owned = false;
10329         return ret;
10330 }
10331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10332         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
10333         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
10334         int64_t ret_ref = 0;
10335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10337         return ret_ref;
10338 }
10339
10340 static jclass LDKGraphSyncError_DecodeError_class = NULL;
10341 static jmethodID LDKGraphSyncError_DecodeError_meth = NULL;
10342 static jclass LDKGraphSyncError_LightningError_class = NULL;
10343 static jmethodID LDKGraphSyncError_LightningError_meth = NULL;
10344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGraphSyncError_init (JNIEnv *env, jclass clz) {
10345         LDKGraphSyncError_DecodeError_class =
10346                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$DecodeError"));
10347         CHECK(LDKGraphSyncError_DecodeError_class != NULL);
10348         LDKGraphSyncError_DecodeError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_DecodeError_class, "<init>", "(J)V");
10349         CHECK(LDKGraphSyncError_DecodeError_meth != NULL);
10350         LDKGraphSyncError_LightningError_class =
10351                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$LightningError"));
10352         CHECK(LDKGraphSyncError_LightningError_class != NULL);
10353         LDKGraphSyncError_LightningError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_LightningError_class, "<init>", "(J)V");
10354         CHECK(LDKGraphSyncError_LightningError_meth != NULL);
10355 }
10356 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGraphSyncError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10357         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
10358         switch(obj->tag) {
10359                 case LDKGraphSyncError_DecodeError: {
10360                         int64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
10361                         return (*env)->NewObject(env, LDKGraphSyncError_DecodeError_class, LDKGraphSyncError_DecodeError_meth, decode_error_ref);
10362                 }
10363                 case LDKGraphSyncError_LightningError: {
10364                         LDKLightningError lightning_error_var = obj->lightning_error;
10365                         int64_t lightning_error_ref = 0;
10366                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
10367                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
10368                         return (*env)->NewObject(env, LDKGraphSyncError_LightningError_class, LDKGraphSyncError_LightningError_meth, lightning_error_ref);
10369                 }
10370                 default: abort();
10371         }
10372 }
10373 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
10374 CHECK(owner->result_ok);
10375         return *owner->contents.result;
10376 }
10377 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10378         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
10379         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
10380         return ret_conv;
10381 }
10382
10383 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
10384 CHECK(!owner->result_ok);
10385         return GraphSyncError_clone(&*owner->contents.err);
10386 }
10387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10388         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
10389         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
10390         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
10391         int64_t ret_ref = tag_ptr(ret_copy, true);
10392         return ret_ref;
10393 }
10394
10395 static inline struct LDKCVec_u8Z CResult_CVec_u8ZIOErrorZ_get_ok(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
10396 CHECK(owner->result_ok);
10397         return CVec_u8Z_clone(&*owner->contents.result);
10398 }
10399 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10400         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
10401         LDKCVec_u8Z ret_var = CResult_CVec_u8ZIOErrorZ_get_ok(owner_conv);
10402         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10403         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10404         CVec_u8Z_free(ret_var);
10405         return ret_arr;
10406 }
10407
10408 static inline enum LDKIOError CResult_CVec_u8ZIOErrorZ_get_err(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
10409 CHECK(!owner->result_ok);
10410         return *owner->contents.err;
10411 }
10412 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10413         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
10414         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_u8ZIOErrorZ_get_err(owner_conv));
10415         return ret_conv;
10416 }
10417
10418 static inline struct LDKCVec_StrZ CResult_CVec_StrZIOErrorZ_get_ok(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
10419 CHECK(owner->result_ok);
10420         return *owner->contents.result;
10421 }
10422 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10423         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
10424         LDKCVec_StrZ ret_var = CResult_CVec_StrZIOErrorZ_get_ok(owner_conv);
10425         jobjectArray ret_arr = NULL;
10426         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, String_clz, NULL);
10427         ;
10428         jstring *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10429         for (size_t i = 0; i < ret_var.datalen; i++) {
10430                 LDKStr ret_conv_8_str = ret_var.data[i];
10431                 jstring ret_conv_8_conv = str_ref_to_java(env, ret_conv_8_str.chars, ret_conv_8_str.len);
10432                 ret_arr_ptr[i] = ret_conv_8_conv;
10433         }
10434         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10435         return ret_arr;
10436 }
10437
10438 static inline enum LDKIOError CResult_CVec_StrZIOErrorZ_get_err(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
10439 CHECK(!owner->result_ok);
10440         return *owner->contents.err;
10441 }
10442 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10443         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
10444         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_StrZIOErrorZ_get_err(owner_conv));
10445         return ret_conv;
10446 }
10447
10448 static inline LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ *orig) {
10449         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
10450         for (size_t i = 0; i < ret.datalen; i++) {
10451                 ret.data[i] = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&orig->data[i]);
10452         }
10453         return ret;
10454 }
10455 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
10456 CHECK(owner->result_ok);
10457         return CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(&*owner->contents.result);
10458 }
10459 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10460         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
10461         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(owner_conv);
10462         int64_tArray ret_arr = NULL;
10463         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10464         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10465         for (size_t o = 0; o < ret_var.datalen; o++) {
10466                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
10467                 *ret_conv_40_conv = ret_var.data[o];
10468                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
10469         }
10470         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10471         FREE(ret_var.data);
10472         return ret_arr;
10473 }
10474
10475 static inline enum LDKIOError CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
10476 CHECK(!owner->result_ok);
10477         return *owner->contents.err;
10478 }
10479 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10480         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
10481         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(owner_conv));
10482         return ret_conv;
10483 }
10484
10485 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
10486 CHECK(owner->result_ok);
10487         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
10488 }
10489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10490         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
10491         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
10492         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(owner_conv);
10493         return tag_ptr(ret_conv, true);
10494 }
10495
10496 static inline enum LDKIOError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
10497 CHECK(!owner->result_ok);
10498         return *owner->contents.err;
10499 }
10500 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10501         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
10502         jclass ret_conv = LDKIOError_to_java(env, CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(owner_conv));
10503         return ret_conv;
10504 }
10505
10506 static jclass LDKCOption_SecretKeyZ_Some_class = NULL;
10507 static jmethodID LDKCOption_SecretKeyZ_Some_meth = NULL;
10508 static jclass LDKCOption_SecretKeyZ_None_class = NULL;
10509 static jmethodID LDKCOption_SecretKeyZ_None_meth = NULL;
10510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1SecretKeyZ_init (JNIEnv *env, jclass clz) {
10511         LDKCOption_SecretKeyZ_Some_class =
10512                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SecretKeyZ$Some"));
10513         CHECK(LDKCOption_SecretKeyZ_Some_class != NULL);
10514         LDKCOption_SecretKeyZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_SecretKeyZ_Some_class, "<init>", "([B)V");
10515         CHECK(LDKCOption_SecretKeyZ_Some_meth != NULL);
10516         LDKCOption_SecretKeyZ_None_class =
10517                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SecretKeyZ$None"));
10518         CHECK(LDKCOption_SecretKeyZ_None_class != NULL);
10519         LDKCOption_SecretKeyZ_None_meth = (*env)->GetMethodID(env, LDKCOption_SecretKeyZ_None_class, "<init>", "()V");
10520         CHECK(LDKCOption_SecretKeyZ_None_meth != NULL);
10521 }
10522 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1SecretKeyZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10523         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
10524         switch(obj->tag) {
10525                 case LDKCOption_SecretKeyZ_Some: {
10526                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
10527                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.bytes);
10528                         return (*env)->NewObject(env, LDKCOption_SecretKeyZ_Some_class, LDKCOption_SecretKeyZ_Some_meth, some_arr);
10529                 }
10530                 case LDKCOption_SecretKeyZ_None: {
10531                         return (*env)->NewObject(env, LDKCOption_SecretKeyZ_None_class, LDKCOption_SecretKeyZ_None_meth);
10532                 }
10533                 default: abort();
10534         }
10535 }
10536 static inline struct LDKVerifiedInvoiceRequest CResult_VerifiedInvoiceRequestNoneZ_get_ok(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
10537         LDKVerifiedInvoiceRequest ret = *owner->contents.result;
10538         ret.is_owned = false;
10539         return ret;
10540 }
10541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10542         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
10543         LDKVerifiedInvoiceRequest ret_var = CResult_VerifiedInvoiceRequestNoneZ_get_ok(owner_conv);
10544         int64_t ret_ref = 0;
10545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10547         return ret_ref;
10548 }
10549
10550 static inline void CResult_VerifiedInvoiceRequestNoneZ_get_err(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
10551 CHECK(!owner->result_ok);
10552         return *owner->contents.err;
10553 }
10554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10555         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
10556         CResult_VerifiedInvoiceRequestNoneZ_get_err(owner_conv);
10557 }
10558
10559 static inline LDKCVec_WitnessZ CVec_WitnessZ_clone(const LDKCVec_WitnessZ *orig) {
10560         LDKCVec_WitnessZ ret = { .data = MALLOC(sizeof(LDKWitness) * orig->datalen, "LDKCVec_WitnessZ clone bytes"), .datalen = orig->datalen };
10561         for (size_t i = 0; i < ret.datalen; i++) {
10562                 ret.data[i] = Witness_clone(&orig->data[i]);
10563         }
10564         return ret;
10565 }
10566 static jclass LDKCOption_i64Z_Some_class = NULL;
10567 static jmethodID LDKCOption_i64Z_Some_meth = NULL;
10568 static jclass LDKCOption_i64Z_None_class = NULL;
10569 static jmethodID LDKCOption_i64Z_None_meth = NULL;
10570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1i64Z_init (JNIEnv *env, jclass clz) {
10571         LDKCOption_i64Z_Some_class =
10572                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_i64Z$Some"));
10573         CHECK(LDKCOption_i64Z_Some_class != NULL);
10574         LDKCOption_i64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_i64Z_Some_class, "<init>", "(J)V");
10575         CHECK(LDKCOption_i64Z_Some_meth != NULL);
10576         LDKCOption_i64Z_None_class =
10577                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_i64Z$None"));
10578         CHECK(LDKCOption_i64Z_None_class != NULL);
10579         LDKCOption_i64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_i64Z_None_class, "<init>", "()V");
10580         CHECK(LDKCOption_i64Z_None_meth != NULL);
10581 }
10582 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1i64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10583         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
10584         switch(obj->tag) {
10585                 case LDKCOption_i64Z_Some: {
10586                         int64_t some_conv = obj->some;
10587                         return (*env)->NewObject(env, LDKCOption_i64Z_Some_class, LDKCOption_i64Z_Some_meth, some_conv);
10588                 }
10589                 case LDKCOption_i64Z_None: {
10590                         return (*env)->NewObject(env, LDKCOption_i64Z_None_class, LDKCOption_i64Z_None_meth);
10591                 }
10592                 default: abort();
10593         }
10594 }
10595 static inline struct LDKSocketAddress CResult_SocketAddressDecodeErrorZ_get_ok(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
10596 CHECK(owner->result_ok);
10597         return SocketAddress_clone(&*owner->contents.result);
10598 }
10599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10600         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
10601         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
10602         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_ok(owner_conv);
10603         int64_t ret_ref = tag_ptr(ret_copy, true);
10604         return ret_ref;
10605 }
10606
10607 static inline struct LDKDecodeError CResult_SocketAddressDecodeErrorZ_get_err(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
10608 CHECK(!owner->result_ok);
10609         return DecodeError_clone(&*owner->contents.err);
10610 }
10611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10612         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
10613         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10614         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_err(owner_conv);
10615         int64_t ret_ref = tag_ptr(ret_copy, true);
10616         return ret_ref;
10617 }
10618
10619 static inline struct LDKSocketAddress CResult_SocketAddressSocketAddressParseErrorZ_get_ok(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
10620 CHECK(owner->result_ok);
10621         return SocketAddress_clone(&*owner->contents.result);
10622 }
10623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10624         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
10625         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
10626         *ret_copy = CResult_SocketAddressSocketAddressParseErrorZ_get_ok(owner_conv);
10627         int64_t ret_ref = tag_ptr(ret_copy, true);
10628         return ret_ref;
10629 }
10630
10631 static inline enum LDKSocketAddressParseError CResult_SocketAddressSocketAddressParseErrorZ_get_err(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
10632 CHECK(!owner->result_ok);
10633         return SocketAddressParseError_clone(&*owner->contents.err);
10634 }
10635 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10636         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
10637         jclass ret_conv = LDKSocketAddressParseError_to_java(env, CResult_SocketAddressSocketAddressParseErrorZ_get_err(owner_conv));
10638         return ret_conv;
10639 }
10640
10641 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
10642         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
10643         for (size_t i = 0; i < ret.datalen; i++) {
10644                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
10645         }
10646         return ret;
10647 }
10648 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
10649         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
10650         for (size_t i = 0; i < ret.datalen; i++) {
10651                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
10652         }
10653         return ret;
10654 }
10655 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
10656         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
10657         for (size_t i = 0; i < ret.datalen; i++) {
10658                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
10659         }
10660         return ret;
10661 }
10662 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
10663         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
10664         for (size_t i = 0; i < ret.datalen; i++) {
10665                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
10666         }
10667         return ret;
10668 }
10669 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
10670         LDKAcceptChannel ret = *owner->contents.result;
10671         ret.is_owned = false;
10672         return ret;
10673 }
10674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10675         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
10676         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
10677         int64_t ret_ref = 0;
10678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10680         return ret_ref;
10681 }
10682
10683 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
10684 CHECK(!owner->result_ok);
10685         return DecodeError_clone(&*owner->contents.err);
10686 }
10687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10688         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
10689         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10690         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
10691         int64_t ret_ref = tag_ptr(ret_copy, true);
10692         return ret_ref;
10693 }
10694
10695 static inline struct LDKAcceptChannelV2 CResult_AcceptChannelV2DecodeErrorZ_get_ok(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
10696         LDKAcceptChannelV2 ret = *owner->contents.result;
10697         ret.is_owned = false;
10698         return ret;
10699 }
10700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10701         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
10702         LDKAcceptChannelV2 ret_var = CResult_AcceptChannelV2DecodeErrorZ_get_ok(owner_conv);
10703         int64_t ret_ref = 0;
10704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10706         return ret_ref;
10707 }
10708
10709 static inline struct LDKDecodeError CResult_AcceptChannelV2DecodeErrorZ_get_err(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
10710 CHECK(!owner->result_ok);
10711         return DecodeError_clone(&*owner->contents.err);
10712 }
10713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10714         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
10715         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10716         *ret_copy = CResult_AcceptChannelV2DecodeErrorZ_get_err(owner_conv);
10717         int64_t ret_ref = tag_ptr(ret_copy, true);
10718         return ret_ref;
10719 }
10720
10721 static inline struct LDKTxAddInput CResult_TxAddInputDecodeErrorZ_get_ok(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
10722         LDKTxAddInput ret = *owner->contents.result;
10723         ret.is_owned = false;
10724         return ret;
10725 }
10726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10727         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
10728         LDKTxAddInput ret_var = CResult_TxAddInputDecodeErrorZ_get_ok(owner_conv);
10729         int64_t ret_ref = 0;
10730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10732         return ret_ref;
10733 }
10734
10735 static inline struct LDKDecodeError CResult_TxAddInputDecodeErrorZ_get_err(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
10736 CHECK(!owner->result_ok);
10737         return DecodeError_clone(&*owner->contents.err);
10738 }
10739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10740         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
10741         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10742         *ret_copy = CResult_TxAddInputDecodeErrorZ_get_err(owner_conv);
10743         int64_t ret_ref = tag_ptr(ret_copy, true);
10744         return ret_ref;
10745 }
10746
10747 static inline struct LDKTxAddOutput CResult_TxAddOutputDecodeErrorZ_get_ok(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
10748         LDKTxAddOutput ret = *owner->contents.result;
10749         ret.is_owned = false;
10750         return ret;
10751 }
10752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10753         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
10754         LDKTxAddOutput ret_var = CResult_TxAddOutputDecodeErrorZ_get_ok(owner_conv);
10755         int64_t ret_ref = 0;
10756         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10757         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10758         return ret_ref;
10759 }
10760
10761 static inline struct LDKDecodeError CResult_TxAddOutputDecodeErrorZ_get_err(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
10762 CHECK(!owner->result_ok);
10763         return DecodeError_clone(&*owner->contents.err);
10764 }
10765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10766         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
10767         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10768         *ret_copy = CResult_TxAddOutputDecodeErrorZ_get_err(owner_conv);
10769         int64_t ret_ref = tag_ptr(ret_copy, true);
10770         return ret_ref;
10771 }
10772
10773 static inline struct LDKTxRemoveInput CResult_TxRemoveInputDecodeErrorZ_get_ok(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
10774         LDKTxRemoveInput ret = *owner->contents.result;
10775         ret.is_owned = false;
10776         return ret;
10777 }
10778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10779         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
10780         LDKTxRemoveInput ret_var = CResult_TxRemoveInputDecodeErrorZ_get_ok(owner_conv);
10781         int64_t ret_ref = 0;
10782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10784         return ret_ref;
10785 }
10786
10787 static inline struct LDKDecodeError CResult_TxRemoveInputDecodeErrorZ_get_err(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
10788 CHECK(!owner->result_ok);
10789         return DecodeError_clone(&*owner->contents.err);
10790 }
10791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10792         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
10793         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10794         *ret_copy = CResult_TxRemoveInputDecodeErrorZ_get_err(owner_conv);
10795         int64_t ret_ref = tag_ptr(ret_copy, true);
10796         return ret_ref;
10797 }
10798
10799 static inline struct LDKTxRemoveOutput CResult_TxRemoveOutputDecodeErrorZ_get_ok(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
10800         LDKTxRemoveOutput ret = *owner->contents.result;
10801         ret.is_owned = false;
10802         return ret;
10803 }
10804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10805         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
10806         LDKTxRemoveOutput ret_var = CResult_TxRemoveOutputDecodeErrorZ_get_ok(owner_conv);
10807         int64_t ret_ref = 0;
10808         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10809         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10810         return ret_ref;
10811 }
10812
10813 static inline struct LDKDecodeError CResult_TxRemoveOutputDecodeErrorZ_get_err(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
10814 CHECK(!owner->result_ok);
10815         return DecodeError_clone(&*owner->contents.err);
10816 }
10817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10818         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
10819         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10820         *ret_copy = CResult_TxRemoveOutputDecodeErrorZ_get_err(owner_conv);
10821         int64_t ret_ref = tag_ptr(ret_copy, true);
10822         return ret_ref;
10823 }
10824
10825 static inline struct LDKTxComplete CResult_TxCompleteDecodeErrorZ_get_ok(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
10826         LDKTxComplete ret = *owner->contents.result;
10827         ret.is_owned = false;
10828         return ret;
10829 }
10830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10831         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
10832         LDKTxComplete ret_var = CResult_TxCompleteDecodeErrorZ_get_ok(owner_conv);
10833         int64_t ret_ref = 0;
10834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10836         return ret_ref;
10837 }
10838
10839 static inline struct LDKDecodeError CResult_TxCompleteDecodeErrorZ_get_err(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
10840 CHECK(!owner->result_ok);
10841         return DecodeError_clone(&*owner->contents.err);
10842 }
10843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10844         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
10845         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10846         *ret_copy = CResult_TxCompleteDecodeErrorZ_get_err(owner_conv);
10847         int64_t ret_ref = tag_ptr(ret_copy, true);
10848         return ret_ref;
10849 }
10850
10851 static inline struct LDKTxSignatures CResult_TxSignaturesDecodeErrorZ_get_ok(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
10852         LDKTxSignatures ret = *owner->contents.result;
10853         ret.is_owned = false;
10854         return ret;
10855 }
10856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10857         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
10858         LDKTxSignatures ret_var = CResult_TxSignaturesDecodeErrorZ_get_ok(owner_conv);
10859         int64_t ret_ref = 0;
10860         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10861         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10862         return ret_ref;
10863 }
10864
10865 static inline struct LDKDecodeError CResult_TxSignaturesDecodeErrorZ_get_err(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
10866 CHECK(!owner->result_ok);
10867         return DecodeError_clone(&*owner->contents.err);
10868 }
10869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10870         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
10871         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10872         *ret_copy = CResult_TxSignaturesDecodeErrorZ_get_err(owner_conv);
10873         int64_t ret_ref = tag_ptr(ret_copy, true);
10874         return ret_ref;
10875 }
10876
10877 static inline struct LDKTxInitRbf CResult_TxInitRbfDecodeErrorZ_get_ok(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
10878         LDKTxInitRbf ret = *owner->contents.result;
10879         ret.is_owned = false;
10880         return ret;
10881 }
10882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10883         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
10884         LDKTxInitRbf ret_var = CResult_TxInitRbfDecodeErrorZ_get_ok(owner_conv);
10885         int64_t ret_ref = 0;
10886         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10887         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10888         return ret_ref;
10889 }
10890
10891 static inline struct LDKDecodeError CResult_TxInitRbfDecodeErrorZ_get_err(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
10892 CHECK(!owner->result_ok);
10893         return DecodeError_clone(&*owner->contents.err);
10894 }
10895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10896         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
10897         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10898         *ret_copy = CResult_TxInitRbfDecodeErrorZ_get_err(owner_conv);
10899         int64_t ret_ref = tag_ptr(ret_copy, true);
10900         return ret_ref;
10901 }
10902
10903 static inline struct LDKTxAckRbf CResult_TxAckRbfDecodeErrorZ_get_ok(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
10904         LDKTxAckRbf ret = *owner->contents.result;
10905         ret.is_owned = false;
10906         return ret;
10907 }
10908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10909         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
10910         LDKTxAckRbf ret_var = CResult_TxAckRbfDecodeErrorZ_get_ok(owner_conv);
10911         int64_t ret_ref = 0;
10912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10914         return ret_ref;
10915 }
10916
10917 static inline struct LDKDecodeError CResult_TxAckRbfDecodeErrorZ_get_err(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
10918 CHECK(!owner->result_ok);
10919         return DecodeError_clone(&*owner->contents.err);
10920 }
10921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10922         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
10923         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10924         *ret_copy = CResult_TxAckRbfDecodeErrorZ_get_err(owner_conv);
10925         int64_t ret_ref = tag_ptr(ret_copy, true);
10926         return ret_ref;
10927 }
10928
10929 static inline struct LDKTxAbort CResult_TxAbortDecodeErrorZ_get_ok(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
10930         LDKTxAbort ret = *owner->contents.result;
10931         ret.is_owned = false;
10932         return ret;
10933 }
10934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10935         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
10936         LDKTxAbort ret_var = CResult_TxAbortDecodeErrorZ_get_ok(owner_conv);
10937         int64_t ret_ref = 0;
10938         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10939         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10940         return ret_ref;
10941 }
10942
10943 static inline struct LDKDecodeError CResult_TxAbortDecodeErrorZ_get_err(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
10944 CHECK(!owner->result_ok);
10945         return DecodeError_clone(&*owner->contents.err);
10946 }
10947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10948         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
10949         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10950         *ret_copy = CResult_TxAbortDecodeErrorZ_get_err(owner_conv);
10951         int64_t ret_ref = tag_ptr(ret_copy, true);
10952         return ret_ref;
10953 }
10954
10955 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
10956         LDKAnnouncementSignatures ret = *owner->contents.result;
10957         ret.is_owned = false;
10958         return ret;
10959 }
10960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10961         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
10962         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
10963         int64_t ret_ref = 0;
10964         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10965         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10966         return ret_ref;
10967 }
10968
10969 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
10970 CHECK(!owner->result_ok);
10971         return DecodeError_clone(&*owner->contents.err);
10972 }
10973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10974         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
10975         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10976         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
10977         int64_t ret_ref = tag_ptr(ret_copy, true);
10978         return ret_ref;
10979 }
10980
10981 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
10982         LDKChannelReestablish ret = *owner->contents.result;
10983         ret.is_owned = false;
10984         return ret;
10985 }
10986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10987         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
10988         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
10989         int64_t ret_ref = 0;
10990         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10991         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10992         return ret_ref;
10993 }
10994
10995 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
10996 CHECK(!owner->result_ok);
10997         return DecodeError_clone(&*owner->contents.err);
10998 }
10999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11000         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
11001         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11002         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
11003         int64_t ret_ref = tag_ptr(ret_copy, true);
11004         return ret_ref;
11005 }
11006
11007 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
11008         LDKClosingSigned ret = *owner->contents.result;
11009         ret.is_owned = false;
11010         return ret;
11011 }
11012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11013         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
11014         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
11015         int64_t ret_ref = 0;
11016         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11017         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11018         return ret_ref;
11019 }
11020
11021 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
11022 CHECK(!owner->result_ok);
11023         return DecodeError_clone(&*owner->contents.err);
11024 }
11025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11026         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
11027         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11028         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
11029         int64_t ret_ref = tag_ptr(ret_copy, true);
11030         return ret_ref;
11031 }
11032
11033 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
11034         LDKClosingSignedFeeRange ret = *owner->contents.result;
11035         ret.is_owned = false;
11036         return ret;
11037 }
11038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11039         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
11040         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
11041         int64_t ret_ref = 0;
11042         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11043         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11044         return ret_ref;
11045 }
11046
11047 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
11048 CHECK(!owner->result_ok);
11049         return DecodeError_clone(&*owner->contents.err);
11050 }
11051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11052         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
11053         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11054         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
11055         int64_t ret_ref = tag_ptr(ret_copy, true);
11056         return ret_ref;
11057 }
11058
11059 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
11060         LDKCommitmentSigned ret = *owner->contents.result;
11061         ret.is_owned = false;
11062         return ret;
11063 }
11064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11065         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
11066         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
11067         int64_t ret_ref = 0;
11068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11070         return ret_ref;
11071 }
11072
11073 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
11074 CHECK(!owner->result_ok);
11075         return DecodeError_clone(&*owner->contents.err);
11076 }
11077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11078         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
11079         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11080         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
11081         int64_t ret_ref = tag_ptr(ret_copy, true);
11082         return ret_ref;
11083 }
11084
11085 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
11086         LDKFundingCreated ret = *owner->contents.result;
11087         ret.is_owned = false;
11088         return ret;
11089 }
11090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11091         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
11092         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
11093         int64_t ret_ref = 0;
11094         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11095         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11096         return ret_ref;
11097 }
11098
11099 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
11100 CHECK(!owner->result_ok);
11101         return DecodeError_clone(&*owner->contents.err);
11102 }
11103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11104         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
11105         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11106         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
11107         int64_t ret_ref = tag_ptr(ret_copy, true);
11108         return ret_ref;
11109 }
11110
11111 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
11112         LDKFundingSigned ret = *owner->contents.result;
11113         ret.is_owned = false;
11114         return ret;
11115 }
11116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11117         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
11118         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
11119         int64_t ret_ref = 0;
11120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11122         return ret_ref;
11123 }
11124
11125 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
11126 CHECK(!owner->result_ok);
11127         return DecodeError_clone(&*owner->contents.err);
11128 }
11129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11130         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
11131         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11132         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
11133         int64_t ret_ref = tag_ptr(ret_copy, true);
11134         return ret_ref;
11135 }
11136
11137 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
11138         LDKChannelReady ret = *owner->contents.result;
11139         ret.is_owned = false;
11140         return ret;
11141 }
11142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11143         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
11144         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
11145         int64_t ret_ref = 0;
11146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11148         return ret_ref;
11149 }
11150
11151 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
11152 CHECK(!owner->result_ok);
11153         return DecodeError_clone(&*owner->contents.err);
11154 }
11155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11156         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
11157         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11158         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
11159         int64_t ret_ref = tag_ptr(ret_copy, true);
11160         return ret_ref;
11161 }
11162
11163 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
11164         LDKInit ret = *owner->contents.result;
11165         ret.is_owned = false;
11166         return ret;
11167 }
11168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11169         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
11170         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
11171         int64_t ret_ref = 0;
11172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11174         return ret_ref;
11175 }
11176
11177 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
11178 CHECK(!owner->result_ok);
11179         return DecodeError_clone(&*owner->contents.err);
11180 }
11181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11182         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
11183         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11184         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
11185         int64_t ret_ref = tag_ptr(ret_copy, true);
11186         return ret_ref;
11187 }
11188
11189 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
11190         LDKOpenChannel ret = *owner->contents.result;
11191         ret.is_owned = false;
11192         return ret;
11193 }
11194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11195         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
11196         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
11197         int64_t ret_ref = 0;
11198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11200         return ret_ref;
11201 }
11202
11203 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
11204 CHECK(!owner->result_ok);
11205         return DecodeError_clone(&*owner->contents.err);
11206 }
11207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11208         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
11209         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11210         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
11211         int64_t ret_ref = tag_ptr(ret_copy, true);
11212         return ret_ref;
11213 }
11214
11215 static inline struct LDKOpenChannelV2 CResult_OpenChannelV2DecodeErrorZ_get_ok(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
11216         LDKOpenChannelV2 ret = *owner->contents.result;
11217         ret.is_owned = false;
11218         return ret;
11219 }
11220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11221         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
11222         LDKOpenChannelV2 ret_var = CResult_OpenChannelV2DecodeErrorZ_get_ok(owner_conv);
11223         int64_t ret_ref = 0;
11224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11226         return ret_ref;
11227 }
11228
11229 static inline struct LDKDecodeError CResult_OpenChannelV2DecodeErrorZ_get_err(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
11230 CHECK(!owner->result_ok);
11231         return DecodeError_clone(&*owner->contents.err);
11232 }
11233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11234         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
11235         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11236         *ret_copy = CResult_OpenChannelV2DecodeErrorZ_get_err(owner_conv);
11237         int64_t ret_ref = tag_ptr(ret_copy, true);
11238         return ret_ref;
11239 }
11240
11241 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
11242         LDKRevokeAndACK ret = *owner->contents.result;
11243         ret.is_owned = false;
11244         return ret;
11245 }
11246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11247         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
11248         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
11249         int64_t ret_ref = 0;
11250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11252         return ret_ref;
11253 }
11254
11255 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
11256 CHECK(!owner->result_ok);
11257         return DecodeError_clone(&*owner->contents.err);
11258 }
11259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11260         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
11261         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11262         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
11263         int64_t ret_ref = tag_ptr(ret_copy, true);
11264         return ret_ref;
11265 }
11266
11267 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
11268         LDKShutdown ret = *owner->contents.result;
11269         ret.is_owned = false;
11270         return ret;
11271 }
11272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11273         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
11274         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
11275         int64_t ret_ref = 0;
11276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11278         return ret_ref;
11279 }
11280
11281 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
11282 CHECK(!owner->result_ok);
11283         return DecodeError_clone(&*owner->contents.err);
11284 }
11285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11286         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
11287         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11288         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
11289         int64_t ret_ref = tag_ptr(ret_copy, true);
11290         return ret_ref;
11291 }
11292
11293 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
11294         LDKUpdateFailHTLC ret = *owner->contents.result;
11295         ret.is_owned = false;
11296         return ret;
11297 }
11298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11299         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
11300         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
11301         int64_t ret_ref = 0;
11302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11304         return ret_ref;
11305 }
11306
11307 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
11308 CHECK(!owner->result_ok);
11309         return DecodeError_clone(&*owner->contents.err);
11310 }
11311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11312         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
11313         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11314         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
11315         int64_t ret_ref = tag_ptr(ret_copy, true);
11316         return ret_ref;
11317 }
11318
11319 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
11320         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
11321         ret.is_owned = false;
11322         return ret;
11323 }
11324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11325         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
11326         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
11327         int64_t ret_ref = 0;
11328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11330         return ret_ref;
11331 }
11332
11333 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
11334 CHECK(!owner->result_ok);
11335         return DecodeError_clone(&*owner->contents.err);
11336 }
11337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11338         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
11339         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11340         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
11341         int64_t ret_ref = tag_ptr(ret_copy, true);
11342         return ret_ref;
11343 }
11344
11345 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
11346         LDKUpdateFee ret = *owner->contents.result;
11347         ret.is_owned = false;
11348         return ret;
11349 }
11350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11351         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
11352         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
11353         int64_t ret_ref = 0;
11354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11356         return ret_ref;
11357 }
11358
11359 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
11360 CHECK(!owner->result_ok);
11361         return DecodeError_clone(&*owner->contents.err);
11362 }
11363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11364         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
11365         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11366         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
11367         int64_t ret_ref = tag_ptr(ret_copy, true);
11368         return ret_ref;
11369 }
11370
11371 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
11372         LDKUpdateFulfillHTLC ret = *owner->contents.result;
11373         ret.is_owned = false;
11374         return ret;
11375 }
11376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11377         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
11378         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
11379         int64_t ret_ref = 0;
11380         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11381         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11382         return ret_ref;
11383 }
11384
11385 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
11386 CHECK(!owner->result_ok);
11387         return DecodeError_clone(&*owner->contents.err);
11388 }
11389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11390         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
11391         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11392         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
11393         int64_t ret_ref = tag_ptr(ret_copy, true);
11394         return ret_ref;
11395 }
11396
11397 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
11398         LDKUpdateAddHTLC ret = *owner->contents.result;
11399         ret.is_owned = false;
11400         return ret;
11401 }
11402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11403         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
11404         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
11405         int64_t ret_ref = 0;
11406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11408         return ret_ref;
11409 }
11410
11411 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
11412 CHECK(!owner->result_ok);
11413         return DecodeError_clone(&*owner->contents.err);
11414 }
11415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11416         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
11417         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11418         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
11419         int64_t ret_ref = tag_ptr(ret_copy, true);
11420         return ret_ref;
11421 }
11422
11423 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
11424         LDKOnionMessage ret = *owner->contents.result;
11425         ret.is_owned = false;
11426         return ret;
11427 }
11428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11429         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
11430         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
11431         int64_t ret_ref = 0;
11432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11434         return ret_ref;
11435 }
11436
11437 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
11438 CHECK(!owner->result_ok);
11439         return DecodeError_clone(&*owner->contents.err);
11440 }
11441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11442         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
11443         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11444         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
11445         int64_t ret_ref = tag_ptr(ret_copy, true);
11446         return ret_ref;
11447 }
11448
11449 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
11450         LDKPing ret = *owner->contents.result;
11451         ret.is_owned = false;
11452         return ret;
11453 }
11454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11455         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
11456         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
11457         int64_t ret_ref = 0;
11458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11460         return ret_ref;
11461 }
11462
11463 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
11464 CHECK(!owner->result_ok);
11465         return DecodeError_clone(&*owner->contents.err);
11466 }
11467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11468         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
11469         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11470         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
11471         int64_t ret_ref = tag_ptr(ret_copy, true);
11472         return ret_ref;
11473 }
11474
11475 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
11476         LDKPong ret = *owner->contents.result;
11477         ret.is_owned = false;
11478         return ret;
11479 }
11480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11481         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
11482         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
11483         int64_t ret_ref = 0;
11484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11486         return ret_ref;
11487 }
11488
11489 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
11490 CHECK(!owner->result_ok);
11491         return DecodeError_clone(&*owner->contents.err);
11492 }
11493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11494         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
11495         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11496         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
11497         int64_t ret_ref = tag_ptr(ret_copy, true);
11498         return ret_ref;
11499 }
11500
11501 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11502         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
11503         ret.is_owned = false;
11504         return ret;
11505 }
11506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11507         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
11508         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
11509         int64_t ret_ref = 0;
11510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11512         return ret_ref;
11513 }
11514
11515 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11516 CHECK(!owner->result_ok);
11517         return DecodeError_clone(&*owner->contents.err);
11518 }
11519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11520         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
11521         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11522         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
11523         int64_t ret_ref = tag_ptr(ret_copy, true);
11524         return ret_ref;
11525 }
11526
11527 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11528         LDKChannelAnnouncement ret = *owner->contents.result;
11529         ret.is_owned = false;
11530         return ret;
11531 }
11532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11533         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
11534         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
11535         int64_t ret_ref = 0;
11536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11538         return ret_ref;
11539 }
11540
11541 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11542 CHECK(!owner->result_ok);
11543         return DecodeError_clone(&*owner->contents.err);
11544 }
11545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11546         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
11547         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11548         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
11549         int64_t ret_ref = tag_ptr(ret_copy, true);
11550         return ret_ref;
11551 }
11552
11553 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
11554         LDKUnsignedChannelUpdate ret = *owner->contents.result;
11555         ret.is_owned = false;
11556         return ret;
11557 }
11558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11559         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
11560         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
11561         int64_t ret_ref = 0;
11562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11564         return ret_ref;
11565 }
11566
11567 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
11568 CHECK(!owner->result_ok);
11569         return DecodeError_clone(&*owner->contents.err);
11570 }
11571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11572         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
11573         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11574         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
11575         int64_t ret_ref = tag_ptr(ret_copy, true);
11576         return ret_ref;
11577 }
11578
11579 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
11580         LDKChannelUpdate ret = *owner->contents.result;
11581         ret.is_owned = false;
11582         return ret;
11583 }
11584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11585         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
11586         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
11587         int64_t ret_ref = 0;
11588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11590         return ret_ref;
11591 }
11592
11593 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
11594 CHECK(!owner->result_ok);
11595         return DecodeError_clone(&*owner->contents.err);
11596 }
11597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11598         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
11599         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11600         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
11601         int64_t ret_ref = tag_ptr(ret_copy, true);
11602         return ret_ref;
11603 }
11604
11605 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
11606         LDKErrorMessage ret = *owner->contents.result;
11607         ret.is_owned = false;
11608         return ret;
11609 }
11610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11611         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
11612         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
11613         int64_t ret_ref = 0;
11614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11616         return ret_ref;
11617 }
11618
11619 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
11620 CHECK(!owner->result_ok);
11621         return DecodeError_clone(&*owner->contents.err);
11622 }
11623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11624         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
11625         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11626         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
11627         int64_t ret_ref = tag_ptr(ret_copy, true);
11628         return ret_ref;
11629 }
11630
11631 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
11632         LDKWarningMessage ret = *owner->contents.result;
11633         ret.is_owned = false;
11634         return ret;
11635 }
11636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11637         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
11638         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
11639         int64_t ret_ref = 0;
11640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11642         return ret_ref;
11643 }
11644
11645 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
11646 CHECK(!owner->result_ok);
11647         return DecodeError_clone(&*owner->contents.err);
11648 }
11649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11650         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
11651         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11652         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
11653         int64_t ret_ref = tag_ptr(ret_copy, true);
11654         return ret_ref;
11655 }
11656
11657 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11658         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
11659         ret.is_owned = false;
11660         return ret;
11661 }
11662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11663         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
11664         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
11665         int64_t ret_ref = 0;
11666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11668         return ret_ref;
11669 }
11670
11671 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11672 CHECK(!owner->result_ok);
11673         return DecodeError_clone(&*owner->contents.err);
11674 }
11675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11676         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
11677         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11678         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
11679         int64_t ret_ref = tag_ptr(ret_copy, true);
11680         return ret_ref;
11681 }
11682
11683 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11684         LDKNodeAnnouncement ret = *owner->contents.result;
11685         ret.is_owned = false;
11686         return ret;
11687 }
11688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11689         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
11690         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_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 LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11698 CHECK(!owner->result_ok);
11699         return DecodeError_clone(&*owner->contents.err);
11700 }
11701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11702         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
11703         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11704         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
11705         int64_t ret_ref = tag_ptr(ret_copy, true);
11706         return ret_ref;
11707 }
11708
11709 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
11710         LDKQueryShortChannelIds ret = *owner->contents.result;
11711         ret.is_owned = false;
11712         return ret;
11713 }
11714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11715         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
11716         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
11717         int64_t ret_ref = 0;
11718         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11719         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11720         return ret_ref;
11721 }
11722
11723 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
11724 CHECK(!owner->result_ok);
11725         return DecodeError_clone(&*owner->contents.err);
11726 }
11727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11728         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
11729         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11730         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
11731         int64_t ret_ref = tag_ptr(ret_copy, true);
11732         return ret_ref;
11733 }
11734
11735 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
11736         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
11737         ret.is_owned = false;
11738         return ret;
11739 }
11740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11741         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
11742         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
11743         int64_t ret_ref = 0;
11744         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11745         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11746         return ret_ref;
11747 }
11748
11749 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
11750 CHECK(!owner->result_ok);
11751         return DecodeError_clone(&*owner->contents.err);
11752 }
11753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11754         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
11755         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11756         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
11757         int64_t ret_ref = tag_ptr(ret_copy, true);
11758         return ret_ref;
11759 }
11760
11761 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
11762         LDKQueryChannelRange ret = *owner->contents.result;
11763         ret.is_owned = false;
11764         return ret;
11765 }
11766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11767         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
11768         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
11769         int64_t ret_ref = 0;
11770         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11771         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11772         return ret_ref;
11773 }
11774
11775 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
11776 CHECK(!owner->result_ok);
11777         return DecodeError_clone(&*owner->contents.err);
11778 }
11779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11780         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
11781         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11782         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
11783         int64_t ret_ref = tag_ptr(ret_copy, true);
11784         return ret_ref;
11785 }
11786
11787 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
11788         LDKReplyChannelRange ret = *owner->contents.result;
11789         ret.is_owned = false;
11790         return ret;
11791 }
11792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11793         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
11794         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
11795         int64_t ret_ref = 0;
11796         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11797         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11798         return ret_ref;
11799 }
11800
11801 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
11802 CHECK(!owner->result_ok);
11803         return DecodeError_clone(&*owner->contents.err);
11804 }
11805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11806         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
11807         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11808         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
11809         int64_t ret_ref = tag_ptr(ret_copy, true);
11810         return ret_ref;
11811 }
11812
11813 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
11814         LDKGossipTimestampFilter ret = *owner->contents.result;
11815         ret.is_owned = false;
11816         return ret;
11817 }
11818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11819         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
11820         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
11821         int64_t ret_ref = 0;
11822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11824         return ret_ref;
11825 }
11826
11827 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
11828 CHECK(!owner->result_ok);
11829         return DecodeError_clone(&*owner->contents.err);
11830 }
11831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11832         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
11833         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11834         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
11835         int64_t ret_ref = tag_ptr(ret_copy, true);
11836         return ret_ref;
11837 }
11838
11839 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
11840         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
11841         for (size_t i = 0; i < ret.datalen; i++) {
11842                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
11843         }
11844         return ret;
11845 }
11846 static jclass LDKSignOrCreationError_SignError_class = NULL;
11847 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
11848 static jclass LDKSignOrCreationError_CreationError_class = NULL;
11849 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
11850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
11851         LDKSignOrCreationError_SignError_class =
11852                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$SignError"));
11853         CHECK(LDKSignOrCreationError_SignError_class != NULL);
11854         LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
11855         CHECK(LDKSignOrCreationError_SignError_meth != NULL);
11856         LDKSignOrCreationError_CreationError_class =
11857                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$CreationError"));
11858         CHECK(LDKSignOrCreationError_CreationError_class != NULL);
11859         LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
11860         CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
11861 }
11862 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11863         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
11864         switch(obj->tag) {
11865                 case LDKSignOrCreationError_SignError: {
11866                         return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
11867                 }
11868                 case LDKSignOrCreationError_CreationError: {
11869                         jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
11870                         return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
11871                 }
11872                 default: abort();
11873         }
11874 }
11875 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
11876         LDKBolt11Invoice ret = *owner->contents.result;
11877         ret.is_owned = false;
11878         return ret;
11879 }
11880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11881         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
11882         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
11883         int64_t ret_ref = 0;
11884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11886         return ret_ref;
11887 }
11888
11889 static inline struct LDKSignOrCreationError CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
11890 CHECK(!owner->result_ok);
11891         return SignOrCreationError_clone(&*owner->contents.err);
11892 }
11893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11894         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
11895         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
11896         *ret_copy = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(owner_conv);
11897         int64_t ret_ref = tag_ptr(ret_copy, true);
11898         return ret_ref;
11899 }
11900
11901 static inline LDKCVec_FutureZ CVec_FutureZ_clone(const LDKCVec_FutureZ *orig) {
11902         LDKCVec_FutureZ ret = { .data = MALLOC(sizeof(LDKFuture) * orig->datalen, "LDKCVec_FutureZ clone bytes"), .datalen = orig->datalen };
11903         for (size_t i = 0; i < ret.datalen; i++) {
11904                 ret.data[i] = Future_clone(&orig->data[i]);
11905         }
11906         return ret;
11907 }
11908 static inline struct LDKOffersMessage CResult_OffersMessageDecodeErrorZ_get_ok(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
11909 CHECK(owner->result_ok);
11910         return OffersMessage_clone(&*owner->contents.result);
11911 }
11912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11913         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
11914         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
11915         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_ok(owner_conv);
11916         int64_t ret_ref = tag_ptr(ret_copy, true);
11917         return ret_ref;
11918 }
11919
11920 static inline struct LDKDecodeError CResult_OffersMessageDecodeErrorZ_get_err(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
11921 CHECK(!owner->result_ok);
11922         return DecodeError_clone(&*owner->contents.err);
11923 }
11924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11925         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
11926         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11927         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_err(owner_conv);
11928         int64_t ret_ref = tag_ptr(ret_copy, true);
11929         return ret_ref;
11930 }
11931
11932 static jclass LDKCOption_HTLCClaimZ_Some_class = NULL;
11933 static jmethodID LDKCOption_HTLCClaimZ_Some_meth = NULL;
11934 static jclass LDKCOption_HTLCClaimZ_None_class = NULL;
11935 static jmethodID LDKCOption_HTLCClaimZ_None_meth = NULL;
11936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCClaimZ_init (JNIEnv *env, jclass clz) {
11937         LDKCOption_HTLCClaimZ_Some_class =
11938                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCClaimZ$Some"));
11939         CHECK(LDKCOption_HTLCClaimZ_Some_class != NULL);
11940         LDKCOption_HTLCClaimZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCClaimZ_Some_class, "<init>", "(Lorg/ldk/enums/HTLCClaim;)V");
11941         CHECK(LDKCOption_HTLCClaimZ_Some_meth != NULL);
11942         LDKCOption_HTLCClaimZ_None_class =
11943                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCClaimZ$None"));
11944         CHECK(LDKCOption_HTLCClaimZ_None_class != NULL);
11945         LDKCOption_HTLCClaimZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCClaimZ_None_class, "<init>", "()V");
11946         CHECK(LDKCOption_HTLCClaimZ_None_meth != NULL);
11947 }
11948 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCClaimZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11949         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
11950         switch(obj->tag) {
11951                 case LDKCOption_HTLCClaimZ_Some: {
11952                         jclass some_conv = LDKHTLCClaim_to_java(env, obj->some);
11953                         return (*env)->NewObject(env, LDKCOption_HTLCClaimZ_Some_class, LDKCOption_HTLCClaimZ_Some_meth, some_conv);
11954                 }
11955                 case LDKCOption_HTLCClaimZ_None: {
11956                         return (*env)->NewObject(env, LDKCOption_HTLCClaimZ_None_class, LDKCOption_HTLCClaimZ_None_meth);
11957                 }
11958                 default: abort();
11959         }
11960 }
11961 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
11962         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
11963         ret.is_owned = false;
11964         return ret;
11965 }
11966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11967         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
11968         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
11969         int64_t ret_ref = 0;
11970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11972         return ret_ref;
11973 }
11974
11975 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
11976 CHECK(!owner->result_ok);
11977         return DecodeError_clone(&*owner->contents.err);
11978 }
11979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11980         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
11981         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11982         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
11983         int64_t ret_ref = tag_ptr(ret_copy, true);
11984         return ret_ref;
11985 }
11986
11987 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
11988         LDKTxCreationKeys ret = *owner->contents.result;
11989         ret.is_owned = false;
11990         return ret;
11991 }
11992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11993         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
11994         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
11995         int64_t ret_ref = 0;
11996         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11997         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11998         return ret_ref;
11999 }
12000
12001 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
12002 CHECK(!owner->result_ok);
12003         return DecodeError_clone(&*owner->contents.err);
12004 }
12005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12006         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
12007         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12008         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
12009         int64_t ret_ref = tag_ptr(ret_copy, true);
12010         return ret_ref;
12011 }
12012
12013 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
12014         LDKChannelPublicKeys ret = *owner->contents.result;
12015         ret.is_owned = false;
12016         return ret;
12017 }
12018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12019         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
12020         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
12021         int64_t ret_ref = 0;
12022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12024         return ret_ref;
12025 }
12026
12027 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
12028 CHECK(!owner->result_ok);
12029         return DecodeError_clone(&*owner->contents.err);
12030 }
12031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12032         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
12033         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12034         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
12035         int64_t ret_ref = tag_ptr(ret_copy, true);
12036         return ret_ref;
12037 }
12038
12039 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
12040         LDKHTLCOutputInCommitment ret = *owner->contents.result;
12041         ret.is_owned = false;
12042         return ret;
12043 }
12044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12045         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
12046         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
12047         int64_t ret_ref = 0;
12048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12050         return ret_ref;
12051 }
12052
12053 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
12054 CHECK(!owner->result_ok);
12055         return DecodeError_clone(&*owner->contents.err);
12056 }
12057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12058         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
12059         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12060         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
12061         int64_t ret_ref = tag_ptr(ret_copy, true);
12062         return ret_ref;
12063 }
12064
12065 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
12066         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
12067         ret.is_owned = false;
12068         return ret;
12069 }
12070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12071         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
12072         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
12073         int64_t ret_ref = 0;
12074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12076         return ret_ref;
12077 }
12078
12079 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
12080 CHECK(!owner->result_ok);
12081         return DecodeError_clone(&*owner->contents.err);
12082 }
12083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12084         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
12085         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12086         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
12087         int64_t ret_ref = tag_ptr(ret_copy, true);
12088         return ret_ref;
12089 }
12090
12091 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
12092         LDKChannelTransactionParameters ret = *owner->contents.result;
12093         ret.is_owned = false;
12094         return ret;
12095 }
12096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12097         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
12098         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
12099         int64_t ret_ref = 0;
12100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12102         return ret_ref;
12103 }
12104
12105 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
12106 CHECK(!owner->result_ok);
12107         return DecodeError_clone(&*owner->contents.err);
12108 }
12109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12110         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
12111         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12112         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
12113         int64_t ret_ref = tag_ptr(ret_copy, true);
12114         return ret_ref;
12115 }
12116
12117 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
12118         LDKHolderCommitmentTransaction ret = *owner->contents.result;
12119         ret.is_owned = false;
12120         return ret;
12121 }
12122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12123         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
12124         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
12125         int64_t ret_ref = 0;
12126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12128         return ret_ref;
12129 }
12130
12131 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
12132 CHECK(!owner->result_ok);
12133         return DecodeError_clone(&*owner->contents.err);
12134 }
12135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12136         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
12137         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12138         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
12139         int64_t ret_ref = tag_ptr(ret_copy, true);
12140         return ret_ref;
12141 }
12142
12143 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
12144         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
12145         ret.is_owned = false;
12146         return ret;
12147 }
12148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12149         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
12150         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
12151         int64_t ret_ref = 0;
12152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12154         return ret_ref;
12155 }
12156
12157 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
12158 CHECK(!owner->result_ok);
12159         return DecodeError_clone(&*owner->contents.err);
12160 }
12161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12162         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
12163         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12164         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
12165         int64_t ret_ref = tag_ptr(ret_copy, true);
12166         return ret_ref;
12167 }
12168
12169 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
12170         LDKTrustedClosingTransaction ret = *owner->contents.result;
12171         ret.is_owned = false;
12172         return ret;
12173 }
12174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12175         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
12176         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
12177         int64_t ret_ref = 0;
12178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12180         return ret_ref;
12181 }
12182
12183 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
12184 CHECK(!owner->result_ok);
12185         return *owner->contents.err;
12186 }
12187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12188         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
12189         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
12190 }
12191
12192 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
12193         LDKCommitmentTransaction ret = *owner->contents.result;
12194         ret.is_owned = false;
12195         return ret;
12196 }
12197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12198         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
12199         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
12200         int64_t ret_ref = 0;
12201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12203         return ret_ref;
12204 }
12205
12206 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
12207 CHECK(!owner->result_ok);
12208         return DecodeError_clone(&*owner->contents.err);
12209 }
12210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12211         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
12212         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12213         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
12214         int64_t ret_ref = tag_ptr(ret_copy, true);
12215         return ret_ref;
12216 }
12217
12218 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
12219         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
12220         ret.is_owned = false;
12221         return ret;
12222 }
12223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12224         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
12225         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
12226         int64_t ret_ref = 0;
12227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12229         return ret_ref;
12230 }
12231
12232 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
12233 CHECK(!owner->result_ok);
12234         return *owner->contents.err;
12235 }
12236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12237         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
12238         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
12239 }
12240
12241 static inline struct LDKCVec_ECDSASignatureZ CResult_CVec_ECDSASignatureZNoneZ_get_ok(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
12242 CHECK(owner->result_ok);
12243         return *owner->contents.result;
12244 }
12245 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12246         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
12247         LDKCVec_ECDSASignatureZ ret_var = CResult_CVec_ECDSASignatureZNoneZ_get_ok(owner_conv);
12248         jobjectArray ret_arr = NULL;
12249         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
12250         ;
12251         for (size_t i = 0; i < ret_var.datalen; i++) {
12252                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
12253                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
12254                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
12255         }
12256         
12257         return ret_arr;
12258 }
12259
12260 static inline void CResult_CVec_ECDSASignatureZNoneZ_get_err(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
12261 CHECK(!owner->result_ok);
12262         return *owner->contents.err;
12263 }
12264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12265         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
12266         CResult_CVec_ECDSASignatureZNoneZ_get_err(owner_conv);
12267 }
12268
12269 static jclass LDKCOption_usizeZ_Some_class = NULL;
12270 static jmethodID LDKCOption_usizeZ_Some_meth = NULL;
12271 static jclass LDKCOption_usizeZ_None_class = NULL;
12272 static jmethodID LDKCOption_usizeZ_None_meth = NULL;
12273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1usizeZ_init (JNIEnv *env, jclass clz) {
12274         LDKCOption_usizeZ_Some_class =
12275                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_usizeZ$Some"));
12276         CHECK(LDKCOption_usizeZ_Some_class != NULL);
12277         LDKCOption_usizeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_usizeZ_Some_class, "<init>", "(J)V");
12278         CHECK(LDKCOption_usizeZ_Some_meth != NULL);
12279         LDKCOption_usizeZ_None_class =
12280                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_usizeZ$None"));
12281         CHECK(LDKCOption_usizeZ_None_class != NULL);
12282         LDKCOption_usizeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_usizeZ_None_class, "<init>", "()V");
12283         CHECK(LDKCOption_usizeZ_None_meth != NULL);
12284 }
12285 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1usizeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12286         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
12287         switch(obj->tag) {
12288                 case LDKCOption_usizeZ_Some: {
12289                         int64_t some_conv = obj->some;
12290                         return (*env)->NewObject(env, LDKCOption_usizeZ_Some_class, LDKCOption_usizeZ_Some_meth, some_conv);
12291                 }
12292                 case LDKCOption_usizeZ_None: {
12293                         return (*env)->NewObject(env, LDKCOption_usizeZ_None_class, LDKCOption_usizeZ_None_meth);
12294                 }
12295                 default: abort();
12296         }
12297 }
12298 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
12299         LDKShutdownScript ret = *owner->contents.result;
12300         ret.is_owned = false;
12301         return ret;
12302 }
12303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12304         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
12305         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
12306         int64_t ret_ref = 0;
12307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12309         return ret_ref;
12310 }
12311
12312 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
12313 CHECK(!owner->result_ok);
12314         return DecodeError_clone(&*owner->contents.err);
12315 }
12316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12317         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
12318         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12319         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
12320         int64_t ret_ref = tag_ptr(ret_copy, true);
12321         return ret_ref;
12322 }
12323
12324 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
12325         LDKShutdownScript ret = *owner->contents.result;
12326         ret.is_owned = false;
12327         return ret;
12328 }
12329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12330         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
12331         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
12332         int64_t ret_ref = 0;
12333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12335         return ret_ref;
12336 }
12337
12338 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
12339         LDKInvalidShutdownScript ret = *owner->contents.err;
12340         ret.is_owned = false;
12341         return ret;
12342 }
12343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12344         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
12345         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
12346         int64_t ret_ref = 0;
12347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12349         return ret_ref;
12350 }
12351
12352 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
12353 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
12354 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
12355 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
12356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
12357         LDKPaymentPurpose_InvoicePayment_class =
12358                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment"));
12359         CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
12360         LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "(J[B)V");
12361         CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
12362         LDKPaymentPurpose_SpontaneousPayment_class =
12363                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment"));
12364         CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
12365         LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
12366         CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
12367 }
12368 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12369         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
12370         switch(obj->tag) {
12371                 case LDKPaymentPurpose_InvoicePayment: {
12372                         int64_t payment_preimage_ref = tag_ptr(&obj->invoice_payment.payment_preimage, false);
12373                         int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
12374                         (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
12375                         return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_ref, payment_secret_arr);
12376                 }
12377                 case LDKPaymentPurpose_SpontaneousPayment: {
12378                         int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
12379                         (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
12380                         return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
12381                 }
12382                 default: abort();
12383         }
12384 }
12385 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
12386 CHECK(owner->result_ok);
12387         return PaymentPurpose_clone(&*owner->contents.result);
12388 }
12389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12390         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
12391         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
12392         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
12393         int64_t ret_ref = tag_ptr(ret_copy, true);
12394         return ret_ref;
12395 }
12396
12397 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
12398 CHECK(!owner->result_ok);
12399         return DecodeError_clone(&*owner->contents.err);
12400 }
12401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12402         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
12403         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12404         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
12405         int64_t ret_ref = tag_ptr(ret_copy, true);
12406         return ret_ref;
12407 }
12408
12409 static inline struct LDKClaimedHTLC CResult_ClaimedHTLCDecodeErrorZ_get_ok(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
12410         LDKClaimedHTLC ret = *owner->contents.result;
12411         ret.is_owned = false;
12412         return ret;
12413 }
12414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12415         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
12416         LDKClaimedHTLC ret_var = CResult_ClaimedHTLCDecodeErrorZ_get_ok(owner_conv);
12417         int64_t ret_ref = 0;
12418         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12419         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12420         return ret_ref;
12421 }
12422
12423 static inline struct LDKDecodeError CResult_ClaimedHTLCDecodeErrorZ_get_err(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
12424 CHECK(!owner->result_ok);
12425         return DecodeError_clone(&*owner->contents.err);
12426 }
12427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12428         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
12429         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12430         *ret_copy = CResult_ClaimedHTLCDecodeErrorZ_get_err(owner_conv);
12431         int64_t ret_ref = tag_ptr(ret_copy, true);
12432         return ret_ref;
12433 }
12434
12435 static jclass LDKPathFailure_InitialSend_class = NULL;
12436 static jmethodID LDKPathFailure_InitialSend_meth = NULL;
12437 static jclass LDKPathFailure_OnPath_class = NULL;
12438 static jmethodID LDKPathFailure_OnPath_meth = NULL;
12439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPathFailure_init (JNIEnv *env, jclass clz) {
12440         LDKPathFailure_InitialSend_class =
12441                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPathFailure$InitialSend"));
12442         CHECK(LDKPathFailure_InitialSend_class != NULL);
12443         LDKPathFailure_InitialSend_meth = (*env)->GetMethodID(env, LDKPathFailure_InitialSend_class, "<init>", "(J)V");
12444         CHECK(LDKPathFailure_InitialSend_meth != NULL);
12445         LDKPathFailure_OnPath_class =
12446                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPathFailure$OnPath"));
12447         CHECK(LDKPathFailure_OnPath_class != NULL);
12448         LDKPathFailure_OnPath_meth = (*env)->GetMethodID(env, LDKPathFailure_OnPath_class, "<init>", "(J)V");
12449         CHECK(LDKPathFailure_OnPath_meth != NULL);
12450 }
12451 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPathFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12452         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
12453         switch(obj->tag) {
12454                 case LDKPathFailure_InitialSend: {
12455                         int64_t err_ref = tag_ptr(&obj->initial_send.err, false);
12456                         return (*env)->NewObject(env, LDKPathFailure_InitialSend_class, LDKPathFailure_InitialSend_meth, err_ref);
12457                 }
12458                 case LDKPathFailure_OnPath: {
12459                         int64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
12460                         return (*env)->NewObject(env, LDKPathFailure_OnPath_class, LDKPathFailure_OnPath_meth, network_update_ref);
12461                 }
12462                 default: abort();
12463         }
12464 }
12465 static jclass LDKCOption_PathFailureZ_Some_class = NULL;
12466 static jmethodID LDKCOption_PathFailureZ_Some_meth = NULL;
12467 static jclass LDKCOption_PathFailureZ_None_class = NULL;
12468 static jmethodID LDKCOption_PathFailureZ_None_meth = NULL;
12469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PathFailureZ_init (JNIEnv *env, jclass clz) {
12470         LDKCOption_PathFailureZ_Some_class =
12471                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PathFailureZ$Some"));
12472         CHECK(LDKCOption_PathFailureZ_Some_class != NULL);
12473         LDKCOption_PathFailureZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PathFailureZ_Some_class, "<init>", "(J)V");
12474         CHECK(LDKCOption_PathFailureZ_Some_meth != NULL);
12475         LDKCOption_PathFailureZ_None_class =
12476                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PathFailureZ$None"));
12477         CHECK(LDKCOption_PathFailureZ_None_class != NULL);
12478         LDKCOption_PathFailureZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PathFailureZ_None_class, "<init>", "()V");
12479         CHECK(LDKCOption_PathFailureZ_None_meth != NULL);
12480 }
12481 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PathFailureZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12482         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
12483         switch(obj->tag) {
12484                 case LDKCOption_PathFailureZ_Some: {
12485                         int64_t some_ref = tag_ptr(&obj->some, false);
12486                         return (*env)->NewObject(env, LDKCOption_PathFailureZ_Some_class, LDKCOption_PathFailureZ_Some_meth, some_ref);
12487                 }
12488                 case LDKCOption_PathFailureZ_None: {
12489                         return (*env)->NewObject(env, LDKCOption_PathFailureZ_None_class, LDKCOption_PathFailureZ_None_meth);
12490                 }
12491                 default: abort();
12492         }
12493 }
12494 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
12495 CHECK(owner->result_ok);
12496         return COption_PathFailureZ_clone(&*owner->contents.result);
12497 }
12498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12499         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
12500         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
12501         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
12502         int64_t ret_ref = tag_ptr(ret_copy, true);
12503         return ret_ref;
12504 }
12505
12506 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
12507 CHECK(!owner->result_ok);
12508         return DecodeError_clone(&*owner->contents.err);
12509 }
12510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12511         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
12512         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12513         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
12514         int64_t ret_ref = tag_ptr(ret_copy, true);
12515         return ret_ref;
12516 }
12517
12518 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
12519 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
12520 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
12521 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
12522 static jclass LDKClosureReason_CooperativeClosure_class = NULL;
12523 static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL;
12524 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
12525 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
12526 static jclass LDKClosureReason_FundingTimedOut_class = NULL;
12527 static jmethodID LDKClosureReason_FundingTimedOut_meth = NULL;
12528 static jclass LDKClosureReason_ProcessingError_class = NULL;
12529 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
12530 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
12531 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
12532 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
12533 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
12534 static jclass LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class = NULL;
12535 static jmethodID LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth = NULL;
12536 static jclass LDKClosureReason_FundingBatchClosure_class = NULL;
12537 static jmethodID LDKClosureReason_FundingBatchClosure_meth = NULL;
12538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
12539         LDKClosureReason_CounterpartyForceClosed_class =
12540                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed"));
12541         CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
12542         LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(J)V");
12543         CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
12544         LDKClosureReason_HolderForceClosed_class =
12545                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$HolderForceClosed"));
12546         CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
12547         LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
12548         CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
12549         LDKClosureReason_CooperativeClosure_class =
12550                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CooperativeClosure"));
12551         CHECK(LDKClosureReason_CooperativeClosure_class != NULL);
12552         LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "<init>", "()V");
12553         CHECK(LDKClosureReason_CooperativeClosure_meth != NULL);
12554         LDKClosureReason_CommitmentTxConfirmed_class =
12555                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed"));
12556         CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
12557         LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
12558         CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
12559         LDKClosureReason_FundingTimedOut_class =
12560                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingTimedOut"));
12561         CHECK(LDKClosureReason_FundingTimedOut_class != NULL);
12562         LDKClosureReason_FundingTimedOut_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingTimedOut_class, "<init>", "()V");
12563         CHECK(LDKClosureReason_FundingTimedOut_meth != NULL);
12564         LDKClosureReason_ProcessingError_class =
12565                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$ProcessingError"));
12566         CHECK(LDKClosureReason_ProcessingError_class != NULL);
12567         LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
12568         CHECK(LDKClosureReason_ProcessingError_meth != NULL);
12569         LDKClosureReason_DisconnectedPeer_class =
12570                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer"));
12571         CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
12572         LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
12573         CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
12574         LDKClosureReason_OutdatedChannelManager_class =
12575                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager"));
12576         CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
12577         LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
12578         CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
12579         LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class =
12580                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyCoopClosedUnfundedChannel"));
12581         CHECK(LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class != NULL);
12582         LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class, "<init>", "()V");
12583         CHECK(LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth != NULL);
12584         LDKClosureReason_FundingBatchClosure_class =
12585                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingBatchClosure"));
12586         CHECK(LDKClosureReason_FundingBatchClosure_class != NULL);
12587         LDKClosureReason_FundingBatchClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingBatchClosure_class, "<init>", "()V");
12588         CHECK(LDKClosureReason_FundingBatchClosure_meth != NULL);
12589 }
12590 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12591         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
12592         switch(obj->tag) {
12593                 case LDKClosureReason_CounterpartyForceClosed: {
12594                         LDKUntrustedString peer_msg_var = obj->counterparty_force_closed.peer_msg;
12595                         int64_t peer_msg_ref = 0;
12596                         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_var);
12597                         peer_msg_ref = tag_ptr(peer_msg_var.inner, false);
12598                         return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_ref);
12599                 }
12600                 case LDKClosureReason_HolderForceClosed: {
12601                         return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
12602                 }
12603                 case LDKClosureReason_CooperativeClosure: {
12604                         return (*env)->NewObject(env, LDKClosureReason_CooperativeClosure_class, LDKClosureReason_CooperativeClosure_meth);
12605                 }
12606                 case LDKClosureReason_CommitmentTxConfirmed: {
12607                         return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
12608                 }
12609                 case LDKClosureReason_FundingTimedOut: {
12610                         return (*env)->NewObject(env, LDKClosureReason_FundingTimedOut_class, LDKClosureReason_FundingTimedOut_meth);
12611                 }
12612                 case LDKClosureReason_ProcessingError: {
12613                         LDKStr err_str = obj->processing_error.err;
12614                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
12615                         return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
12616                 }
12617                 case LDKClosureReason_DisconnectedPeer: {
12618                         return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
12619                 }
12620                 case LDKClosureReason_OutdatedChannelManager: {
12621                         return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
12622                 }
12623                 case LDKClosureReason_CounterpartyCoopClosedUnfundedChannel: {
12624                         return (*env)->NewObject(env, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth);
12625                 }
12626                 case LDKClosureReason_FundingBatchClosure: {
12627                         return (*env)->NewObject(env, LDKClosureReason_FundingBatchClosure_class, LDKClosureReason_FundingBatchClosure_meth);
12628                 }
12629                 default: abort();
12630         }
12631 }
12632 static jclass LDKCOption_ClosureReasonZ_Some_class = NULL;
12633 static jmethodID LDKCOption_ClosureReasonZ_Some_meth = NULL;
12634 static jclass LDKCOption_ClosureReasonZ_None_class = NULL;
12635 static jmethodID LDKCOption_ClosureReasonZ_None_meth = NULL;
12636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ClosureReasonZ_init (JNIEnv *env, jclass clz) {
12637         LDKCOption_ClosureReasonZ_Some_class =
12638                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$Some"));
12639         CHECK(LDKCOption_ClosureReasonZ_Some_class != NULL);
12640         LDKCOption_ClosureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_Some_class, "<init>", "(J)V");
12641         CHECK(LDKCOption_ClosureReasonZ_Some_meth != NULL);
12642         LDKCOption_ClosureReasonZ_None_class =
12643                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$None"));
12644         CHECK(LDKCOption_ClosureReasonZ_None_class != NULL);
12645         LDKCOption_ClosureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_None_class, "<init>", "()V");
12646         CHECK(LDKCOption_ClosureReasonZ_None_meth != NULL);
12647 }
12648 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ClosureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12649         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
12650         switch(obj->tag) {
12651                 case LDKCOption_ClosureReasonZ_Some: {
12652                         int64_t some_ref = tag_ptr(&obj->some, false);
12653                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_Some_class, LDKCOption_ClosureReasonZ_Some_meth, some_ref);
12654                 }
12655                 case LDKCOption_ClosureReasonZ_None: {
12656                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_None_class, LDKCOption_ClosureReasonZ_None_meth);
12657                 }
12658                 default: abort();
12659         }
12660 }
12661 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
12662 CHECK(owner->result_ok);
12663         return COption_ClosureReasonZ_clone(&*owner->contents.result);
12664 }
12665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12666         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
12667         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12668         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
12669         int64_t ret_ref = tag_ptr(ret_copy, true);
12670         return ret_ref;
12671 }
12672
12673 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
12674 CHECK(!owner->result_ok);
12675         return DecodeError_clone(&*owner->contents.err);
12676 }
12677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12678         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
12679         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12680         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
12681         int64_t ret_ref = tag_ptr(ret_copy, true);
12682         return ret_ref;
12683 }
12684
12685 static jclass LDKHTLCDestination_NextHopChannel_class = NULL;
12686 static jmethodID LDKHTLCDestination_NextHopChannel_meth = NULL;
12687 static jclass LDKHTLCDestination_UnknownNextHop_class = NULL;
12688 static jmethodID LDKHTLCDestination_UnknownNextHop_meth = NULL;
12689 static jclass LDKHTLCDestination_InvalidForward_class = NULL;
12690 static jmethodID LDKHTLCDestination_InvalidForward_meth = NULL;
12691 static jclass LDKHTLCDestination_FailedPayment_class = NULL;
12692 static jmethodID LDKHTLCDestination_FailedPayment_meth = NULL;
12693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCDestination_init (JNIEnv *env, jclass clz) {
12694         LDKHTLCDestination_NextHopChannel_class =
12695                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$NextHopChannel"));
12696         CHECK(LDKHTLCDestination_NextHopChannel_class != NULL);
12697         LDKHTLCDestination_NextHopChannel_meth = (*env)->GetMethodID(env, LDKHTLCDestination_NextHopChannel_class, "<init>", "([B[B)V");
12698         CHECK(LDKHTLCDestination_NextHopChannel_meth != NULL);
12699         LDKHTLCDestination_UnknownNextHop_class =
12700                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$UnknownNextHop"));
12701         CHECK(LDKHTLCDestination_UnknownNextHop_class != NULL);
12702         LDKHTLCDestination_UnknownNextHop_meth = (*env)->GetMethodID(env, LDKHTLCDestination_UnknownNextHop_class, "<init>", "(J)V");
12703         CHECK(LDKHTLCDestination_UnknownNextHop_meth != NULL);
12704         LDKHTLCDestination_InvalidForward_class =
12705                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$InvalidForward"));
12706         CHECK(LDKHTLCDestination_InvalidForward_class != NULL);
12707         LDKHTLCDestination_InvalidForward_meth = (*env)->GetMethodID(env, LDKHTLCDestination_InvalidForward_class, "<init>", "(J)V");
12708         CHECK(LDKHTLCDestination_InvalidForward_meth != NULL);
12709         LDKHTLCDestination_FailedPayment_class =
12710                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$FailedPayment"));
12711         CHECK(LDKHTLCDestination_FailedPayment_class != NULL);
12712         LDKHTLCDestination_FailedPayment_meth = (*env)->GetMethodID(env, LDKHTLCDestination_FailedPayment_class, "<init>", "([B)V");
12713         CHECK(LDKHTLCDestination_FailedPayment_meth != NULL);
12714 }
12715 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12716         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
12717         switch(obj->tag) {
12718                 case LDKHTLCDestination_NextHopChannel: {
12719                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
12720                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->next_hop_channel.node_id.compressed_form);
12721                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
12722                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->next_hop_channel.channel_id.data);
12723                         return (*env)->NewObject(env, LDKHTLCDestination_NextHopChannel_class, LDKHTLCDestination_NextHopChannel_meth, node_id_arr, channel_id_arr);
12724                 }
12725                 case LDKHTLCDestination_UnknownNextHop: {
12726                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
12727                         return (*env)->NewObject(env, LDKHTLCDestination_UnknownNextHop_class, LDKHTLCDestination_UnknownNextHop_meth, requested_forward_scid_conv);
12728                 }
12729                 case LDKHTLCDestination_InvalidForward: {
12730                         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
12731                         return (*env)->NewObject(env, LDKHTLCDestination_InvalidForward_class, LDKHTLCDestination_InvalidForward_meth, requested_forward_scid_conv);
12732                 }
12733                 case LDKHTLCDestination_FailedPayment: {
12734                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12735                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->failed_payment.payment_hash.data);
12736                         return (*env)->NewObject(env, LDKHTLCDestination_FailedPayment_class, LDKHTLCDestination_FailedPayment_meth, payment_hash_arr);
12737                 }
12738                 default: abort();
12739         }
12740 }
12741 static jclass LDKCOption_HTLCDestinationZ_Some_class = NULL;
12742 static jmethodID LDKCOption_HTLCDestinationZ_Some_meth = NULL;
12743 static jclass LDKCOption_HTLCDestinationZ_None_class = NULL;
12744 static jmethodID LDKCOption_HTLCDestinationZ_None_meth = NULL;
12745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCDestinationZ_init (JNIEnv *env, jclass clz) {
12746         LDKCOption_HTLCDestinationZ_Some_class =
12747                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$Some"));
12748         CHECK(LDKCOption_HTLCDestinationZ_Some_class != NULL);
12749         LDKCOption_HTLCDestinationZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_Some_class, "<init>", "(J)V");
12750         CHECK(LDKCOption_HTLCDestinationZ_Some_meth != NULL);
12751         LDKCOption_HTLCDestinationZ_None_class =
12752                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$None"));
12753         CHECK(LDKCOption_HTLCDestinationZ_None_class != NULL);
12754         LDKCOption_HTLCDestinationZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_None_class, "<init>", "()V");
12755         CHECK(LDKCOption_HTLCDestinationZ_None_meth != NULL);
12756 }
12757 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCDestinationZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12758         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
12759         switch(obj->tag) {
12760                 case LDKCOption_HTLCDestinationZ_Some: {
12761                         int64_t some_ref = tag_ptr(&obj->some, false);
12762                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_Some_class, LDKCOption_HTLCDestinationZ_Some_meth, some_ref);
12763                 }
12764                 case LDKCOption_HTLCDestinationZ_None: {
12765                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_None_class, LDKCOption_HTLCDestinationZ_None_meth);
12766                 }
12767                 default: abort();
12768         }
12769 }
12770 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
12771 CHECK(owner->result_ok);
12772         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
12773 }
12774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12775         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
12776         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
12777         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
12778         int64_t ret_ref = tag_ptr(ret_copy, true);
12779         return ret_ref;
12780 }
12781
12782 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
12783 CHECK(!owner->result_ok);
12784         return DecodeError_clone(&*owner->contents.err);
12785 }
12786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12787         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
12788         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12789         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
12790         int64_t ret_ref = tag_ptr(ret_copy, true);
12791         return ret_ref;
12792 }
12793
12794 static inline enum LDKPaymentFailureReason CResult_PaymentFailureReasonDecodeErrorZ_get_ok(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
12795 CHECK(owner->result_ok);
12796         return PaymentFailureReason_clone(&*owner->contents.result);
12797 }
12798 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12799         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
12800         jclass ret_conv = LDKPaymentFailureReason_to_java(env, CResult_PaymentFailureReasonDecodeErrorZ_get_ok(owner_conv));
12801         return ret_conv;
12802 }
12803
12804 static inline struct LDKDecodeError CResult_PaymentFailureReasonDecodeErrorZ_get_err(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
12805 CHECK(!owner->result_ok);
12806         return DecodeError_clone(&*owner->contents.err);
12807 }
12808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12809         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
12810         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12811         *ret_copy = CResult_PaymentFailureReasonDecodeErrorZ_get_err(owner_conv);
12812         int64_t ret_ref = tag_ptr(ret_copy, true);
12813         return ret_ref;
12814 }
12815
12816 static jclass LDKCOption_U128Z_Some_class = NULL;
12817 static jmethodID LDKCOption_U128Z_Some_meth = NULL;
12818 static jclass LDKCOption_U128Z_None_class = NULL;
12819 static jmethodID LDKCOption_U128Z_None_meth = NULL;
12820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1U128Z_init (JNIEnv *env, jclass clz) {
12821         LDKCOption_U128Z_Some_class =
12822                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_U128Z$Some"));
12823         CHECK(LDKCOption_U128Z_Some_class != NULL);
12824         LDKCOption_U128Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_U128Z_Some_class, "<init>", "([B)V");
12825         CHECK(LDKCOption_U128Z_Some_meth != NULL);
12826         LDKCOption_U128Z_None_class =
12827                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_U128Z$None"));
12828         CHECK(LDKCOption_U128Z_None_class != NULL);
12829         LDKCOption_U128Z_None_meth = (*env)->GetMethodID(env, LDKCOption_U128Z_None_class, "<init>", "()V");
12830         CHECK(LDKCOption_U128Z_None_meth != NULL);
12831 }
12832 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1U128Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12833         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
12834         switch(obj->tag) {
12835                 case LDKCOption_U128Z_Some: {
12836                         int8_tArray some_arr = (*env)->NewByteArray(env, 16);
12837                         (*env)->SetByteArrayRegion(env, some_arr, 0, 16, obj->some.le_bytes);
12838                         return (*env)->NewObject(env, LDKCOption_U128Z_Some_class, LDKCOption_U128Z_Some_meth, some_arr);
12839                 }
12840                 case LDKCOption_U128Z_None: {
12841                         return (*env)->NewObject(env, LDKCOption_U128Z_None_class, LDKCOption_U128Z_None_meth);
12842                 }
12843                 default: abort();
12844         }
12845 }
12846 static inline LDKCVec_ClaimedHTLCZ CVec_ClaimedHTLCZ_clone(const LDKCVec_ClaimedHTLCZ *orig) {
12847         LDKCVec_ClaimedHTLCZ ret = { .data = MALLOC(sizeof(LDKClaimedHTLC) * orig->datalen, "LDKCVec_ClaimedHTLCZ clone bytes"), .datalen = orig->datalen };
12848         for (size_t i = 0; i < ret.datalen; i++) {
12849                 ret.data[i] = ClaimedHTLC_clone(&orig->data[i]);
12850         }
12851         return ret;
12852 }
12853 static jclass LDKCOption_PaymentFailureReasonZ_Some_class = NULL;
12854 static jmethodID LDKCOption_PaymentFailureReasonZ_Some_meth = NULL;
12855 static jclass LDKCOption_PaymentFailureReasonZ_None_class = NULL;
12856 static jmethodID LDKCOption_PaymentFailureReasonZ_None_meth = NULL;
12857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PaymentFailureReasonZ_init (JNIEnv *env, jclass clz) {
12858         LDKCOption_PaymentFailureReasonZ_Some_class =
12859                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentFailureReasonZ$Some"));
12860         CHECK(LDKCOption_PaymentFailureReasonZ_Some_class != NULL);
12861         LDKCOption_PaymentFailureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PaymentFailureReasonZ_Some_class, "<init>", "(Lorg/ldk/enums/PaymentFailureReason;)V");
12862         CHECK(LDKCOption_PaymentFailureReasonZ_Some_meth != NULL);
12863         LDKCOption_PaymentFailureReasonZ_None_class =
12864                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentFailureReasonZ$None"));
12865         CHECK(LDKCOption_PaymentFailureReasonZ_None_class != NULL);
12866         LDKCOption_PaymentFailureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PaymentFailureReasonZ_None_class, "<init>", "()V");
12867         CHECK(LDKCOption_PaymentFailureReasonZ_None_meth != NULL);
12868 }
12869 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PaymentFailureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12870         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
12871         switch(obj->tag) {
12872                 case LDKCOption_PaymentFailureReasonZ_Some: {
12873                         jclass some_conv = LDKPaymentFailureReason_to_java(env, obj->some);
12874                         return (*env)->NewObject(env, LDKCOption_PaymentFailureReasonZ_Some_class, LDKCOption_PaymentFailureReasonZ_Some_meth, some_conv);
12875                 }
12876                 case LDKCOption_PaymentFailureReasonZ_None: {
12877                         return (*env)->NewObject(env, LDKCOption_PaymentFailureReasonZ_None_class, LDKCOption_PaymentFailureReasonZ_None_meth);
12878                 }
12879                 default: abort();
12880         }
12881 }
12882 static jclass LDKBumpTransactionEvent_ChannelClose_class = NULL;
12883 static jmethodID LDKBumpTransactionEvent_ChannelClose_meth = NULL;
12884 static jclass LDKBumpTransactionEvent_HTLCResolution_class = NULL;
12885 static jmethodID LDKBumpTransactionEvent_HTLCResolution_meth = NULL;
12886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBumpTransactionEvent_init (JNIEnv *env, jclass clz) {
12887         LDKBumpTransactionEvent_ChannelClose_class =
12888                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBumpTransactionEvent$ChannelClose"));
12889         CHECK(LDKBumpTransactionEvent_ChannelClose_class != NULL);
12890         LDKBumpTransactionEvent_ChannelClose_meth = (*env)->GetMethodID(env, LDKBumpTransactionEvent_ChannelClose_class, "<init>", "([BI[BJJ[J)V");
12891         CHECK(LDKBumpTransactionEvent_ChannelClose_meth != NULL);
12892         LDKBumpTransactionEvent_HTLCResolution_class =
12893                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBumpTransactionEvent$HTLCResolution"));
12894         CHECK(LDKBumpTransactionEvent_HTLCResolution_class != NULL);
12895         LDKBumpTransactionEvent_HTLCResolution_meth = (*env)->GetMethodID(env, LDKBumpTransactionEvent_HTLCResolution_class, "<init>", "([BI[JI)V");
12896         CHECK(LDKBumpTransactionEvent_HTLCResolution_meth != NULL);
12897 }
12898 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBumpTransactionEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12899         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
12900         switch(obj->tag) {
12901                 case LDKBumpTransactionEvent_ChannelClose: {
12902                         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
12903                         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, obj->channel_close.claim_id.data);
12904                         int32_t package_target_feerate_sat_per_1000_weight_conv = obj->channel_close.package_target_feerate_sat_per_1000_weight;
12905                         LDKTransaction commitment_tx_var = obj->channel_close.commitment_tx;
12906                         int8_tArray commitment_tx_arr = (*env)->NewByteArray(env, commitment_tx_var.datalen);
12907                         (*env)->SetByteArrayRegion(env, commitment_tx_arr, 0, commitment_tx_var.datalen, commitment_tx_var.data);
12908                         int64_t commitment_tx_fee_satoshis_conv = obj->channel_close.commitment_tx_fee_satoshis;
12909                         LDKAnchorDescriptor anchor_descriptor_var = obj->channel_close.anchor_descriptor;
12910                         int64_t anchor_descriptor_ref = 0;
12911                         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_var);
12912                         anchor_descriptor_ref = tag_ptr(anchor_descriptor_var.inner, false);
12913                         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_var = obj->channel_close.pending_htlcs;
12914                         int64_tArray pending_htlcs_arr = NULL;
12915                         pending_htlcs_arr = (*env)->NewLongArray(env, pending_htlcs_var.datalen);
12916                         int64_t *pending_htlcs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, pending_htlcs_arr, NULL);
12917                         for (size_t y = 0; y < pending_htlcs_var.datalen; y++) {
12918                                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_var = pending_htlcs_var.data[y];
12919                                 int64_t pending_htlcs_conv_24_ref = 0;
12920                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_var);
12921                                 pending_htlcs_conv_24_ref = tag_ptr(pending_htlcs_conv_24_var.inner, false);
12922                                 pending_htlcs_arr_ptr[y] = pending_htlcs_conv_24_ref;
12923                         }
12924                         (*env)->ReleasePrimitiveArrayCritical(env, pending_htlcs_arr, pending_htlcs_arr_ptr, 0);
12925                         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);
12926                 }
12927                 case LDKBumpTransactionEvent_HTLCResolution: {
12928                         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
12929                         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, obj->htlc_resolution.claim_id.data);
12930                         int32_t target_feerate_sat_per_1000_weight_conv = obj->htlc_resolution.target_feerate_sat_per_1000_weight;
12931                         LDKCVec_HTLCDescriptorZ htlc_descriptors_var = obj->htlc_resolution.htlc_descriptors;
12932                         int64_tArray htlc_descriptors_arr = NULL;
12933                         htlc_descriptors_arr = (*env)->NewLongArray(env, htlc_descriptors_var.datalen);
12934                         int64_t *htlc_descriptors_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, htlc_descriptors_arr, NULL);
12935                         for (size_t q = 0; q < htlc_descriptors_var.datalen; q++) {
12936                                 LDKHTLCDescriptor htlc_descriptors_conv_16_var = htlc_descriptors_var.data[q];
12937                                 int64_t htlc_descriptors_conv_16_ref = 0;
12938                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_var);
12939                                 htlc_descriptors_conv_16_ref = tag_ptr(htlc_descriptors_conv_16_var.inner, false);
12940                                 htlc_descriptors_arr_ptr[q] = htlc_descriptors_conv_16_ref;
12941                         }
12942                         (*env)->ReleasePrimitiveArrayCritical(env, htlc_descriptors_arr, htlc_descriptors_arr_ptr, 0);
12943                         int32_t tx_lock_time_conv = obj->htlc_resolution.tx_lock_time;
12944                         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);
12945                 }
12946                 default: abort();
12947         }
12948 }
12949 static jclass LDKEvent_FundingGenerationReady_class = NULL;
12950 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
12951 static jclass LDKEvent_PaymentClaimable_class = NULL;
12952 static jmethodID LDKEvent_PaymentClaimable_meth = NULL;
12953 static jclass LDKEvent_PaymentClaimed_class = NULL;
12954 static jmethodID LDKEvent_PaymentClaimed_meth = NULL;
12955 static jclass LDKEvent_InvoiceRequestFailed_class = NULL;
12956 static jmethodID LDKEvent_InvoiceRequestFailed_meth = NULL;
12957 static jclass LDKEvent_PaymentSent_class = NULL;
12958 static jmethodID LDKEvent_PaymentSent_meth = NULL;
12959 static jclass LDKEvent_PaymentFailed_class = NULL;
12960 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
12961 static jclass LDKEvent_PaymentPathSuccessful_class = NULL;
12962 static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL;
12963 static jclass LDKEvent_PaymentPathFailed_class = NULL;
12964 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
12965 static jclass LDKEvent_ProbeSuccessful_class = NULL;
12966 static jmethodID LDKEvent_ProbeSuccessful_meth = NULL;
12967 static jclass LDKEvent_ProbeFailed_class = NULL;
12968 static jmethodID LDKEvent_ProbeFailed_meth = NULL;
12969 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
12970 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
12971 static jclass LDKEvent_HTLCIntercepted_class = NULL;
12972 static jmethodID LDKEvent_HTLCIntercepted_meth = NULL;
12973 static jclass LDKEvent_SpendableOutputs_class = NULL;
12974 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
12975 static jclass LDKEvent_PaymentForwarded_class = NULL;
12976 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
12977 static jclass LDKEvent_ChannelPending_class = NULL;
12978 static jmethodID LDKEvent_ChannelPending_meth = NULL;
12979 static jclass LDKEvent_ChannelReady_class = NULL;
12980 static jmethodID LDKEvent_ChannelReady_meth = NULL;
12981 static jclass LDKEvent_ChannelClosed_class = NULL;
12982 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
12983 static jclass LDKEvent_DiscardFunding_class = NULL;
12984 static jmethodID LDKEvent_DiscardFunding_meth = NULL;
12985 static jclass LDKEvent_OpenChannelRequest_class = NULL;
12986 static jmethodID LDKEvent_OpenChannelRequest_meth = NULL;
12987 static jclass LDKEvent_HTLCHandlingFailed_class = NULL;
12988 static jmethodID LDKEvent_HTLCHandlingFailed_meth = NULL;
12989 static jclass LDKEvent_BumpTransaction_class = NULL;
12990 static jmethodID LDKEvent_BumpTransaction_meth = NULL;
12991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
12992         LDKEvent_FundingGenerationReady_class =
12993                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady"));
12994         CHECK(LDKEvent_FundingGenerationReady_class != NULL);
12995         LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([B[BJ[B[B)V");
12996         CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
12997         LDKEvent_PaymentClaimable_class =
12998                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimable"));
12999         CHECK(LDKEvent_PaymentClaimable_class != NULL);
13000         LDKEvent_PaymentClaimable_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimable_class, "<init>", "([B[BJJJJJJJ)V");
13001         CHECK(LDKEvent_PaymentClaimable_meth != NULL);
13002         LDKEvent_PaymentClaimed_class =
13003                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimed"));
13004         CHECK(LDKEvent_PaymentClaimed_class != NULL);
13005         LDKEvent_PaymentClaimed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimed_class, "<init>", "([B[BJJ[JJ)V");
13006         CHECK(LDKEvent_PaymentClaimed_meth != NULL);
13007         LDKEvent_InvoiceRequestFailed_class =
13008                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$InvoiceRequestFailed"));
13009         CHECK(LDKEvent_InvoiceRequestFailed_class != NULL);
13010         LDKEvent_InvoiceRequestFailed_meth = (*env)->GetMethodID(env, LDKEvent_InvoiceRequestFailed_class, "<init>", "([B)V");
13011         CHECK(LDKEvent_InvoiceRequestFailed_meth != NULL);
13012         LDKEvent_PaymentSent_class =
13013                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentSent"));
13014         CHECK(LDKEvent_PaymentSent_class != NULL);
13015         LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "(J[B[BJ)V");
13016         CHECK(LDKEvent_PaymentSent_meth != NULL);
13017         LDKEvent_PaymentFailed_class =
13018                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentFailed"));
13019         CHECK(LDKEvent_PaymentFailed_class != NULL);
13020         LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([B[BJ)V");
13021         CHECK(LDKEvent_PaymentFailed_meth != NULL);
13022         LDKEvent_PaymentPathSuccessful_class =
13023                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathSuccessful"));
13024         CHECK(LDKEvent_PaymentPathSuccessful_class != NULL);
13025         LDKEvent_PaymentPathSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathSuccessful_class, "<init>", "([BJJ)V");
13026         CHECK(LDKEvent_PaymentPathSuccessful_meth != NULL);
13027         LDKEvent_PaymentPathFailed_class =
13028                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathFailed"));
13029         CHECK(LDKEvent_PaymentPathFailed_class != NULL);
13030         LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "(J[BZJJJ)V");
13031         CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
13032         LDKEvent_ProbeSuccessful_class =
13033                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeSuccessful"));
13034         CHECK(LDKEvent_ProbeSuccessful_class != NULL);
13035         LDKEvent_ProbeSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_ProbeSuccessful_class, "<init>", "([B[BJ)V");
13036         CHECK(LDKEvent_ProbeSuccessful_meth != NULL);
13037         LDKEvent_ProbeFailed_class =
13038                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeFailed"));
13039         CHECK(LDKEvent_ProbeFailed_class != NULL);
13040         LDKEvent_ProbeFailed_meth = (*env)->GetMethodID(env, LDKEvent_ProbeFailed_class, "<init>", "([B[BJJ)V");
13041         CHECK(LDKEvent_ProbeFailed_meth != NULL);
13042         LDKEvent_PendingHTLCsForwardable_class =
13043                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable"));
13044         CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
13045         LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
13046         CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
13047         LDKEvent_HTLCIntercepted_class =
13048                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCIntercepted"));
13049         CHECK(LDKEvent_HTLCIntercepted_class != NULL);
13050         LDKEvent_HTLCIntercepted_meth = (*env)->GetMethodID(env, LDKEvent_HTLCIntercepted_class, "<init>", "([BJ[BJJ)V");
13051         CHECK(LDKEvent_HTLCIntercepted_meth != NULL);
13052         LDKEvent_SpendableOutputs_class =
13053                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$SpendableOutputs"));
13054         CHECK(LDKEvent_SpendableOutputs_class != NULL);
13055         LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([JJ)V");
13056         CHECK(LDKEvent_SpendableOutputs_meth != NULL);
13057         LDKEvent_PaymentForwarded_class =
13058                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentForwarded"));
13059         CHECK(LDKEvent_PaymentForwarded_class != NULL);
13060         LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "(JJJZJ)V");
13061         CHECK(LDKEvent_PaymentForwarded_meth != NULL);
13062         LDKEvent_ChannelPending_class =
13063                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelPending"));
13064         CHECK(LDKEvent_ChannelPending_class != NULL);
13065         LDKEvent_ChannelPending_meth = (*env)->GetMethodID(env, LDKEvent_ChannelPending_class, "<init>", "([B[BJ[BJ)V");
13066         CHECK(LDKEvent_ChannelPending_meth != NULL);
13067         LDKEvent_ChannelReady_class =
13068                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelReady"));
13069         CHECK(LDKEvent_ChannelReady_class != NULL);
13070         LDKEvent_ChannelReady_meth = (*env)->GetMethodID(env, LDKEvent_ChannelReady_class, "<init>", "([B[B[BJ)V");
13071         CHECK(LDKEvent_ChannelReady_meth != NULL);
13072         LDKEvent_ChannelClosed_class =
13073                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelClosed"));
13074         CHECK(LDKEvent_ChannelClosed_class != NULL);
13075         LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "([B[BJ[BJ)V");
13076         CHECK(LDKEvent_ChannelClosed_meth != NULL);
13077         LDKEvent_DiscardFunding_class =
13078                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$DiscardFunding"));
13079         CHECK(LDKEvent_DiscardFunding_class != NULL);
13080         LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "<init>", "([B[B)V");
13081         CHECK(LDKEvent_DiscardFunding_meth != NULL);
13082         LDKEvent_OpenChannelRequest_class =
13083                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$OpenChannelRequest"));
13084         CHECK(LDKEvent_OpenChannelRequest_class != NULL);
13085         LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "<init>", "([B[BJJJ)V");
13086         CHECK(LDKEvent_OpenChannelRequest_meth != NULL);
13087         LDKEvent_HTLCHandlingFailed_class =
13088                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCHandlingFailed"));
13089         CHECK(LDKEvent_HTLCHandlingFailed_class != NULL);
13090         LDKEvent_HTLCHandlingFailed_meth = (*env)->GetMethodID(env, LDKEvent_HTLCHandlingFailed_class, "<init>", "([BJ)V");
13091         CHECK(LDKEvent_HTLCHandlingFailed_meth != NULL);
13092         LDKEvent_BumpTransaction_class =
13093                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$BumpTransaction"));
13094         CHECK(LDKEvent_BumpTransaction_class != NULL);
13095         LDKEvent_BumpTransaction_meth = (*env)->GetMethodID(env, LDKEvent_BumpTransaction_class, "<init>", "(J)V");
13096         CHECK(LDKEvent_BumpTransaction_meth != NULL);
13097 }
13098 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13099         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
13100         switch(obj->tag) {
13101                 case LDKEvent_FundingGenerationReady: {
13102                         int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
13103                         (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
13104                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
13105                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->funding_generation_ready.counterparty_node_id.compressed_form);
13106                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
13107                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
13108                         int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
13109                         (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
13110                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
13111                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->funding_generation_ready.user_channel_id.le_bytes);
13112                         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);
13113                 }
13114                 case LDKEvent_PaymentClaimable: {
13115                         int8_tArray receiver_node_id_arr = (*env)->NewByteArray(env, 33);
13116                         (*env)->SetByteArrayRegion(env, receiver_node_id_arr, 0, 33, obj->payment_claimable.receiver_node_id.compressed_form);
13117                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13118                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimable.payment_hash.data);
13119                         LDKRecipientOnionFields onion_fields_var = obj->payment_claimable.onion_fields;
13120                         int64_t onion_fields_ref = 0;
13121                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_var);
13122                         onion_fields_ref = tag_ptr(onion_fields_var.inner, false);
13123                         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
13124                         int64_t counterparty_skimmed_fee_msat_conv = obj->payment_claimable.counterparty_skimmed_fee_msat;
13125                         int64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
13126                         int64_t via_channel_id_ref = tag_ptr(&obj->payment_claimable.via_channel_id, false);
13127                         int64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
13128                         int64_t claim_deadline_ref = tag_ptr(&obj->payment_claimable.claim_deadline, false);
13129                         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);
13130                 }
13131                 case LDKEvent_PaymentClaimed: {
13132                         int8_tArray receiver_node_id_arr = (*env)->NewByteArray(env, 33);
13133                         (*env)->SetByteArrayRegion(env, receiver_node_id_arr, 0, 33, obj->payment_claimed.receiver_node_id.compressed_form);
13134                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13135                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimed.payment_hash.data);
13136                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
13137                         int64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
13138                         LDKCVec_ClaimedHTLCZ htlcs_var = obj->payment_claimed.htlcs;
13139                         int64_tArray htlcs_arr = NULL;
13140                         htlcs_arr = (*env)->NewLongArray(env, htlcs_var.datalen);
13141                         int64_t *htlcs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, htlcs_arr, NULL);
13142                         for (size_t n = 0; n < htlcs_var.datalen; n++) {
13143                                 LDKClaimedHTLC htlcs_conv_13_var = htlcs_var.data[n];
13144                                 int64_t htlcs_conv_13_ref = 0;
13145                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_var);
13146                                 htlcs_conv_13_ref = tag_ptr(htlcs_conv_13_var.inner, false);
13147                                 htlcs_arr_ptr[n] = htlcs_conv_13_ref;
13148                         }
13149                         (*env)->ReleasePrimitiveArrayCritical(env, htlcs_arr, htlcs_arr_ptr, 0);
13150                         int64_t sender_intended_total_msat_ref = tag_ptr(&obj->payment_claimed.sender_intended_total_msat, false);
13151                         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);
13152                 }
13153                 case LDKEvent_InvoiceRequestFailed: {
13154                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
13155                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->invoice_request_failed.payment_id.data);
13156                         return (*env)->NewObject(env, LDKEvent_InvoiceRequestFailed_class, LDKEvent_InvoiceRequestFailed_meth, payment_id_arr);
13157                 }
13158                 case LDKEvent_PaymentSent: {
13159                         int64_t payment_id_ref = tag_ptr(&obj->payment_sent.payment_id, false);
13160                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
13161                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
13162                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13163                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data);
13164                         int64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
13165                         return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_id_ref, payment_preimage_arr, payment_hash_arr, fee_paid_msat_ref);
13166                 }
13167                 case LDKEvent_PaymentFailed: {
13168                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
13169                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_failed.payment_id.data);
13170                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13171                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
13172                         int64_t reason_ref = tag_ptr(&obj->payment_failed.reason, false);
13173                         return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_id_arr, payment_hash_arr, reason_ref);
13174                 }
13175                 case LDKEvent_PaymentPathSuccessful: {
13176                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
13177                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_successful.payment_id.data);
13178                         int64_t payment_hash_ref = tag_ptr(&obj->payment_path_successful.payment_hash, false);
13179                         LDKPath path_var = obj->payment_path_successful.path;
13180                         int64_t path_ref = 0;
13181                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
13182                         path_ref = tag_ptr(path_var.inner, false);
13183                         return (*env)->NewObject(env, LDKEvent_PaymentPathSuccessful_class, LDKEvent_PaymentPathSuccessful_meth, payment_id_arr, payment_hash_ref, path_ref);
13184                 }
13185                 case LDKEvent_PaymentPathFailed: {
13186                         int64_t payment_id_ref = tag_ptr(&obj->payment_path_failed.payment_id, false);
13187                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13188                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
13189                         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
13190                         int64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
13191                         LDKPath path_var = obj->payment_path_failed.path;
13192                         int64_t path_ref = 0;
13193                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
13194                         path_ref = tag_ptr(path_var.inner, false);
13195                         int64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
13196                         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);
13197                 }
13198                 case LDKEvent_ProbeSuccessful: {
13199                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
13200                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_successful.payment_id.data);
13201                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13202                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_successful.payment_hash.data);
13203                         LDKPath path_var = obj->probe_successful.path;
13204                         int64_t path_ref = 0;
13205                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
13206                         path_ref = tag_ptr(path_var.inner, false);
13207                         return (*env)->NewObject(env, LDKEvent_ProbeSuccessful_class, LDKEvent_ProbeSuccessful_meth, payment_id_arr, payment_hash_arr, path_ref);
13208                 }
13209                 case LDKEvent_ProbeFailed: {
13210                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
13211                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_failed.payment_id.data);
13212                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13213                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_failed.payment_hash.data);
13214                         LDKPath path_var = obj->probe_failed.path;
13215                         int64_t path_ref = 0;
13216                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
13217                         path_ref = tag_ptr(path_var.inner, false);
13218                         int64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
13219                         return (*env)->NewObject(env, LDKEvent_ProbeFailed_class, LDKEvent_ProbeFailed_meth, payment_id_arr, payment_hash_arr, path_ref, short_channel_id_ref);
13220                 }
13221                 case LDKEvent_PendingHTLCsForwardable: {
13222                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
13223                         return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, time_forwardable_conv);
13224                 }
13225                 case LDKEvent_HTLCIntercepted: {
13226                         int8_tArray intercept_id_arr = (*env)->NewByteArray(env, 32);
13227                         (*env)->SetByteArrayRegion(env, intercept_id_arr, 0, 32, obj->htlc_intercepted.intercept_id.data);
13228                         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
13229                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13230                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->htlc_intercepted.payment_hash.data);
13231                         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
13232                         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
13233                         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);
13234                 }
13235                 case LDKEvent_SpendableOutputs: {
13236                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
13237                         int64_tArray outputs_arr = NULL;
13238                         outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
13239                         int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
13240                         for (size_t b = 0; b < outputs_var.datalen; b++) {
13241                                 int64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
13242                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
13243                         }
13244                         (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
13245                         int64_t channel_id_ref = tag_ptr(&obj->spendable_outputs.channel_id, false);
13246                         return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr, channel_id_ref);
13247                 }
13248                 case LDKEvent_PaymentForwarded: {
13249                         int64_t prev_channel_id_ref = tag_ptr(&obj->payment_forwarded.prev_channel_id, false);
13250                         int64_t next_channel_id_ref = tag_ptr(&obj->payment_forwarded.next_channel_id, false);
13251                         int64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
13252                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
13253                         int64_t outbound_amount_forwarded_msat_ref = tag_ptr(&obj->payment_forwarded.outbound_amount_forwarded_msat, false);
13254                         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);
13255                 }
13256                 case LDKEvent_ChannelPending: {
13257                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
13258                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_pending.channel_id.data);
13259                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
13260                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_pending.user_channel_id.le_bytes);
13261                         int64_t former_temporary_channel_id_ref = tag_ptr(&obj->channel_pending.former_temporary_channel_id, false);
13262                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
13263                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_pending.counterparty_node_id.compressed_form);
13264                         LDKOutPoint funding_txo_var = obj->channel_pending.funding_txo;
13265                         int64_t funding_txo_ref = 0;
13266                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
13267                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
13268                         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);
13269                 }
13270                 case LDKEvent_ChannelReady: {
13271                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
13272                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_ready.channel_id.data);
13273                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
13274                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_ready.user_channel_id.le_bytes);
13275                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
13276                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_ready.counterparty_node_id.compressed_form);
13277                         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
13278                         int64_t channel_type_ref = 0;
13279                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
13280                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
13281                         return (*env)->NewObject(env, LDKEvent_ChannelReady_class, LDKEvent_ChannelReady_meth, channel_id_arr, user_channel_id_arr, counterparty_node_id_arr, channel_type_ref);
13282                 }
13283                 case LDKEvent_ChannelClosed: {
13284                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
13285                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data);
13286                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
13287                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_closed.user_channel_id.le_bytes);
13288                         int64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
13289                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
13290                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_closed.counterparty_node_id.compressed_form);
13291                         int64_t channel_capacity_sats_ref = tag_ptr(&obj->channel_closed.channel_capacity_sats, false);
13292                         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);
13293                 }
13294                 case LDKEvent_DiscardFunding: {
13295                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
13296                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->discard_funding.channel_id.data);
13297                         LDKTransaction transaction_var = obj->discard_funding.transaction;
13298                         int8_tArray transaction_arr = (*env)->NewByteArray(env, transaction_var.datalen);
13299                         (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data);
13300                         return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_arr, transaction_arr);
13301                 }
13302                 case LDKEvent_OpenChannelRequest: {
13303                         int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
13304                         (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->open_channel_request.temporary_channel_id.data);
13305                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
13306                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->open_channel_request.counterparty_node_id.compressed_form);
13307                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
13308                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
13309                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
13310                         int64_t channel_type_ref = 0;
13311                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
13312                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
13313                         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);
13314                 }
13315                 case LDKEvent_HTLCHandlingFailed: {
13316                         int8_tArray prev_channel_id_arr = (*env)->NewByteArray(env, 32);
13317                         (*env)->SetByteArrayRegion(env, prev_channel_id_arr, 0, 32, obj->htlc_handling_failed.prev_channel_id.data);
13318                         int64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
13319                         return (*env)->NewObject(env, LDKEvent_HTLCHandlingFailed_class, LDKEvent_HTLCHandlingFailed_meth, prev_channel_id_arr, failed_next_destination_ref);
13320                 }
13321                 case LDKEvent_BumpTransaction: {
13322                         int64_t bump_transaction_ref = tag_ptr(&obj->bump_transaction, false);
13323                         return (*env)->NewObject(env, LDKEvent_BumpTransaction_class, LDKEvent_BumpTransaction_meth, bump_transaction_ref);
13324                 }
13325                 default: abort();
13326         }
13327 }
13328 static jclass LDKCOption_EventZ_Some_class = NULL;
13329 static jmethodID LDKCOption_EventZ_Some_meth = NULL;
13330 static jclass LDKCOption_EventZ_None_class = NULL;
13331 static jmethodID LDKCOption_EventZ_None_meth = NULL;
13332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1EventZ_init (JNIEnv *env, jclass clz) {
13333         LDKCOption_EventZ_Some_class =
13334                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$Some"));
13335         CHECK(LDKCOption_EventZ_Some_class != NULL);
13336         LDKCOption_EventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_Some_class, "<init>", "(J)V");
13337         CHECK(LDKCOption_EventZ_Some_meth != NULL);
13338         LDKCOption_EventZ_None_class =
13339                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$None"));
13340         CHECK(LDKCOption_EventZ_None_class != NULL);
13341         LDKCOption_EventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_None_class, "<init>", "()V");
13342         CHECK(LDKCOption_EventZ_None_meth != NULL);
13343 }
13344 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1EventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13345         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
13346         switch(obj->tag) {
13347                 case LDKCOption_EventZ_Some: {
13348                         int64_t some_ref = tag_ptr(&obj->some, false);
13349                         return (*env)->NewObject(env, LDKCOption_EventZ_Some_class, LDKCOption_EventZ_Some_meth, some_ref);
13350                 }
13351                 case LDKCOption_EventZ_None: {
13352                         return (*env)->NewObject(env, LDKCOption_EventZ_None_class, LDKCOption_EventZ_None_meth);
13353                 }
13354                 default: abort();
13355         }
13356 }
13357 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
13358 CHECK(owner->result_ok);
13359         return COption_EventZ_clone(&*owner->contents.result);
13360 }
13361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13362         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
13363         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13364         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
13365         int64_t ret_ref = tag_ptr(ret_copy, true);
13366         return ret_ref;
13367 }
13368
13369 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
13370 CHECK(!owner->result_ok);
13371         return DecodeError_clone(&*owner->contents.err);
13372 }
13373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13374         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
13375         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13376         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
13377         int64_t ret_ref = tag_ptr(ret_copy, true);
13378         return ret_ref;
13379 }
13380
13381 static jclass LDKBolt11ParseError_Bech32Error_class = NULL;
13382 static jmethodID LDKBolt11ParseError_Bech32Error_meth = NULL;
13383 static jclass LDKBolt11ParseError_ParseAmountError_class = NULL;
13384 static jmethodID LDKBolt11ParseError_ParseAmountError_meth = NULL;
13385 static jclass LDKBolt11ParseError_MalformedSignature_class = NULL;
13386 static jmethodID LDKBolt11ParseError_MalformedSignature_meth = NULL;
13387 static jclass LDKBolt11ParseError_BadPrefix_class = NULL;
13388 static jmethodID LDKBolt11ParseError_BadPrefix_meth = NULL;
13389 static jclass LDKBolt11ParseError_UnknownCurrency_class = NULL;
13390 static jmethodID LDKBolt11ParseError_UnknownCurrency_meth = NULL;
13391 static jclass LDKBolt11ParseError_UnknownSiPrefix_class = NULL;
13392 static jmethodID LDKBolt11ParseError_UnknownSiPrefix_meth = NULL;
13393 static jclass LDKBolt11ParseError_MalformedHRP_class = NULL;
13394 static jmethodID LDKBolt11ParseError_MalformedHRP_meth = NULL;
13395 static jclass LDKBolt11ParseError_TooShortDataPart_class = NULL;
13396 static jmethodID LDKBolt11ParseError_TooShortDataPart_meth = NULL;
13397 static jclass LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class = NULL;
13398 static jmethodID LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth = NULL;
13399 static jclass LDKBolt11ParseError_DescriptionDecodeError_class = NULL;
13400 static jmethodID LDKBolt11ParseError_DescriptionDecodeError_meth = NULL;
13401 static jclass LDKBolt11ParseError_PaddingError_class = NULL;
13402 static jmethodID LDKBolt11ParseError_PaddingError_meth = NULL;
13403 static jclass LDKBolt11ParseError_IntegerOverflowError_class = NULL;
13404 static jmethodID LDKBolt11ParseError_IntegerOverflowError_meth = NULL;
13405 static jclass LDKBolt11ParseError_InvalidSegWitProgramLength_class = NULL;
13406 static jmethodID LDKBolt11ParseError_InvalidSegWitProgramLength_meth = NULL;
13407 static jclass LDKBolt11ParseError_InvalidPubKeyHashLength_class = NULL;
13408 static jmethodID LDKBolt11ParseError_InvalidPubKeyHashLength_meth = NULL;
13409 static jclass LDKBolt11ParseError_InvalidScriptHashLength_class = NULL;
13410 static jmethodID LDKBolt11ParseError_InvalidScriptHashLength_meth = NULL;
13411 static jclass LDKBolt11ParseError_InvalidRecoveryId_class = NULL;
13412 static jmethodID LDKBolt11ParseError_InvalidRecoveryId_meth = NULL;
13413 static jclass LDKBolt11ParseError_InvalidSliceLength_class = NULL;
13414 static jmethodID LDKBolt11ParseError_InvalidSliceLength_meth = NULL;
13415 static jclass LDKBolt11ParseError_Skip_class = NULL;
13416 static jmethodID LDKBolt11ParseError_Skip_meth = NULL;
13417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBolt11ParseError_init (JNIEnv *env, jclass clz) {
13418         LDKBolt11ParseError_Bech32Error_class =
13419                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$Bech32Error"));
13420         CHECK(LDKBolt11ParseError_Bech32Error_class != NULL);
13421         LDKBolt11ParseError_Bech32Error_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_Bech32Error_class, "<init>", "(J)V");
13422         CHECK(LDKBolt11ParseError_Bech32Error_meth != NULL);
13423         LDKBolt11ParseError_ParseAmountError_class =
13424                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$ParseAmountError"));
13425         CHECK(LDKBolt11ParseError_ParseAmountError_class != NULL);
13426         LDKBolt11ParseError_ParseAmountError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_ParseAmountError_class, "<init>", "(I)V");
13427         CHECK(LDKBolt11ParseError_ParseAmountError_meth != NULL);
13428         LDKBolt11ParseError_MalformedSignature_class =
13429                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$MalformedSignature"));
13430         CHECK(LDKBolt11ParseError_MalformedSignature_class != NULL);
13431         LDKBolt11ParseError_MalformedSignature_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_MalformedSignature_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
13432         CHECK(LDKBolt11ParseError_MalformedSignature_meth != NULL);
13433         LDKBolt11ParseError_BadPrefix_class =
13434                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$BadPrefix"));
13435         CHECK(LDKBolt11ParseError_BadPrefix_class != NULL);
13436         LDKBolt11ParseError_BadPrefix_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_BadPrefix_class, "<init>", "()V");
13437         CHECK(LDKBolt11ParseError_BadPrefix_meth != NULL);
13438         LDKBolt11ParseError_UnknownCurrency_class =
13439                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnknownCurrency"));
13440         CHECK(LDKBolt11ParseError_UnknownCurrency_class != NULL);
13441         LDKBolt11ParseError_UnknownCurrency_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnknownCurrency_class, "<init>", "()V");
13442         CHECK(LDKBolt11ParseError_UnknownCurrency_meth != NULL);
13443         LDKBolt11ParseError_UnknownSiPrefix_class =
13444                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnknownSiPrefix"));
13445         CHECK(LDKBolt11ParseError_UnknownSiPrefix_class != NULL);
13446         LDKBolt11ParseError_UnknownSiPrefix_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnknownSiPrefix_class, "<init>", "()V");
13447         CHECK(LDKBolt11ParseError_UnknownSiPrefix_meth != NULL);
13448         LDKBolt11ParseError_MalformedHRP_class =
13449                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$MalformedHRP"));
13450         CHECK(LDKBolt11ParseError_MalformedHRP_class != NULL);
13451         LDKBolt11ParseError_MalformedHRP_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_MalformedHRP_class, "<init>", "()V");
13452         CHECK(LDKBolt11ParseError_MalformedHRP_meth != NULL);
13453         LDKBolt11ParseError_TooShortDataPart_class =
13454                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$TooShortDataPart"));
13455         CHECK(LDKBolt11ParseError_TooShortDataPart_class != NULL);
13456         LDKBolt11ParseError_TooShortDataPart_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_TooShortDataPart_class, "<init>", "()V");
13457         CHECK(LDKBolt11ParseError_TooShortDataPart_meth != NULL);
13458         LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class =
13459                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnexpectedEndOfTaggedFields"));
13460         CHECK(LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class != NULL);
13461         LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class, "<init>", "()V");
13462         CHECK(LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth != NULL);
13463         LDKBolt11ParseError_DescriptionDecodeError_class =
13464                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$DescriptionDecodeError"));
13465         CHECK(LDKBolt11ParseError_DescriptionDecodeError_class != NULL);
13466         LDKBolt11ParseError_DescriptionDecodeError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_DescriptionDecodeError_class, "<init>", "(I)V");
13467         CHECK(LDKBolt11ParseError_DescriptionDecodeError_meth != NULL);
13468         LDKBolt11ParseError_PaddingError_class =
13469                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$PaddingError"));
13470         CHECK(LDKBolt11ParseError_PaddingError_class != NULL);
13471         LDKBolt11ParseError_PaddingError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_PaddingError_class, "<init>", "()V");
13472         CHECK(LDKBolt11ParseError_PaddingError_meth != NULL);
13473         LDKBolt11ParseError_IntegerOverflowError_class =
13474                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$IntegerOverflowError"));
13475         CHECK(LDKBolt11ParseError_IntegerOverflowError_class != NULL);
13476         LDKBolt11ParseError_IntegerOverflowError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_IntegerOverflowError_class, "<init>", "()V");
13477         CHECK(LDKBolt11ParseError_IntegerOverflowError_meth != NULL);
13478         LDKBolt11ParseError_InvalidSegWitProgramLength_class =
13479                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidSegWitProgramLength"));
13480         CHECK(LDKBolt11ParseError_InvalidSegWitProgramLength_class != NULL);
13481         LDKBolt11ParseError_InvalidSegWitProgramLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidSegWitProgramLength_class, "<init>", "()V");
13482         CHECK(LDKBolt11ParseError_InvalidSegWitProgramLength_meth != NULL);
13483         LDKBolt11ParseError_InvalidPubKeyHashLength_class =
13484                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidPubKeyHashLength"));
13485         CHECK(LDKBolt11ParseError_InvalidPubKeyHashLength_class != NULL);
13486         LDKBolt11ParseError_InvalidPubKeyHashLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidPubKeyHashLength_class, "<init>", "()V");
13487         CHECK(LDKBolt11ParseError_InvalidPubKeyHashLength_meth != NULL);
13488         LDKBolt11ParseError_InvalidScriptHashLength_class =
13489                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidScriptHashLength"));
13490         CHECK(LDKBolt11ParseError_InvalidScriptHashLength_class != NULL);
13491         LDKBolt11ParseError_InvalidScriptHashLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidScriptHashLength_class, "<init>", "()V");
13492         CHECK(LDKBolt11ParseError_InvalidScriptHashLength_meth != NULL);
13493         LDKBolt11ParseError_InvalidRecoveryId_class =
13494                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidRecoveryId"));
13495         CHECK(LDKBolt11ParseError_InvalidRecoveryId_class != NULL);
13496         LDKBolt11ParseError_InvalidRecoveryId_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidRecoveryId_class, "<init>", "()V");
13497         CHECK(LDKBolt11ParseError_InvalidRecoveryId_meth != NULL);
13498         LDKBolt11ParseError_InvalidSliceLength_class =
13499                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidSliceLength"));
13500         CHECK(LDKBolt11ParseError_InvalidSliceLength_class != NULL);
13501         LDKBolt11ParseError_InvalidSliceLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidSliceLength_class, "<init>", "(Ljava/lang/String;)V");
13502         CHECK(LDKBolt11ParseError_InvalidSliceLength_meth != NULL);
13503         LDKBolt11ParseError_Skip_class =
13504                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$Skip"));
13505         CHECK(LDKBolt11ParseError_Skip_class != NULL);
13506         LDKBolt11ParseError_Skip_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_Skip_class, "<init>", "()V");
13507         CHECK(LDKBolt11ParseError_Skip_meth != NULL);
13508 }
13509 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBolt11ParseError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13510         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
13511         switch(obj->tag) {
13512                 case LDKBolt11ParseError_Bech32Error: {
13513                         int64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
13514                         return (*env)->NewObject(env, LDKBolt11ParseError_Bech32Error_class, LDKBolt11ParseError_Bech32Error_meth, bech32_error_ref);
13515                 }
13516                 case LDKBolt11ParseError_ParseAmountError: {
13517                         /*obj->parse_amount_error*/
13518                         return (*env)->NewObject(env, LDKBolt11ParseError_ParseAmountError_class, LDKBolt11ParseError_ParseAmountError_meth, 0);
13519                 }
13520                 case LDKBolt11ParseError_MalformedSignature: {
13521                         jclass malformed_signature_conv = LDKSecp256k1Error_to_java(env, obj->malformed_signature);
13522                         return (*env)->NewObject(env, LDKBolt11ParseError_MalformedSignature_class, LDKBolt11ParseError_MalformedSignature_meth, malformed_signature_conv);
13523                 }
13524                 case LDKBolt11ParseError_BadPrefix: {
13525                         return (*env)->NewObject(env, LDKBolt11ParseError_BadPrefix_class, LDKBolt11ParseError_BadPrefix_meth);
13526                 }
13527                 case LDKBolt11ParseError_UnknownCurrency: {
13528                         return (*env)->NewObject(env, LDKBolt11ParseError_UnknownCurrency_class, LDKBolt11ParseError_UnknownCurrency_meth);
13529                 }
13530                 case LDKBolt11ParseError_UnknownSiPrefix: {
13531                         return (*env)->NewObject(env, LDKBolt11ParseError_UnknownSiPrefix_class, LDKBolt11ParseError_UnknownSiPrefix_meth);
13532                 }
13533                 case LDKBolt11ParseError_MalformedHRP: {
13534                         return (*env)->NewObject(env, LDKBolt11ParseError_MalformedHRP_class, LDKBolt11ParseError_MalformedHRP_meth);
13535                 }
13536                 case LDKBolt11ParseError_TooShortDataPart: {
13537                         return (*env)->NewObject(env, LDKBolt11ParseError_TooShortDataPart_class, LDKBolt11ParseError_TooShortDataPart_meth);
13538                 }
13539                 case LDKBolt11ParseError_UnexpectedEndOfTaggedFields: {
13540                         return (*env)->NewObject(env, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth);
13541                 }
13542                 case LDKBolt11ParseError_DescriptionDecodeError: {
13543                         /*obj->description_decode_error*/
13544                         return (*env)->NewObject(env, LDKBolt11ParseError_DescriptionDecodeError_class, LDKBolt11ParseError_DescriptionDecodeError_meth, 0);
13545                 }
13546                 case LDKBolt11ParseError_PaddingError: {
13547                         return (*env)->NewObject(env, LDKBolt11ParseError_PaddingError_class, LDKBolt11ParseError_PaddingError_meth);
13548                 }
13549                 case LDKBolt11ParseError_IntegerOverflowError: {
13550                         return (*env)->NewObject(env, LDKBolt11ParseError_IntegerOverflowError_class, LDKBolt11ParseError_IntegerOverflowError_meth);
13551                 }
13552                 case LDKBolt11ParseError_InvalidSegWitProgramLength: {
13553                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidSegWitProgramLength_class, LDKBolt11ParseError_InvalidSegWitProgramLength_meth);
13554                 }
13555                 case LDKBolt11ParseError_InvalidPubKeyHashLength: {
13556                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidPubKeyHashLength_class, LDKBolt11ParseError_InvalidPubKeyHashLength_meth);
13557                 }
13558                 case LDKBolt11ParseError_InvalidScriptHashLength: {
13559                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidScriptHashLength_class, LDKBolt11ParseError_InvalidScriptHashLength_meth);
13560                 }
13561                 case LDKBolt11ParseError_InvalidRecoveryId: {
13562                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidRecoveryId_class, LDKBolt11ParseError_InvalidRecoveryId_meth);
13563                 }
13564                 case LDKBolt11ParseError_InvalidSliceLength: {
13565                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
13566                         jstring invalid_slice_length_conv = str_ref_to_java(env, invalid_slice_length_str.chars, invalid_slice_length_str.len);
13567                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidSliceLength_class, LDKBolt11ParseError_InvalidSliceLength_meth, invalid_slice_length_conv);
13568                 }
13569                 case LDKBolt11ParseError_Skip: {
13570                         return (*env)->NewObject(env, LDKBolt11ParseError_Skip_class, LDKBolt11ParseError_Skip_meth);
13571                 }
13572                 default: abort();
13573         }
13574 }
13575 static inline enum LDKSiPrefix CResult_SiPrefixBolt11ParseErrorZ_get_ok(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
13576 CHECK(owner->result_ok);
13577         return SiPrefix_clone(&*owner->contents.result);
13578 }
13579 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13580         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
13581         jclass ret_conv = LDKSiPrefix_to_java(env, CResult_SiPrefixBolt11ParseErrorZ_get_ok(owner_conv));
13582         return ret_conv;
13583 }
13584
13585 static inline struct LDKBolt11ParseError CResult_SiPrefixBolt11ParseErrorZ_get_err(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
13586 CHECK(!owner->result_ok);
13587         return Bolt11ParseError_clone(&*owner->contents.err);
13588 }
13589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13590         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
13591         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
13592         *ret_copy = CResult_SiPrefixBolt11ParseErrorZ_get_err(owner_conv);
13593         int64_t ret_ref = tag_ptr(ret_copy, true);
13594         return ret_ref;
13595 }
13596
13597 static jclass LDKParseOrSemanticError_ParseError_class = NULL;
13598 static jmethodID LDKParseOrSemanticError_ParseError_meth = NULL;
13599 static jclass LDKParseOrSemanticError_SemanticError_class = NULL;
13600 static jmethodID LDKParseOrSemanticError_SemanticError_meth = NULL;
13601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseOrSemanticError_init (JNIEnv *env, jclass clz) {
13602         LDKParseOrSemanticError_ParseError_class =
13603                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$ParseError"));
13604         CHECK(LDKParseOrSemanticError_ParseError_class != NULL);
13605         LDKParseOrSemanticError_ParseError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_ParseError_class, "<init>", "(J)V");
13606         CHECK(LDKParseOrSemanticError_ParseError_meth != NULL);
13607         LDKParseOrSemanticError_SemanticError_class =
13608                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$SemanticError"));
13609         CHECK(LDKParseOrSemanticError_SemanticError_class != NULL);
13610         LDKParseOrSemanticError_SemanticError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_SemanticError_class, "<init>", "(Lorg/ldk/enums/Bolt11SemanticError;)V");
13611         CHECK(LDKParseOrSemanticError_SemanticError_meth != NULL);
13612 }
13613 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseOrSemanticError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13614         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
13615         switch(obj->tag) {
13616                 case LDKParseOrSemanticError_ParseError: {
13617                         int64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
13618                         return (*env)->NewObject(env, LDKParseOrSemanticError_ParseError_class, LDKParseOrSemanticError_ParseError_meth, parse_error_ref);
13619                 }
13620                 case LDKParseOrSemanticError_SemanticError: {
13621                         jclass semantic_error_conv = LDKBolt11SemanticError_to_java(env, obj->semantic_error);
13622                         return (*env)->NewObject(env, LDKParseOrSemanticError_SemanticError_class, LDKParseOrSemanticError_SemanticError_meth, semantic_error_conv);
13623                 }
13624                 default: abort();
13625         }
13626 }
13627 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
13628         LDKBolt11Invoice ret = *owner->contents.result;
13629         ret.is_owned = false;
13630         return ret;
13631 }
13632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13633         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
13634         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
13635         int64_t ret_ref = 0;
13636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13638         return ret_ref;
13639 }
13640
13641 static inline struct LDKParseOrSemanticError CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
13642 CHECK(!owner->result_ok);
13643         return ParseOrSemanticError_clone(&*owner->contents.err);
13644 }
13645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13646         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
13647         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
13648         *ret_copy = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
13649         int64_t ret_ref = tag_ptr(ret_copy, true);
13650         return ret_ref;
13651 }
13652
13653 static inline struct LDKSignedRawBolt11Invoice CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
13654         LDKSignedRawBolt11Invoice ret = *owner->contents.result;
13655         ret.is_owned = false;
13656         return ret;
13657 }
13658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13659         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
13660         LDKSignedRawBolt11Invoice ret_var = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(owner_conv);
13661         int64_t ret_ref = 0;
13662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13664         return ret_ref;
13665 }
13666
13667 static inline struct LDKBolt11ParseError CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
13668 CHECK(!owner->result_ok);
13669         return Bolt11ParseError_clone(&*owner->contents.err);
13670 }
13671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13672         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
13673         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
13674         *ret_copy = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(owner_conv);
13675         int64_t ret_ref = tag_ptr(ret_copy, true);
13676         return ret_ref;
13677 }
13678
13679 static inline struct LDKRawBolt11Invoice C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
13680         LDKRawBolt11Invoice ret = owner->a;
13681         ret.is_owned = false;
13682         return ret;
13683 }
13684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
13685         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
13686         LDKRawBolt11Invoice ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(owner_conv);
13687         int64_t ret_ref = 0;
13688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13690         return ret_ref;
13691 }
13692
13693 static inline struct LDKThirtyTwoBytes C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
13694         return ThirtyTwoBytes_clone(&owner->b);
13695 }
13696 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
13697         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
13698         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13699         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(owner_conv).data);
13700         return ret_arr;
13701 }
13702
13703 static inline struct LDKBolt11InvoiceSignature C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
13704         LDKBolt11InvoiceSignature ret = owner->c;
13705         ret.is_owned = false;
13706         return ret;
13707 }
13708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
13709         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
13710         LDKBolt11InvoiceSignature ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(owner_conv);
13711         int64_t ret_ref = 0;
13712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13714         return ret_ref;
13715 }
13716
13717 static inline struct LDKPayeePubKey CResult_PayeePubKeySecp256k1ErrorZ_get_ok(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
13718         LDKPayeePubKey ret = *owner->contents.result;
13719         ret.is_owned = false;
13720         return ret;
13721 }
13722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13723         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
13724         LDKPayeePubKey ret_var = CResult_PayeePubKeySecp256k1ErrorZ_get_ok(owner_conv);
13725         int64_t ret_ref = 0;
13726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13728         return ret_ref;
13729 }
13730
13731 static inline enum LDKSecp256k1Error CResult_PayeePubKeySecp256k1ErrorZ_get_err(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
13732 CHECK(!owner->result_ok);
13733         return *owner->contents.err;
13734 }
13735 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13736         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
13737         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PayeePubKeySecp256k1ErrorZ_get_err(owner_conv));
13738         return ret_conv;
13739 }
13740
13741 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
13742         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
13743         for (size_t i = 0; i < ret.datalen; i++) {
13744                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
13745         }
13746         return ret;
13747 }
13748 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
13749         LDKPositiveTimestamp ret = *owner->contents.result;
13750         ret.is_owned = false;
13751         return ret;
13752 }
13753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13754         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
13755         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
13756         int64_t ret_ref = 0;
13757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13759         return ret_ref;
13760 }
13761
13762 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
13763 CHECK(!owner->result_ok);
13764         return CreationError_clone(&*owner->contents.err);
13765 }
13766 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13767         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
13768         jclass ret_conv = LDKCreationError_to_java(env, CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
13769         return ret_conv;
13770 }
13771
13772 static inline void CResult_NoneBolt11SemanticErrorZ_get_ok(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
13773 CHECK(owner->result_ok);
13774         return *owner->contents.result;
13775 }
13776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13777         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
13778         CResult_NoneBolt11SemanticErrorZ_get_ok(owner_conv);
13779 }
13780
13781 static inline enum LDKBolt11SemanticError CResult_NoneBolt11SemanticErrorZ_get_err(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
13782 CHECK(!owner->result_ok);
13783         return Bolt11SemanticError_clone(&*owner->contents.err);
13784 }
13785 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13786         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
13787         jclass ret_conv = LDKBolt11SemanticError_to_java(env, CResult_NoneBolt11SemanticErrorZ_get_err(owner_conv));
13788         return ret_conv;
13789 }
13790
13791 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
13792         LDKBolt11Invoice ret = *owner->contents.result;
13793         ret.is_owned = false;
13794         return ret;
13795 }
13796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13797         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
13798         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(owner_conv);
13799         int64_t ret_ref = 0;
13800         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13801         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13802         return ret_ref;
13803 }
13804
13805 static inline enum LDKBolt11SemanticError CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
13806 CHECK(!owner->result_ok);
13807         return Bolt11SemanticError_clone(&*owner->contents.err);
13808 }
13809 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13810         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
13811         jclass ret_conv = LDKBolt11SemanticError_to_java(env, CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(owner_conv));
13812         return ret_conv;
13813 }
13814
13815 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
13816         LDKDescription ret = *owner->contents.result;
13817         ret.is_owned = false;
13818         return ret;
13819 }
13820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13821         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
13822         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
13823         int64_t ret_ref = 0;
13824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13826         return ret_ref;
13827 }
13828
13829 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
13830 CHECK(!owner->result_ok);
13831         return CreationError_clone(&*owner->contents.err);
13832 }
13833 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13834         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
13835         jclass ret_conv = LDKCreationError_to_java(env, CResult_DescriptionCreationErrorZ_get_err(owner_conv));
13836         return ret_conv;
13837 }
13838
13839 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
13840         LDKPrivateRoute ret = *owner->contents.result;
13841         ret.is_owned = false;
13842         return ret;
13843 }
13844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13845         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
13846         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
13847         int64_t ret_ref = 0;
13848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13850         return ret_ref;
13851 }
13852
13853 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
13854 CHECK(!owner->result_ok);
13855         return CreationError_clone(&*owner->contents.err);
13856 }
13857 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13858         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
13859         jclass ret_conv = LDKCreationError_to_java(env, CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
13860         return ret_conv;
13861 }
13862
13863 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
13864         LDKOutPoint ret = *owner->contents.result;
13865         ret.is_owned = false;
13866         return ret;
13867 }
13868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13869         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
13870         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
13871         int64_t ret_ref = 0;
13872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13874         return ret_ref;
13875 }
13876
13877 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
13878 CHECK(!owner->result_ok);
13879         return DecodeError_clone(&*owner->contents.err);
13880 }
13881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13882         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
13883         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13884         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
13885         int64_t ret_ref = tag_ptr(ret_copy, true);
13886         return ret_ref;
13887 }
13888
13889 static inline struct LDKBigSize CResult_BigSizeDecodeErrorZ_get_ok(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
13890         LDKBigSize ret = *owner->contents.result;
13891         ret.is_owned = false;
13892         return ret;
13893 }
13894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13895         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
13896         LDKBigSize ret_var = CResult_BigSizeDecodeErrorZ_get_ok(owner_conv);
13897         int64_t ret_ref = 0;
13898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13900         return ret_ref;
13901 }
13902
13903 static inline struct LDKDecodeError CResult_BigSizeDecodeErrorZ_get_err(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
13904 CHECK(!owner->result_ok);
13905         return DecodeError_clone(&*owner->contents.err);
13906 }
13907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13908         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
13909         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13910         *ret_copy = CResult_BigSizeDecodeErrorZ_get_err(owner_conv);
13911         int64_t ret_ref = tag_ptr(ret_copy, true);
13912         return ret_ref;
13913 }
13914
13915 static inline struct LDKHostname CResult_HostnameDecodeErrorZ_get_ok(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
13916         LDKHostname ret = *owner->contents.result;
13917         ret.is_owned = false;
13918         return ret;
13919 }
13920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13921         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
13922         LDKHostname ret_var = CResult_HostnameDecodeErrorZ_get_ok(owner_conv);
13923         int64_t ret_ref = 0;
13924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13926         return ret_ref;
13927 }
13928
13929 static inline struct LDKDecodeError CResult_HostnameDecodeErrorZ_get_err(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
13930 CHECK(!owner->result_ok);
13931         return DecodeError_clone(&*owner->contents.err);
13932 }
13933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13934         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
13935         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13936         *ret_copy = CResult_HostnameDecodeErrorZ_get_err(owner_conv);
13937         int64_t ret_ref = tag_ptr(ret_copy, true);
13938         return ret_ref;
13939 }
13940
13941 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedNoneZ_get_ok(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
13942         LDKTransactionU16LenLimited ret = *owner->contents.result;
13943         ret.is_owned = false;
13944         return ret;
13945 }
13946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13947         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
13948         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedNoneZ_get_ok(owner_conv);
13949         int64_t ret_ref = 0;
13950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13952         return ret_ref;
13953 }
13954
13955 static inline void CResult_TransactionU16LenLimitedNoneZ_get_err(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
13956 CHECK(!owner->result_ok);
13957         return *owner->contents.err;
13958 }
13959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13960         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
13961         CResult_TransactionU16LenLimitedNoneZ_get_err(owner_conv);
13962 }
13963
13964 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
13965         LDKTransactionU16LenLimited ret = *owner->contents.result;
13966         ret.is_owned = false;
13967         return ret;
13968 }
13969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13970         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
13971         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(owner_conv);
13972         int64_t ret_ref = 0;
13973         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13974         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13975         return ret_ref;
13976 }
13977
13978 static inline struct LDKDecodeError CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
13979 CHECK(!owner->result_ok);
13980         return DecodeError_clone(&*owner->contents.err);
13981 }
13982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13983         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
13984         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13985         *ret_copy = CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(owner_conv);
13986         int64_t ret_ref = tag_ptr(ret_copy, true);
13987         return ret_ref;
13988 }
13989
13990 static inline struct LDKUntrustedString CResult_UntrustedStringDecodeErrorZ_get_ok(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
13991         LDKUntrustedString ret = *owner->contents.result;
13992         ret.is_owned = false;
13993         return ret;
13994 }
13995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13996         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
13997         LDKUntrustedString ret_var = CResult_UntrustedStringDecodeErrorZ_get_ok(owner_conv);
13998         int64_t ret_ref = 0;
13999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14001         return ret_ref;
14002 }
14003
14004 static inline struct LDKDecodeError CResult_UntrustedStringDecodeErrorZ_get_err(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
14005 CHECK(!owner->result_ok);
14006         return DecodeError_clone(&*owner->contents.err);
14007 }
14008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14009         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
14010         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14011         *ret_copy = CResult_UntrustedStringDecodeErrorZ_get_err(owner_conv);
14012         int64_t ret_ref = tag_ptr(ret_copy, true);
14013         return ret_ref;
14014 }
14015
14016 static inline struct LDKReceiveTlvs CResult_ReceiveTlvsDecodeErrorZ_get_ok(LDKCResult_ReceiveTlvsDecodeErrorZ *NONNULL_PTR owner){
14017         LDKReceiveTlvs ret = *owner->contents.result;
14018         ret.is_owned = false;
14019         return ret;
14020 }
14021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14022         LDKCResult_ReceiveTlvsDecodeErrorZ* owner_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(owner);
14023         LDKReceiveTlvs ret_var = CResult_ReceiveTlvsDecodeErrorZ_get_ok(owner_conv);
14024         int64_t ret_ref = 0;
14025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14027         return ret_ref;
14028 }
14029
14030 static inline struct LDKDecodeError CResult_ReceiveTlvsDecodeErrorZ_get_err(LDKCResult_ReceiveTlvsDecodeErrorZ *NONNULL_PTR owner){
14031 CHECK(!owner->result_ok);
14032         return DecodeError_clone(&*owner->contents.err);
14033 }
14034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14035         LDKCResult_ReceiveTlvsDecodeErrorZ* owner_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(owner);
14036         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14037         *ret_copy = CResult_ReceiveTlvsDecodeErrorZ_get_err(owner_conv);
14038         int64_t ret_ref = tag_ptr(ret_copy, true);
14039         return ret_ref;
14040 }
14041
14042 static inline struct LDKPaymentRelay CResult_PaymentRelayDecodeErrorZ_get_ok(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
14043         LDKPaymentRelay ret = *owner->contents.result;
14044         ret.is_owned = false;
14045         return ret;
14046 }
14047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14048         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
14049         LDKPaymentRelay ret_var = CResult_PaymentRelayDecodeErrorZ_get_ok(owner_conv);
14050         int64_t ret_ref = 0;
14051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14053         return ret_ref;
14054 }
14055
14056 static inline struct LDKDecodeError CResult_PaymentRelayDecodeErrorZ_get_err(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
14057 CHECK(!owner->result_ok);
14058         return DecodeError_clone(&*owner->contents.err);
14059 }
14060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14061         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
14062         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14063         *ret_copy = CResult_PaymentRelayDecodeErrorZ_get_err(owner_conv);
14064         int64_t ret_ref = tag_ptr(ret_copy, true);
14065         return ret_ref;
14066 }
14067
14068 static inline struct LDKPaymentConstraints CResult_PaymentConstraintsDecodeErrorZ_get_ok(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
14069         LDKPaymentConstraints ret = *owner->contents.result;
14070         ret.is_owned = false;
14071         return ret;
14072 }
14073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14074         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
14075         LDKPaymentConstraints ret_var = CResult_PaymentConstraintsDecodeErrorZ_get_ok(owner_conv);
14076         int64_t ret_ref = 0;
14077         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14078         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14079         return ret_ref;
14080 }
14081
14082 static inline struct LDKDecodeError CResult_PaymentConstraintsDecodeErrorZ_get_err(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
14083 CHECK(!owner->result_ok);
14084         return DecodeError_clone(&*owner->contents.err);
14085 }
14086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14087         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
14088         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14089         *ret_copy = CResult_PaymentConstraintsDecodeErrorZ_get_err(owner_conv);
14090         int64_t ret_ref = tag_ptr(ret_copy, true);
14091         return ret_ref;
14092 }
14093
14094 static jclass LDKPaymentError_Invoice_class = NULL;
14095 static jmethodID LDKPaymentError_Invoice_meth = NULL;
14096 static jclass LDKPaymentError_Sending_class = NULL;
14097 static jmethodID LDKPaymentError_Sending_meth = NULL;
14098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentError_init (JNIEnv *env, jclass clz) {
14099         LDKPaymentError_Invoice_class =
14100                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Invoice"));
14101         CHECK(LDKPaymentError_Invoice_class != NULL);
14102         LDKPaymentError_Invoice_meth = (*env)->GetMethodID(env, LDKPaymentError_Invoice_class, "<init>", "(Ljava/lang/String;)V");
14103         CHECK(LDKPaymentError_Invoice_meth != NULL);
14104         LDKPaymentError_Sending_class =
14105                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Sending"));
14106         CHECK(LDKPaymentError_Sending_class != NULL);
14107         LDKPaymentError_Sending_meth = (*env)->GetMethodID(env, LDKPaymentError_Sending_class, "<init>", "(Lorg/ldk/enums/RetryableSendFailure;)V");
14108         CHECK(LDKPaymentError_Sending_meth != NULL);
14109 }
14110 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14111         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
14112         switch(obj->tag) {
14113                 case LDKPaymentError_Invoice: {
14114                         LDKStr invoice_str = obj->invoice;
14115                         jstring invoice_conv = str_ref_to_java(env, invoice_str.chars, invoice_str.len);
14116                         return (*env)->NewObject(env, LDKPaymentError_Invoice_class, LDKPaymentError_Invoice_meth, invoice_conv);
14117                 }
14118                 case LDKPaymentError_Sending: {
14119                         jclass sending_conv = LDKRetryableSendFailure_to_java(env, obj->sending);
14120                         return (*env)->NewObject(env, LDKPaymentError_Sending_class, LDKPaymentError_Sending_meth, sending_conv);
14121                 }
14122                 default: abort();
14123         }
14124 }
14125 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesPaymentErrorZ_get_ok(LDKCResult_ThirtyTwoBytesPaymentErrorZ *NONNULL_PTR owner){
14126 CHECK(owner->result_ok);
14127         return ThirtyTwoBytes_clone(&*owner->contents.result);
14128 }
14129 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14130         LDKCResult_ThirtyTwoBytesPaymentErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(owner);
14131         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14132         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesPaymentErrorZ_get_ok(owner_conv).data);
14133         return ret_arr;
14134 }
14135
14136 static inline struct LDKPaymentError CResult_ThirtyTwoBytesPaymentErrorZ_get_err(LDKCResult_ThirtyTwoBytesPaymentErrorZ *NONNULL_PTR owner){
14137 CHECK(!owner->result_ok);
14138         return PaymentError_clone(&*owner->contents.err);
14139 }
14140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14141         LDKCResult_ThirtyTwoBytesPaymentErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(owner);
14142         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
14143         *ret_copy = CResult_ThirtyTwoBytesPaymentErrorZ_get_err(owner_conv);
14144         int64_t ret_ref = tag_ptr(ret_copy, true);
14145         return ret_ref;
14146 }
14147
14148 static inline void CResult_NonePaymentErrorZ_get_ok(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
14149 CHECK(owner->result_ok);
14150         return *owner->contents.result;
14151 }
14152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14153         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
14154         CResult_NonePaymentErrorZ_get_ok(owner_conv);
14155 }
14156
14157 static inline struct LDKPaymentError CResult_NonePaymentErrorZ_get_err(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
14158 CHECK(!owner->result_ok);
14159         return PaymentError_clone(&*owner->contents.err);
14160 }
14161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14162         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
14163         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
14164         *ret_copy = CResult_NonePaymentErrorZ_get_err(owner_conv);
14165         int64_t ret_ref = tag_ptr(ret_copy, true);
14166         return ret_ref;
14167 }
14168
14169 static jclass LDKProbingError_Invoice_class = NULL;
14170 static jmethodID LDKProbingError_Invoice_meth = NULL;
14171 static jclass LDKProbingError_Sending_class = NULL;
14172 static jmethodID LDKProbingError_Sending_meth = NULL;
14173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKProbingError_init (JNIEnv *env, jclass clz) {
14174         LDKProbingError_Invoice_class =
14175                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKProbingError$Invoice"));
14176         CHECK(LDKProbingError_Invoice_class != NULL);
14177         LDKProbingError_Invoice_meth = (*env)->GetMethodID(env, LDKProbingError_Invoice_class, "<init>", "(Ljava/lang/String;)V");
14178         CHECK(LDKProbingError_Invoice_meth != NULL);
14179         LDKProbingError_Sending_class =
14180                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKProbingError$Sending"));
14181         CHECK(LDKProbingError_Sending_class != NULL);
14182         LDKProbingError_Sending_meth = (*env)->GetMethodID(env, LDKProbingError_Sending_class, "<init>", "(J)V");
14183         CHECK(LDKProbingError_Sending_meth != NULL);
14184 }
14185 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKProbingError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14186         LDKProbingError *obj = (LDKProbingError*)untag_ptr(ptr);
14187         switch(obj->tag) {
14188                 case LDKProbingError_Invoice: {
14189                         LDKStr invoice_str = obj->invoice;
14190                         jstring invoice_conv = str_ref_to_java(env, invoice_str.chars, invoice_str.len);
14191                         return (*env)->NewObject(env, LDKProbingError_Invoice_class, LDKProbingError_Invoice_meth, invoice_conv);
14192                 }
14193                 case LDKProbingError_Sending: {
14194                         int64_t sending_ref = tag_ptr(&obj->sending, false);
14195                         return (*env)->NewObject(env, LDKProbingError_Sending_class, LDKProbingError_Sending_meth, sending_ref);
14196                 }
14197                 default: abort();
14198         }
14199 }
14200 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ *NONNULL_PTR owner){
14201 CHECK(owner->result_ok);
14202         return CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(&*owner->contents.result);
14203 }
14204 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14205         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(owner);
14206         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_ok(owner_conv);
14207         int64_tArray ret_arr = NULL;
14208         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14209         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14210         for (size_t o = 0; o < ret_var.datalen; o++) {
14211                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
14212                 *ret_conv_40_conv = ret_var.data[o];
14213                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
14214         }
14215         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14216         FREE(ret_var.data);
14217         return ret_arr;
14218 }
14219
14220 static inline struct LDKProbingError CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ *NONNULL_PTR owner){
14221 CHECK(!owner->result_ok);
14222         return ProbingError_clone(&*owner->contents.err);
14223 }
14224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14225         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(owner);
14226         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
14227         *ret_copy = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_err(owner_conv);
14228         int64_t ret_ref = tag_ptr(ret_copy, true);
14229         return ret_ref;
14230 }
14231
14232 static inline struct LDKStr CResult_StrSecp256k1ErrorZ_get_ok(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
14233 CHECK(owner->result_ok);
14234         return *owner->contents.result;
14235 }
14236 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14237         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
14238         LDKStr ret_str = CResult_StrSecp256k1ErrorZ_get_ok(owner_conv);
14239         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
14240         return ret_conv;
14241 }
14242
14243 static inline enum LDKSecp256k1Error CResult_StrSecp256k1ErrorZ_get_err(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
14244 CHECK(!owner->result_ok);
14245         return *owner->contents.err;
14246 }
14247 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14248         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
14249         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_StrSecp256k1ErrorZ_get_err(owner_conv));
14250         return ret_conv;
14251 }
14252
14253 static inline struct LDKOnionMessagePath CResult_OnionMessagePathNoneZ_get_ok(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
14254         LDKOnionMessagePath ret = *owner->contents.result;
14255         ret.is_owned = false;
14256         return ret;
14257 }
14258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14259         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
14260         LDKOnionMessagePath ret_var = CResult_OnionMessagePathNoneZ_get_ok(owner_conv);
14261         int64_t ret_ref = 0;
14262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14264         return ret_ref;
14265 }
14266
14267 static inline void CResult_OnionMessagePathNoneZ_get_err(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
14268 CHECK(!owner->result_ok);
14269         return *owner->contents.err;
14270 }
14271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14272         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
14273         CResult_OnionMessagePathNoneZ_get_err(owner_conv);
14274 }
14275
14276 static inline struct LDKPublicKey C2Tuple_PublicKeyOnionMessageZ_get_a(LDKC2Tuple_PublicKeyOnionMessageZ *NONNULL_PTR owner){
14277         return owner->a;
14278 }
14279 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyOnionMessageZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
14280         LDKC2Tuple_PublicKeyOnionMessageZ* owner_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(owner);
14281         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14282         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyOnionMessageZ_get_a(owner_conv).compressed_form);
14283         return ret_arr;
14284 }
14285
14286 static inline struct LDKOnionMessage C2Tuple_PublicKeyOnionMessageZ_get_b(LDKC2Tuple_PublicKeyOnionMessageZ *NONNULL_PTR owner){
14287         LDKOnionMessage ret = owner->b;
14288         ret.is_owned = false;
14289         return ret;
14290 }
14291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyOnionMessageZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
14292         LDKC2Tuple_PublicKeyOnionMessageZ* owner_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(owner);
14293         LDKOnionMessage ret_var = C2Tuple_PublicKeyOnionMessageZ_get_b(owner_conv);
14294         int64_t ret_ref = 0;
14295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14297         return ret_ref;
14298 }
14299
14300 static jclass LDKSendError_Secp256k1_class = NULL;
14301 static jmethodID LDKSendError_Secp256k1_meth = NULL;
14302 static jclass LDKSendError_TooBigPacket_class = NULL;
14303 static jmethodID LDKSendError_TooBigPacket_meth = NULL;
14304 static jclass LDKSendError_TooFewBlindedHops_class = NULL;
14305 static jmethodID LDKSendError_TooFewBlindedHops_meth = NULL;
14306 static jclass LDKSendError_InvalidFirstHop_class = NULL;
14307 static jmethodID LDKSendError_InvalidFirstHop_meth = NULL;
14308 static jclass LDKSendError_InvalidMessage_class = NULL;
14309 static jmethodID LDKSendError_InvalidMessage_meth = NULL;
14310 static jclass LDKSendError_BufferFull_class = NULL;
14311 static jmethodID LDKSendError_BufferFull_meth = NULL;
14312 static jclass LDKSendError_GetNodeIdFailed_class = NULL;
14313 static jmethodID LDKSendError_GetNodeIdFailed_meth = NULL;
14314 static jclass LDKSendError_BlindedPathAdvanceFailed_class = NULL;
14315 static jmethodID LDKSendError_BlindedPathAdvanceFailed_meth = NULL;
14316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSendError_init (JNIEnv *env, jclass clz) {
14317         LDKSendError_Secp256k1_class =
14318                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$Secp256k1"));
14319         CHECK(LDKSendError_Secp256k1_class != NULL);
14320         LDKSendError_Secp256k1_meth = (*env)->GetMethodID(env, LDKSendError_Secp256k1_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
14321         CHECK(LDKSendError_Secp256k1_meth != NULL);
14322         LDKSendError_TooBigPacket_class =
14323                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$TooBigPacket"));
14324         CHECK(LDKSendError_TooBigPacket_class != NULL);
14325         LDKSendError_TooBigPacket_meth = (*env)->GetMethodID(env, LDKSendError_TooBigPacket_class, "<init>", "()V");
14326         CHECK(LDKSendError_TooBigPacket_meth != NULL);
14327         LDKSendError_TooFewBlindedHops_class =
14328                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$TooFewBlindedHops"));
14329         CHECK(LDKSendError_TooFewBlindedHops_class != NULL);
14330         LDKSendError_TooFewBlindedHops_meth = (*env)->GetMethodID(env, LDKSendError_TooFewBlindedHops_class, "<init>", "()V");
14331         CHECK(LDKSendError_TooFewBlindedHops_meth != NULL);
14332         LDKSendError_InvalidFirstHop_class =
14333                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$InvalidFirstHop"));
14334         CHECK(LDKSendError_InvalidFirstHop_class != NULL);
14335         LDKSendError_InvalidFirstHop_meth = (*env)->GetMethodID(env, LDKSendError_InvalidFirstHop_class, "<init>", "()V");
14336         CHECK(LDKSendError_InvalidFirstHop_meth != NULL);
14337         LDKSendError_InvalidMessage_class =
14338                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$InvalidMessage"));
14339         CHECK(LDKSendError_InvalidMessage_class != NULL);
14340         LDKSendError_InvalidMessage_meth = (*env)->GetMethodID(env, LDKSendError_InvalidMessage_class, "<init>", "()V");
14341         CHECK(LDKSendError_InvalidMessage_meth != NULL);
14342         LDKSendError_BufferFull_class =
14343                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$BufferFull"));
14344         CHECK(LDKSendError_BufferFull_class != NULL);
14345         LDKSendError_BufferFull_meth = (*env)->GetMethodID(env, LDKSendError_BufferFull_class, "<init>", "()V");
14346         CHECK(LDKSendError_BufferFull_meth != NULL);
14347         LDKSendError_GetNodeIdFailed_class =
14348                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$GetNodeIdFailed"));
14349         CHECK(LDKSendError_GetNodeIdFailed_class != NULL);
14350         LDKSendError_GetNodeIdFailed_meth = (*env)->GetMethodID(env, LDKSendError_GetNodeIdFailed_class, "<init>", "()V");
14351         CHECK(LDKSendError_GetNodeIdFailed_meth != NULL);
14352         LDKSendError_BlindedPathAdvanceFailed_class =
14353                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$BlindedPathAdvanceFailed"));
14354         CHECK(LDKSendError_BlindedPathAdvanceFailed_class != NULL);
14355         LDKSendError_BlindedPathAdvanceFailed_meth = (*env)->GetMethodID(env, LDKSendError_BlindedPathAdvanceFailed_class, "<init>", "()V");
14356         CHECK(LDKSendError_BlindedPathAdvanceFailed_meth != NULL);
14357 }
14358 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSendError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14359         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
14360         switch(obj->tag) {
14361                 case LDKSendError_Secp256k1: {
14362                         jclass secp256k1_conv = LDKSecp256k1Error_to_java(env, obj->secp256k1);
14363                         return (*env)->NewObject(env, LDKSendError_Secp256k1_class, LDKSendError_Secp256k1_meth, secp256k1_conv);
14364                 }
14365                 case LDKSendError_TooBigPacket: {
14366                         return (*env)->NewObject(env, LDKSendError_TooBigPacket_class, LDKSendError_TooBigPacket_meth);
14367                 }
14368                 case LDKSendError_TooFewBlindedHops: {
14369                         return (*env)->NewObject(env, LDKSendError_TooFewBlindedHops_class, LDKSendError_TooFewBlindedHops_meth);
14370                 }
14371                 case LDKSendError_InvalidFirstHop: {
14372                         return (*env)->NewObject(env, LDKSendError_InvalidFirstHop_class, LDKSendError_InvalidFirstHop_meth);
14373                 }
14374                 case LDKSendError_InvalidMessage: {
14375                         return (*env)->NewObject(env, LDKSendError_InvalidMessage_class, LDKSendError_InvalidMessage_meth);
14376                 }
14377                 case LDKSendError_BufferFull: {
14378                         return (*env)->NewObject(env, LDKSendError_BufferFull_class, LDKSendError_BufferFull_meth);
14379                 }
14380                 case LDKSendError_GetNodeIdFailed: {
14381                         return (*env)->NewObject(env, LDKSendError_GetNodeIdFailed_class, LDKSendError_GetNodeIdFailed_meth);
14382                 }
14383                 case LDKSendError_BlindedPathAdvanceFailed: {
14384                         return (*env)->NewObject(env, LDKSendError_BlindedPathAdvanceFailed_class, LDKSendError_BlindedPathAdvanceFailed_meth);
14385                 }
14386                 default: abort();
14387         }
14388 }
14389 static inline struct LDKC2Tuple_PublicKeyOnionMessageZ CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_ok(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ *NONNULL_PTR owner){
14390 CHECK(owner->result_ok);
14391         return C2Tuple_PublicKeyOnionMessageZ_clone(&*owner->contents.result);
14392 }
14393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PublicKeyOnionMessageZSendErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14394         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* owner_conv = (LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)untag_ptr(owner);
14395         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
14396         *ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_ok(owner_conv);
14397         return tag_ptr(ret_conv, true);
14398 }
14399
14400 static inline struct LDKSendError CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_err(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ *NONNULL_PTR owner){
14401 CHECK(!owner->result_ok);
14402         return SendError_clone(&*owner->contents.err);
14403 }
14404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PublicKeyOnionMessageZSendErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14405         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* owner_conv = (LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)untag_ptr(owner);
14406         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
14407         *ret_copy = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_err(owner_conv);
14408         int64_t ret_ref = tag_ptr(ret_copy, true);
14409         return ret_ref;
14410 }
14411
14412 static jclass LDKParsedOnionMessageContents_Offers_class = NULL;
14413 static jmethodID LDKParsedOnionMessageContents_Offers_meth = NULL;
14414 static jclass LDKParsedOnionMessageContents_Custom_class = NULL;
14415 static jmethodID LDKParsedOnionMessageContents_Custom_meth = NULL;
14416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParsedOnionMessageContents_init (JNIEnv *env, jclass clz) {
14417         LDKParsedOnionMessageContents_Offers_class =
14418                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParsedOnionMessageContents$Offers"));
14419         CHECK(LDKParsedOnionMessageContents_Offers_class != NULL);
14420         LDKParsedOnionMessageContents_Offers_meth = (*env)->GetMethodID(env, LDKParsedOnionMessageContents_Offers_class, "<init>", "(J)V");
14421         CHECK(LDKParsedOnionMessageContents_Offers_meth != NULL);
14422         LDKParsedOnionMessageContents_Custom_class =
14423                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParsedOnionMessageContents$Custom"));
14424         CHECK(LDKParsedOnionMessageContents_Custom_class != NULL);
14425         LDKParsedOnionMessageContents_Custom_meth = (*env)->GetMethodID(env, LDKParsedOnionMessageContents_Custom_class, "<init>", "(J)V");
14426         CHECK(LDKParsedOnionMessageContents_Custom_meth != NULL);
14427 }
14428 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParsedOnionMessageContents_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14429         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
14430         switch(obj->tag) {
14431                 case LDKParsedOnionMessageContents_Offers: {
14432                         int64_t offers_ref = tag_ptr(&obj->offers, false);
14433                         return (*env)->NewObject(env, LDKParsedOnionMessageContents_Offers_class, LDKParsedOnionMessageContents_Offers_meth, offers_ref);
14434                 }
14435                 case LDKParsedOnionMessageContents_Custom: {
14436                         LDKOnionMessageContents* custom_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
14437                         *custom_ret = OnionMessageContents_clone(&obj->custom);
14438                         return (*env)->NewObject(env, LDKParsedOnionMessageContents_Custom_class, LDKParsedOnionMessageContents_Custom_meth, tag_ptr(custom_ret, true));
14439                 }
14440                 default: abort();
14441         }
14442 }
14443 static jclass LDKPeeledOnion_Forward_class = NULL;
14444 static jmethodID LDKPeeledOnion_Forward_meth = NULL;
14445 static jclass LDKPeeledOnion_Receive_class = NULL;
14446 static jmethodID LDKPeeledOnion_Receive_meth = NULL;
14447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPeeledOnion_init (JNIEnv *env, jclass clz) {
14448         LDKPeeledOnion_Forward_class =
14449                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPeeledOnion$Forward"));
14450         CHECK(LDKPeeledOnion_Forward_class != NULL);
14451         LDKPeeledOnion_Forward_meth = (*env)->GetMethodID(env, LDKPeeledOnion_Forward_class, "<init>", "([BJ)V");
14452         CHECK(LDKPeeledOnion_Forward_meth != NULL);
14453         LDKPeeledOnion_Receive_class =
14454                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPeeledOnion$Receive"));
14455         CHECK(LDKPeeledOnion_Receive_class != NULL);
14456         LDKPeeledOnion_Receive_meth = (*env)->GetMethodID(env, LDKPeeledOnion_Receive_class, "<init>", "(J[BJ)V");
14457         CHECK(LDKPeeledOnion_Receive_meth != NULL);
14458 }
14459 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPeeledOnion_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14460         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
14461         switch(obj->tag) {
14462                 case LDKPeeledOnion_Forward: {
14463                         int8_tArray _0_arr = (*env)->NewByteArray(env, 33);
14464                         (*env)->SetByteArrayRegion(env, _0_arr, 0, 33, obj->forward._0.compressed_form);
14465                         LDKOnionMessage _1_var = obj->forward._1;
14466                         int64_t _1_ref = 0;
14467                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_1_var);
14468                         _1_ref = tag_ptr(_1_var.inner, false);
14469                         return (*env)->NewObject(env, LDKPeeledOnion_Forward_class, LDKPeeledOnion_Forward_meth, _0_arr, _1_ref);
14470                 }
14471                 case LDKPeeledOnion_Receive: {
14472                         int64_t _0_ref = tag_ptr(&obj->receive._0, false);
14473                         int8_tArray _1_arr = (*env)->NewByteArray(env, 32);
14474                         (*env)->SetByteArrayRegion(env, _1_arr, 0, 32, obj->receive._1.data);
14475                         LDKBlindedPath _2_var = obj->receive._2;
14476                         int64_t _2_ref = 0;
14477                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_2_var);
14478                         _2_ref = tag_ptr(_2_var.inner, false);
14479                         return (*env)->NewObject(env, LDKPeeledOnion_Receive_class, LDKPeeledOnion_Receive_meth, _0_ref, _1_arr, _2_ref);
14480                 }
14481                 default: abort();
14482         }
14483 }
14484 static inline struct LDKPeeledOnion CResult_PeeledOnionNoneZ_get_ok(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
14485 CHECK(owner->result_ok);
14486         return PeeledOnion_clone(&*owner->contents.result);
14487 }
14488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14489         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
14490         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
14491         *ret_copy = CResult_PeeledOnionNoneZ_get_ok(owner_conv);
14492         int64_t ret_ref = tag_ptr(ret_copy, true);
14493         return ret_ref;
14494 }
14495
14496 static inline void CResult_PeeledOnionNoneZ_get_err(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
14497 CHECK(!owner->result_ok);
14498         return *owner->contents.err;
14499 }
14500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14501         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
14502         CResult_PeeledOnionNoneZ_get_err(owner_conv);
14503 }
14504
14505 static inline void CResult_NoneSendErrorZ_get_ok(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
14506 CHECK(owner->result_ok);
14507         return *owner->contents.result;
14508 }
14509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14510         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
14511         CResult_NoneSendErrorZ_get_ok(owner_conv);
14512 }
14513
14514 static inline struct LDKSendError CResult_NoneSendErrorZ_get_err(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
14515 CHECK(!owner->result_ok);
14516         return SendError_clone(&*owner->contents.err);
14517 }
14518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14519         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
14520         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
14521         *ret_copy = CResult_NoneSendErrorZ_get_err(owner_conv);
14522         int64_t ret_ref = tag_ptr(ret_copy, true);
14523         return ret_ref;
14524 }
14525
14526 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
14527         LDKBlindedPath ret = *owner->contents.result;
14528         ret.is_owned = false;
14529         return ret;
14530 }
14531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14532         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
14533         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
14534         int64_t ret_ref = 0;
14535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14536         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14537         return ret_ref;
14538 }
14539
14540 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
14541 CHECK(!owner->result_ok);
14542         return *owner->contents.err;
14543 }
14544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14545         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
14546         CResult_BlindedPathNoneZ_get_err(owner_conv);
14547 }
14548
14549 static inline struct LDKC2Tuple_BlindedPayInfoBlindedPathZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
14550 CHECK(owner->result_ok);
14551         return C2Tuple_BlindedPayInfoBlindedPathZ_clone(&*owner->contents.result);
14552 }
14553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14554         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
14555         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
14556         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(owner_conv);
14557         return tag_ptr(ret_conv, true);
14558 }
14559
14560 static inline void CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
14561 CHECK(!owner->result_ok);
14562         return *owner->contents.err;
14563 }
14564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14565         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
14566         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(owner_conv);
14567 }
14568
14569 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
14570         LDKBlindedPath ret = *owner->contents.result;
14571         ret.is_owned = false;
14572         return ret;
14573 }
14574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14575         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
14576         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
14577         int64_t ret_ref = 0;
14578         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14579         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14580         return ret_ref;
14581 }
14582
14583 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
14584 CHECK(!owner->result_ok);
14585         return DecodeError_clone(&*owner->contents.err);
14586 }
14587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14588         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
14589         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14590         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
14591         int64_t ret_ref = tag_ptr(ret_copy, true);
14592         return ret_ref;
14593 }
14594
14595 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
14596         LDKBlindedHop ret = *owner->contents.result;
14597         ret.is_owned = false;
14598         return ret;
14599 }
14600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14601         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
14602         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
14603         int64_t ret_ref = 0;
14604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14606         return ret_ref;
14607 }
14608
14609 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
14610 CHECK(!owner->result_ok);
14611         return DecodeError_clone(&*owner->contents.err);
14612 }
14613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14614         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
14615         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14616         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
14617         int64_t ret_ref = tag_ptr(ret_copy, true);
14618         return ret_ref;
14619 }
14620
14621 static inline struct LDKInvoiceError CResult_InvoiceErrorDecodeErrorZ_get_ok(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
14622         LDKInvoiceError ret = *owner->contents.result;
14623         ret.is_owned = false;
14624         return ret;
14625 }
14626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14627         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
14628         LDKInvoiceError ret_var = CResult_InvoiceErrorDecodeErrorZ_get_ok(owner_conv);
14629         int64_t ret_ref = 0;
14630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14632         return ret_ref;
14633 }
14634
14635 static inline struct LDKDecodeError CResult_InvoiceErrorDecodeErrorZ_get_err(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
14636 CHECK(!owner->result_ok);
14637         return DecodeError_clone(&*owner->contents.err);
14638 }
14639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14640         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
14641         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14642         *ret_copy = CResult_InvoiceErrorDecodeErrorZ_get_err(owner_conv);
14643         int64_t ret_ref = tag_ptr(ret_copy, true);
14644         return ret_ref;
14645 }
14646
14647 typedef struct LDKFilter_JCalls {
14648         atomic_size_t refcnt;
14649         JavaVM *vm;
14650         jweak o;
14651         jmethodID register_tx_meth;
14652         jmethodID register_output_meth;
14653 } LDKFilter_JCalls;
14654 static void LDKFilter_JCalls_free(void* this_arg) {
14655         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
14656         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14657                 JNIEnv *env;
14658                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14659                 if (get_jenv_res == JNI_EDETACHED) {
14660                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14661                 } else {
14662                         DO_ASSERT(get_jenv_res == JNI_OK);
14663                 }
14664                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14665                 if (get_jenv_res == JNI_EDETACHED) {
14666                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14667                 }
14668                 FREE(j_calls);
14669         }
14670 }
14671 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
14672         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
14673         JNIEnv *env;
14674         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14675         if (get_jenv_res == JNI_EDETACHED) {
14676                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14677         } else {
14678                 DO_ASSERT(get_jenv_res == JNI_OK);
14679         }
14680         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
14681         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
14682         LDKu8slice script_pubkey_var = script_pubkey;
14683         int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
14684         (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
14685         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14686         CHECK(obj != NULL);
14687         (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
14688         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14689                 (*env)->ExceptionDescribe(env);
14690                 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
14691         }
14692         if (get_jenv_res == JNI_EDETACHED) {
14693                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14694         }
14695 }
14696 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
14697         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
14698         JNIEnv *env;
14699         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14700         if (get_jenv_res == JNI_EDETACHED) {
14701                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14702         } else {
14703                 DO_ASSERT(get_jenv_res == JNI_OK);
14704         }
14705         LDKWatchedOutput output_var = output;
14706         int64_t output_ref = 0;
14707         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
14708         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
14709         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14710         CHECK(obj != NULL);
14711         (*env)->CallVoidMethod(env, obj, j_calls->register_output_meth, output_ref);
14712         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14713                 (*env)->ExceptionDescribe(env);
14714                 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
14715         }
14716         if (get_jenv_res == JNI_EDETACHED) {
14717                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14718         }
14719 }
14720 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
14721         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
14722         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14723 }
14724 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
14725         jclass c = (*env)->GetObjectClass(env, o);
14726         CHECK(c != NULL);
14727         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
14728         atomic_init(&calls->refcnt, 1);
14729         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14730         calls->o = (*env)->NewWeakGlobalRef(env, o);
14731         calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
14732         CHECK(calls->register_tx_meth != NULL);
14733         calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)V");
14734         CHECK(calls->register_output_meth != NULL);
14735
14736         LDKFilter ret = {
14737                 .this_arg = (void*) calls,
14738                 .register_tx = register_tx_LDKFilter_jcall,
14739                 .register_output = register_output_LDKFilter_jcall,
14740                 .free = LDKFilter_JCalls_free,
14741         };
14742         return ret;
14743 }
14744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
14745         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
14746         *res_ptr = LDKFilter_init(env, clz, o);
14747         return tag_ptr(res_ptr, true);
14748 }
14749 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) {
14750         void* this_arg_ptr = untag_ptr(this_arg);
14751         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14752         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
14753         uint8_t txid_arr[32];
14754         CHECK((*env)->GetArrayLength(env, txid) == 32);
14755         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
14756         uint8_t (*txid_ref)[32] = &txid_arr;
14757         LDKu8slice script_pubkey_ref;
14758         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
14759         script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
14760         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
14761         (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
14762 }
14763
14764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
14765         void* this_arg_ptr = untag_ptr(this_arg);
14766         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14767         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
14768         LDKWatchedOutput output_conv;
14769         output_conv.inner = untag_ptr(output);
14770         output_conv.is_owned = ptr_is_owned(output);
14771         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
14772         output_conv = WatchedOutput_clone(&output_conv);
14773         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
14774 }
14775
14776 static jclass LDKCOption_FilterZ_Some_class = NULL;
14777 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
14778 static jclass LDKCOption_FilterZ_None_class = NULL;
14779 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
14780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
14781         LDKCOption_FilterZ_Some_class =
14782                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$Some"));
14783         CHECK(LDKCOption_FilterZ_Some_class != NULL);
14784         LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
14785         CHECK(LDKCOption_FilterZ_Some_meth != NULL);
14786         LDKCOption_FilterZ_None_class =
14787                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$None"));
14788         CHECK(LDKCOption_FilterZ_None_class != NULL);
14789         LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
14790         CHECK(LDKCOption_FilterZ_None_meth != NULL);
14791 }
14792 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14793         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
14794         switch(obj->tag) {
14795                 case LDKCOption_FilterZ_Some: {
14796                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
14797                         *some_ret = obj->some;
14798                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
14799                         if ((*some_ret).free == LDKFilter_JCalls_free) {
14800                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14801                                 LDKFilter_JCalls_cloned(&(*some_ret));
14802                         }
14803                         return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, tag_ptr(some_ret, true));
14804                 }
14805                 case LDKCOption_FilterZ_None: {
14806                         return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
14807                 }
14808                 default: abort();
14809         }
14810 }
14811 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
14812         LDKLockedChannelMonitor ret = *owner->contents.result;
14813         ret.is_owned = false;
14814         return ret;
14815 }
14816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14817         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
14818         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
14819         int64_t ret_ref = 0;
14820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14822         return ret_ref;
14823 }
14824
14825 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
14826 CHECK(!owner->result_ok);
14827         return *owner->contents.err;
14828 }
14829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14830         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
14831         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
14832 }
14833
14834 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
14835         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
14836         for (size_t i = 0; i < ret.datalen; i++) {
14837                 ret.data[i] = OutPoint_clone(&orig->data[i]);
14838         }
14839         return ret;
14840 }
14841 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
14842         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
14843         for (size_t i = 0; i < ret.datalen; i++) {
14844                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
14845         }
14846         return ret;
14847 }
14848 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
14849         LDKOutPoint ret = owner->a;
14850         ret.is_owned = false;
14851         return ret;
14852 }
14853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
14854         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
14855         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
14856         int64_t ret_ref = 0;
14857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14859         return ret_ref;
14860 }
14861
14862 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
14863         return CVec_MonitorUpdateIdZ_clone(&owner->b);
14864 }
14865 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
14866         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
14867         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
14868         int64_tArray ret_arr = NULL;
14869         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14870         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14871         for (size_t r = 0; r < ret_var.datalen; r++) {
14872                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
14873                 int64_t ret_conv_17_ref = 0;
14874                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
14875                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
14876                 ret_arr_ptr[r] = ret_conv_17_ref;
14877         }
14878         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14879         FREE(ret_var.data);
14880         return ret_arr;
14881 }
14882
14883 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
14884         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
14885         for (size_t i = 0; i < ret.datalen; i++) {
14886                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
14887         }
14888         return ret;
14889 }
14890 typedef struct LDKKVStore_JCalls {
14891         atomic_size_t refcnt;
14892         JavaVM *vm;
14893         jweak o;
14894         jmethodID read_meth;
14895         jmethodID write_meth;
14896         jmethodID remove_meth;
14897         jmethodID list_meth;
14898 } LDKKVStore_JCalls;
14899 static void LDKKVStore_JCalls_free(void* this_arg) {
14900         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
14901         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14902                 JNIEnv *env;
14903                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14904                 if (get_jenv_res == JNI_EDETACHED) {
14905                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14906                 } else {
14907                         DO_ASSERT(get_jenv_res == JNI_OK);
14908                 }
14909                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14910                 if (get_jenv_res == JNI_EDETACHED) {
14911                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14912                 }
14913                 FREE(j_calls);
14914         }
14915 }
14916 LDKCResult_CVec_u8ZIOErrorZ read_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key) {
14917         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
14918         JNIEnv *env;
14919         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14920         if (get_jenv_res == JNI_EDETACHED) {
14921                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14922         } else {
14923                 DO_ASSERT(get_jenv_res == JNI_OK);
14924         }
14925         LDKStr primary_namespace_str = primary_namespace;
14926         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
14927         Str_free(primary_namespace_str);
14928         LDKStr secondary_namespace_str = secondary_namespace;
14929         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
14930         Str_free(secondary_namespace_str);
14931         LDKStr key_str = key;
14932         jstring key_conv = str_ref_to_java(env, key_str.chars, key_str.len);
14933         Str_free(key_str);
14934         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14935         CHECK(obj != NULL);
14936         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, primary_namespace_conv, secondary_namespace_conv, key_conv);
14937         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14938                 (*env)->ExceptionDescribe(env);
14939                 (*env)->FatalError(env, "A call to read in LDKKVStore from rust threw an exception.");
14940         }
14941         void* ret_ptr = untag_ptr(ret);
14942         CHECK_ACCESS(ret_ptr);
14943         LDKCResult_CVec_u8ZIOErrorZ ret_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(ret_ptr);
14944         FREE(untag_ptr(ret));
14945         if (get_jenv_res == JNI_EDETACHED) {
14946                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14947         }
14948         return ret_conv;
14949 }
14950 LDKCResult_NoneIOErrorZ write_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, LDKu8slice buf) {
14951         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
14952         JNIEnv *env;
14953         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14954         if (get_jenv_res == JNI_EDETACHED) {
14955                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14956         } else {
14957                 DO_ASSERT(get_jenv_res == JNI_OK);
14958         }
14959         LDKStr primary_namespace_str = primary_namespace;
14960         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
14961         Str_free(primary_namespace_str);
14962         LDKStr secondary_namespace_str = secondary_namespace;
14963         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
14964         Str_free(secondary_namespace_str);
14965         LDKStr key_str = key;
14966         jstring key_conv = str_ref_to_java(env, key_str.chars, key_str.len);
14967         Str_free(key_str);
14968         LDKu8slice buf_var = buf;
14969         int8_tArray buf_arr = (*env)->NewByteArray(env, buf_var.datalen);
14970         (*env)->SetByteArrayRegion(env, buf_arr, 0, buf_var.datalen, buf_var.data);
14971         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14972         CHECK(obj != NULL);
14973         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->write_meth, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_arr);
14974         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14975                 (*env)->ExceptionDescribe(env);
14976                 (*env)->FatalError(env, "A call to write in LDKKVStore from rust threw an exception.");
14977         }
14978         void* ret_ptr = untag_ptr(ret);
14979         CHECK_ACCESS(ret_ptr);
14980         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
14981         FREE(untag_ptr(ret));
14982         if (get_jenv_res == JNI_EDETACHED) {
14983                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14984         }
14985         return ret_conv;
14986 }
14987 LDKCResult_NoneIOErrorZ remove_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, bool lazy) {
14988         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
14989         JNIEnv *env;
14990         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14991         if (get_jenv_res == JNI_EDETACHED) {
14992                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14993         } else {
14994                 DO_ASSERT(get_jenv_res == JNI_OK);
14995         }
14996         LDKStr primary_namespace_str = primary_namespace;
14997         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
14998         Str_free(primary_namespace_str);
14999         LDKStr secondary_namespace_str = secondary_namespace;
15000         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
15001         Str_free(secondary_namespace_str);
15002         LDKStr key_str = key;
15003         jstring key_conv = str_ref_to_java(env, key_str.chars, key_str.len);
15004         Str_free(key_str);
15005         jboolean lazy_conv = lazy;
15006         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15007         CHECK(obj != NULL);
15008         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->remove_meth, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy_conv);
15009         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15010                 (*env)->ExceptionDescribe(env);
15011                 (*env)->FatalError(env, "A call to remove in LDKKVStore from rust threw an exception.");
15012         }
15013         void* ret_ptr = untag_ptr(ret);
15014         CHECK_ACCESS(ret_ptr);
15015         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
15016         FREE(untag_ptr(ret));
15017         if (get_jenv_res == JNI_EDETACHED) {
15018                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15019         }
15020         return ret_conv;
15021 }
15022 LDKCResult_CVec_StrZIOErrorZ list_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace) {
15023         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
15024         JNIEnv *env;
15025         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15026         if (get_jenv_res == JNI_EDETACHED) {
15027                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15028         } else {
15029                 DO_ASSERT(get_jenv_res == JNI_OK);
15030         }
15031         LDKStr primary_namespace_str = primary_namespace;
15032         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
15033         Str_free(primary_namespace_str);
15034         LDKStr secondary_namespace_str = secondary_namespace;
15035         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
15036         Str_free(secondary_namespace_str);
15037         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15038         CHECK(obj != NULL);
15039         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->list_meth, primary_namespace_conv, secondary_namespace_conv);
15040         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15041                 (*env)->ExceptionDescribe(env);
15042                 (*env)->FatalError(env, "A call to list in LDKKVStore from rust threw an exception.");
15043         }
15044         void* ret_ptr = untag_ptr(ret);
15045         CHECK_ACCESS(ret_ptr);
15046         LDKCResult_CVec_StrZIOErrorZ ret_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(ret_ptr);
15047         FREE(untag_ptr(ret));
15048         if (get_jenv_res == JNI_EDETACHED) {
15049                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15050         }
15051         return ret_conv;
15052 }
15053 static void LDKKVStore_JCalls_cloned(LDKKVStore* new_obj) {
15054         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) new_obj->this_arg;
15055         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15056 }
15057 static inline LDKKVStore LDKKVStore_init (JNIEnv *env, jclass clz, jobject o) {
15058         jclass c = (*env)->GetObjectClass(env, o);
15059         CHECK(c != NULL);
15060         LDKKVStore_JCalls *calls = MALLOC(sizeof(LDKKVStore_JCalls), "LDKKVStore_JCalls");
15061         atomic_init(&calls->refcnt, 1);
15062         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15063         calls->o = (*env)->NewWeakGlobalRef(env, o);
15064         calls->read_meth = (*env)->GetMethodID(env, c, "read", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)J");
15065         CHECK(calls->read_meth != NULL);
15066         calls->write_meth = (*env)->GetMethodID(env, c, "write", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[B)J");
15067         CHECK(calls->write_meth != NULL);
15068         calls->remove_meth = (*env)->GetMethodID(env, c, "remove", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)J");
15069         CHECK(calls->remove_meth != NULL);
15070         calls->list_meth = (*env)->GetMethodID(env, c, "list", "(Ljava/lang/String;Ljava/lang/String;)J");
15071         CHECK(calls->list_meth != NULL);
15072
15073         LDKKVStore ret = {
15074                 .this_arg = (void*) calls,
15075                 .read = read_LDKKVStore_jcall,
15076                 .write = write_LDKKVStore_jcall,
15077                 .remove = remove_LDKKVStore_jcall,
15078                 .list = list_LDKKVStore_jcall,
15079                 .free = LDKKVStore_JCalls_free,
15080         };
15081         return ret;
15082 }
15083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKVStore_1new(JNIEnv *env, jclass clz, jobject o) {
15084         LDKKVStore *res_ptr = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
15085         *res_ptr = LDKKVStore_init(env, clz, o);
15086         return tag_ptr(res_ptr, true);
15087 }
15088 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) {
15089         void* this_arg_ptr = untag_ptr(this_arg);
15090         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15091         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
15092         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
15093         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
15094         LDKStr key_conv = java_to_owned_str(env, key);
15095         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
15096         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv);
15097         return tag_ptr(ret_conv, true);
15098 }
15099
15100 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) {
15101         void* this_arg_ptr = untag_ptr(this_arg);
15102         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15103         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
15104         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
15105         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
15106         LDKStr key_conv = java_to_owned_str(env, key);
15107         LDKu8slice buf_ref;
15108         buf_ref.datalen = (*env)->GetArrayLength(env, buf);
15109         buf_ref.data = (*env)->GetByteArrayElements (env, buf, NULL);
15110         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
15111         *ret_conv = (this_arg_conv->write)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_ref);
15112         (*env)->ReleaseByteArrayElements(env, buf, (int8_t*)buf_ref.data, 0);
15113         return tag_ptr(ret_conv, true);
15114 }
15115
15116 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) {
15117         void* this_arg_ptr = untag_ptr(this_arg);
15118         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15119         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
15120         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
15121         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
15122         LDKStr key_conv = java_to_owned_str(env, key);
15123         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
15124         *ret_conv = (this_arg_conv->remove)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy);
15125         return tag_ptr(ret_conv, true);
15126 }
15127
15128 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) {
15129         void* this_arg_ptr = untag_ptr(this_arg);
15130         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15131         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
15132         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
15133         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
15134         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
15135         *ret_conv = (this_arg_conv->list)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv);
15136         return tag_ptr(ret_conv, true);
15137 }
15138
15139 typedef struct LDKPersister_JCalls {
15140         atomic_size_t refcnt;
15141         JavaVM *vm;
15142         jweak o;
15143         jmethodID persist_manager_meth;
15144         jmethodID persist_graph_meth;
15145         jmethodID persist_scorer_meth;
15146 } LDKPersister_JCalls;
15147 static void LDKPersister_JCalls_free(void* this_arg) {
15148         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
15149         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15150                 JNIEnv *env;
15151                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15152                 if (get_jenv_res == JNI_EDETACHED) {
15153                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15154                 } else {
15155                         DO_ASSERT(get_jenv_res == JNI_OK);
15156                 }
15157                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15158                 if (get_jenv_res == JNI_EDETACHED) {
15159                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15160                 }
15161                 FREE(j_calls);
15162         }
15163 }
15164 LDKCResult_NoneIOErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
15165         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
15166         JNIEnv *env;
15167         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15168         if (get_jenv_res == JNI_EDETACHED) {
15169                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15170         } else {
15171                 DO_ASSERT(get_jenv_res == JNI_OK);
15172         }
15173         LDKChannelManager channel_manager_var = *channel_manager;
15174         int64_t channel_manager_ref = 0;
15175         // WARNING: we may need a move here but no clone is available for LDKChannelManager
15176         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
15177         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
15178         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15179         CHECK(obj != NULL);
15180         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
15181         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15182                 (*env)->ExceptionDescribe(env);
15183                 (*env)->FatalError(env, "A call to persist_manager in LDKPersister from rust threw an exception.");
15184         }
15185         void* ret_ptr = untag_ptr(ret);
15186         CHECK_ACCESS(ret_ptr);
15187         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
15188         FREE(untag_ptr(ret));
15189         if (get_jenv_res == JNI_EDETACHED) {
15190                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15191         }
15192         return ret_conv;
15193 }
15194 LDKCResult_NoneIOErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
15195         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
15196         JNIEnv *env;
15197         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15198         if (get_jenv_res == JNI_EDETACHED) {
15199                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15200         } else {
15201                 DO_ASSERT(get_jenv_res == JNI_OK);
15202         }
15203         LDKNetworkGraph network_graph_var = *network_graph;
15204         int64_t network_graph_ref = 0;
15205         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
15206         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
15207         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
15208         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15209         CHECK(obj != NULL);
15210         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_graph_meth, network_graph_ref);
15211         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15212                 (*env)->ExceptionDescribe(env);
15213                 (*env)->FatalError(env, "A call to persist_graph in LDKPersister from rust threw an exception.");
15214         }
15215         void* ret_ptr = untag_ptr(ret);
15216         CHECK_ACCESS(ret_ptr);
15217         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
15218         FREE(untag_ptr(ret));
15219         if (get_jenv_res == JNI_EDETACHED) {
15220                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15221         }
15222         return ret_conv;
15223 }
15224 LDKCResult_NoneIOErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
15225         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
15226         JNIEnv *env;
15227         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15228         if (get_jenv_res == JNI_EDETACHED) {
15229                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15230         } else {
15231                 DO_ASSERT(get_jenv_res == JNI_OK);
15232         }
15233         // WARNING: This object doesn't live past this scope, needs clone!
15234         int64_t ret_scorer = tag_ptr(scorer, false);
15235         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15236         CHECK(obj != NULL);
15237         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_scorer_meth, ret_scorer);
15238         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15239                 (*env)->ExceptionDescribe(env);
15240                 (*env)->FatalError(env, "A call to persist_scorer in LDKPersister from rust threw an exception.");
15241         }
15242         void* ret_ptr = untag_ptr(ret);
15243         CHECK_ACCESS(ret_ptr);
15244         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
15245         FREE(untag_ptr(ret));
15246         if (get_jenv_res == JNI_EDETACHED) {
15247                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15248         }
15249         return ret_conv;
15250 }
15251 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
15252         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
15253         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15254 }
15255 static inline LDKPersister LDKPersister_init (JNIEnv *env, jclass clz, jobject o) {
15256         jclass c = (*env)->GetObjectClass(env, o);
15257         CHECK(c != NULL);
15258         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
15259         atomic_init(&calls->refcnt, 1);
15260         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15261         calls->o = (*env)->NewWeakGlobalRef(env, o);
15262         calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
15263         CHECK(calls->persist_manager_meth != NULL);
15264         calls->persist_graph_meth = (*env)->GetMethodID(env, c, "persist_graph", "(J)J");
15265         CHECK(calls->persist_graph_meth != NULL);
15266         calls->persist_scorer_meth = (*env)->GetMethodID(env, c, "persist_scorer", "(J)J");
15267         CHECK(calls->persist_scorer_meth != NULL);
15268
15269         LDKPersister ret = {
15270                 .this_arg = (void*) calls,
15271                 .persist_manager = persist_manager_LDKPersister_jcall,
15272                 .persist_graph = persist_graph_LDKPersister_jcall,
15273                 .persist_scorer = persist_scorer_LDKPersister_jcall,
15274                 .free = LDKPersister_JCalls_free,
15275         };
15276         return ret;
15277 }
15278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersister_1new(JNIEnv *env, jclass clz, jobject o) {
15279         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
15280         *res_ptr = LDKPersister_init(env, clz, o);
15281         return tag_ptr(res_ptr, true);
15282 }
15283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
15284         void* this_arg_ptr = untag_ptr(this_arg);
15285         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15286         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
15287         LDKChannelManager channel_manager_conv;
15288         channel_manager_conv.inner = untag_ptr(channel_manager);
15289         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
15290         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
15291         channel_manager_conv.is_owned = false;
15292         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
15293         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
15294         return tag_ptr(ret_conv, true);
15295 }
15296
15297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1graph(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_graph) {
15298         void* this_arg_ptr = untag_ptr(this_arg);
15299         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15300         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
15301         LDKNetworkGraph network_graph_conv;
15302         network_graph_conv.inner = untag_ptr(network_graph);
15303         network_graph_conv.is_owned = ptr_is_owned(network_graph);
15304         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
15305         network_graph_conv.is_owned = false;
15306         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
15307         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
15308         return tag_ptr(ret_conv, true);
15309 }
15310
15311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1scorer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scorer) {
15312         void* this_arg_ptr = untag_ptr(this_arg);
15313         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15314         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
15315         void* scorer_ptr = untag_ptr(scorer);
15316         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
15317         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
15318         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
15319         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
15320         return tag_ptr(ret_conv, true);
15321 }
15322
15323 typedef struct LDKPersist_JCalls {
15324         atomic_size_t refcnt;
15325         JavaVM *vm;
15326         jweak o;
15327         jmethodID persist_new_channel_meth;
15328         jmethodID update_persisted_channel_meth;
15329 } LDKPersist_JCalls;
15330 static void LDKPersist_JCalls_free(void* this_arg) {
15331         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
15332         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15333                 JNIEnv *env;
15334                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15335                 if (get_jenv_res == JNI_EDETACHED) {
15336                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15337                 } else {
15338                         DO_ASSERT(get_jenv_res == JNI_OK);
15339                 }
15340                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15341                 if (get_jenv_res == JNI_EDETACHED) {
15342                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15343                 }
15344                 FREE(j_calls);
15345         }
15346 }
15347 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
15348         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
15349         JNIEnv *env;
15350         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15351         if (get_jenv_res == JNI_EDETACHED) {
15352                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15353         } else {
15354                 DO_ASSERT(get_jenv_res == JNI_OK);
15355         }
15356         LDKOutPoint channel_id_var = channel_id;
15357         int64_t channel_id_ref = 0;
15358         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
15359         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
15360         LDKChannelMonitor data_var = *data;
15361         int64_t data_ref = 0;
15362         data_var = ChannelMonitor_clone(&data_var);
15363         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
15364         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
15365         LDKMonitorUpdateId update_id_var = update_id;
15366         int64_t update_id_ref = 0;
15367         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
15368         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
15369         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15370         CHECK(obj != NULL);
15371         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref);
15372         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15373                 (*env)->ExceptionDescribe(env);
15374                 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
15375         }
15376         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
15377         if (get_jenv_res == JNI_EDETACHED) {
15378                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15379         }
15380         return ret_conv;
15381 }
15382 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
15383         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
15384         JNIEnv *env;
15385         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15386         if (get_jenv_res == JNI_EDETACHED) {
15387                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15388         } else {
15389                 DO_ASSERT(get_jenv_res == JNI_OK);
15390         }
15391         LDKOutPoint channel_id_var = channel_id;
15392         int64_t channel_id_ref = 0;
15393         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
15394         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
15395         LDKChannelMonitorUpdate update_var = update;
15396         int64_t update_ref = 0;
15397         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
15398         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
15399         LDKChannelMonitor data_var = *data;
15400         int64_t data_ref = 0;
15401         data_var = ChannelMonitor_clone(&data_var);
15402         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
15403         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
15404         LDKMonitorUpdateId update_id_var = update_id;
15405         int64_t update_id_ref = 0;
15406         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
15407         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
15408         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15409         CHECK(obj != NULL);
15410         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref);
15411         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15412                 (*env)->ExceptionDescribe(env);
15413                 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
15414         }
15415         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
15416         if (get_jenv_res == JNI_EDETACHED) {
15417                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15418         }
15419         return ret_conv;
15420 }
15421 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
15422         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
15423         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15424 }
15425 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
15426         jclass c = (*env)->GetObjectClass(env, o);
15427         CHECK(c != NULL);
15428         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
15429         atomic_init(&calls->refcnt, 1);
15430         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15431         calls->o = (*env)->NewWeakGlobalRef(env, o);
15432         calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
15433         CHECK(calls->persist_new_channel_meth != NULL);
15434         calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
15435         CHECK(calls->update_persisted_channel_meth != NULL);
15436
15437         LDKPersist ret = {
15438                 .this_arg = (void*) calls,
15439                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
15440                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
15441                 .free = LDKPersist_JCalls_free,
15442         };
15443         return ret;
15444 }
15445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
15446         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
15447         *res_ptr = LDKPersist_init(env, clz, o);
15448         return tag_ptr(res_ptr, true);
15449 }
15450 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) {
15451         void* this_arg_ptr = untag_ptr(this_arg);
15452         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15453         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
15454         LDKOutPoint channel_id_conv;
15455         channel_id_conv.inner = untag_ptr(channel_id);
15456         channel_id_conv.is_owned = ptr_is_owned(channel_id);
15457         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
15458         channel_id_conv = OutPoint_clone(&channel_id_conv);
15459         LDKChannelMonitor data_conv;
15460         data_conv.inner = untag_ptr(data);
15461         data_conv.is_owned = ptr_is_owned(data);
15462         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
15463         data_conv.is_owned = false;
15464         LDKMonitorUpdateId update_id_conv;
15465         update_id_conv.inner = untag_ptr(update_id);
15466         update_id_conv.is_owned = ptr_is_owned(update_id);
15467         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
15468         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
15469         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));
15470         return ret_conv;
15471 }
15472
15473 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) {
15474         void* this_arg_ptr = untag_ptr(this_arg);
15475         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15476         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
15477         LDKOutPoint channel_id_conv;
15478         channel_id_conv.inner = untag_ptr(channel_id);
15479         channel_id_conv.is_owned = ptr_is_owned(channel_id);
15480         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
15481         channel_id_conv = OutPoint_clone(&channel_id_conv);
15482         LDKChannelMonitorUpdate update_conv;
15483         update_conv.inner = untag_ptr(update);
15484         update_conv.is_owned = ptr_is_owned(update);
15485         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
15486         update_conv = ChannelMonitorUpdate_clone(&update_conv);
15487         LDKChannelMonitor data_conv;
15488         data_conv.inner = untag_ptr(data);
15489         data_conv.is_owned = ptr_is_owned(data);
15490         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
15491         data_conv.is_owned = false;
15492         LDKMonitorUpdateId update_id_conv;
15493         update_id_conv.inner = untag_ptr(update_id);
15494         update_id_conv.is_owned = ptr_is_owned(update_id);
15495         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
15496         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
15497         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));
15498         return ret_conv;
15499 }
15500
15501 typedef struct LDKFutureCallback_JCalls {
15502         atomic_size_t refcnt;
15503         JavaVM *vm;
15504         jweak o;
15505         jmethodID call_meth;
15506 } LDKFutureCallback_JCalls;
15507 static void LDKFutureCallback_JCalls_free(void* this_arg) {
15508         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
15509         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15510                 JNIEnv *env;
15511                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15512                 if (get_jenv_res == JNI_EDETACHED) {
15513                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15514                 } else {
15515                         DO_ASSERT(get_jenv_res == JNI_OK);
15516                 }
15517                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15518                 if (get_jenv_res == JNI_EDETACHED) {
15519                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15520                 }
15521                 FREE(j_calls);
15522         }
15523 }
15524 void call_LDKFutureCallback_jcall(const void* this_arg) {
15525         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
15526         JNIEnv *env;
15527         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15528         if (get_jenv_res == JNI_EDETACHED) {
15529                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15530         } else {
15531                 DO_ASSERT(get_jenv_res == JNI_OK);
15532         }
15533         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15534         CHECK(obj != NULL);
15535         (*env)->CallVoidMethod(env, obj, j_calls->call_meth);
15536         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15537                 (*env)->ExceptionDescribe(env);
15538                 (*env)->FatalError(env, "A call to call in LDKFutureCallback from rust threw an exception.");
15539         }
15540         if (get_jenv_res == JNI_EDETACHED) {
15541                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15542         }
15543 }
15544 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
15545         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
15546         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15547 }
15548 static inline LDKFutureCallback LDKFutureCallback_init (JNIEnv *env, jclass clz, jobject o) {
15549         jclass c = (*env)->GetObjectClass(env, o);
15550         CHECK(c != NULL);
15551         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
15552         atomic_init(&calls->refcnt, 1);
15553         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15554         calls->o = (*env)->NewWeakGlobalRef(env, o);
15555         calls->call_meth = (*env)->GetMethodID(env, c, "call", "()V");
15556         CHECK(calls->call_meth != NULL);
15557
15558         LDKFutureCallback ret = {
15559                 .this_arg = (void*) calls,
15560                 .call = call_LDKFutureCallback_jcall,
15561                 .free = LDKFutureCallback_JCalls_free,
15562         };
15563         return ret;
15564 }
15565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFutureCallback_1new(JNIEnv *env, jclass clz, jobject o) {
15566         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
15567         *res_ptr = LDKFutureCallback_init(env, clz, o);
15568         return tag_ptr(res_ptr, true);
15569 }
15570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FutureCallback_1call(JNIEnv *env, jclass clz, int64_t this_arg) {
15571         void* this_arg_ptr = untag_ptr(this_arg);
15572         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15573         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
15574         (this_arg_conv->call)(this_arg_conv->this_arg);
15575 }
15576
15577 typedef struct LDKListen_JCalls {
15578         atomic_size_t refcnt;
15579         JavaVM *vm;
15580         jweak o;
15581         jmethodID filtered_block_connected_meth;
15582         jmethodID block_connected_meth;
15583         jmethodID block_disconnected_meth;
15584 } LDKListen_JCalls;
15585 static void LDKListen_JCalls_free(void* this_arg) {
15586         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
15587         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15588                 JNIEnv *env;
15589                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15590                 if (get_jenv_res == JNI_EDETACHED) {
15591                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15592                 } else {
15593                         DO_ASSERT(get_jenv_res == JNI_OK);
15594                 }
15595                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15596                 if (get_jenv_res == JNI_EDETACHED) {
15597                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15598                 }
15599                 FREE(j_calls);
15600         }
15601 }
15602 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
15603         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
15604         JNIEnv *env;
15605         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15606         if (get_jenv_res == JNI_EDETACHED) {
15607                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15608         } else {
15609                 DO_ASSERT(get_jenv_res == JNI_OK);
15610         }
15611         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
15612         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
15613         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
15614         int64_tArray txdata_arr = NULL;
15615         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
15616         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
15617         for (size_t c = 0; c < txdata_var.datalen; c++) {
15618                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
15619                 *txdata_conv_28_conv = txdata_var.data[c];
15620                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
15621         }
15622         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
15623         FREE(txdata_var.data);
15624         int32_t height_conv = height;
15625         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15626         CHECK(obj != NULL);
15627         (*env)->CallVoidMethod(env, obj, j_calls->filtered_block_connected_meth, header_arr, txdata_arr, height_conv);
15628         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15629                 (*env)->ExceptionDescribe(env);
15630                 (*env)->FatalError(env, "A call to filtered_block_connected in LDKListen from rust threw an exception.");
15631         }
15632         if (get_jenv_res == JNI_EDETACHED) {
15633                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15634         }
15635 }
15636 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
15637         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
15638         JNIEnv *env;
15639         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15640         if (get_jenv_res == JNI_EDETACHED) {
15641                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15642         } else {
15643                 DO_ASSERT(get_jenv_res == JNI_OK);
15644         }
15645         LDKu8slice block_var = block;
15646         int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
15647         (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
15648         int32_t height_conv = height;
15649         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15650         CHECK(obj != NULL);
15651         (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height_conv);
15652         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15653                 (*env)->ExceptionDescribe(env);
15654                 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
15655         }
15656         if (get_jenv_res == JNI_EDETACHED) {
15657                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15658         }
15659 }
15660 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
15661         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
15662         JNIEnv *env;
15663         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15664         if (get_jenv_res == JNI_EDETACHED) {
15665                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15666         } else {
15667                 DO_ASSERT(get_jenv_res == JNI_OK);
15668         }
15669         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
15670         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
15671         int32_t height_conv = height;
15672         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15673         CHECK(obj != NULL);
15674         (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height_conv);
15675         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15676                 (*env)->ExceptionDescribe(env);
15677                 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
15678         }
15679         if (get_jenv_res == JNI_EDETACHED) {
15680                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15681         }
15682 }
15683 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
15684         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
15685         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15686 }
15687 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
15688         jclass c = (*env)->GetObjectClass(env, o);
15689         CHECK(c != NULL);
15690         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
15691         atomic_init(&calls->refcnt, 1);
15692         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15693         calls->o = (*env)->NewWeakGlobalRef(env, o);
15694         calls->filtered_block_connected_meth = (*env)->GetMethodID(env, c, "filtered_block_connected", "([B[JI)V");
15695         CHECK(calls->filtered_block_connected_meth != NULL);
15696         calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
15697         CHECK(calls->block_connected_meth != NULL);
15698         calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
15699         CHECK(calls->block_disconnected_meth != NULL);
15700
15701         LDKListen ret = {
15702                 .this_arg = (void*) calls,
15703                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
15704                 .block_connected = block_connected_LDKListen_jcall,
15705                 .block_disconnected = block_disconnected_LDKListen_jcall,
15706                 .free = LDKListen_JCalls_free,
15707         };
15708         return ret;
15709 }
15710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
15711         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
15712         *res_ptr = LDKListen_init(env, clz, o);
15713         return tag_ptr(res_ptr, true);
15714 }
15715 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) {
15716         void* this_arg_ptr = untag_ptr(this_arg);
15717         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15718         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
15719         uint8_t header_arr[80];
15720         CHECK((*env)->GetArrayLength(env, header) == 80);
15721         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
15722         uint8_t (*header_ref)[80] = &header_arr;
15723         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
15724         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
15725         if (txdata_constr.datalen > 0)
15726                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
15727         else
15728                 txdata_constr.data = NULL;
15729         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
15730         for (size_t c = 0; c < txdata_constr.datalen; c++) {
15731                 int64_t txdata_conv_28 = txdata_vals[c];
15732                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
15733                 CHECK_ACCESS(txdata_conv_28_ptr);
15734                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
15735                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
15736                 txdata_constr.data[c] = txdata_conv_28_conv;
15737         }
15738         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
15739         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
15740 }
15741
15742 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) {
15743         void* this_arg_ptr = untag_ptr(this_arg);
15744         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15745         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
15746         LDKu8slice block_ref;
15747         block_ref.datalen = (*env)->GetArrayLength(env, block);
15748         block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
15749         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
15750         (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
15751 }
15752
15753 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) {
15754         void* this_arg_ptr = untag_ptr(this_arg);
15755         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15756         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
15757         uint8_t header_arr[80];
15758         CHECK((*env)->GetArrayLength(env, header) == 80);
15759         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
15760         uint8_t (*header_ref)[80] = &header_arr;
15761         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
15762 }
15763
15764 typedef struct LDKConfirm_JCalls {
15765         atomic_size_t refcnt;
15766         JavaVM *vm;
15767         jweak o;
15768         jmethodID transactions_confirmed_meth;
15769         jmethodID transaction_unconfirmed_meth;
15770         jmethodID best_block_updated_meth;
15771         jmethodID get_relevant_txids_meth;
15772 } LDKConfirm_JCalls;
15773 static void LDKConfirm_JCalls_free(void* this_arg) {
15774         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
15775         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15776                 JNIEnv *env;
15777                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15778                 if (get_jenv_res == JNI_EDETACHED) {
15779                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15780                 } else {
15781                         DO_ASSERT(get_jenv_res == JNI_OK);
15782                 }
15783                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15784                 if (get_jenv_res == JNI_EDETACHED) {
15785                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15786                 }
15787                 FREE(j_calls);
15788         }
15789 }
15790 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
15791         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
15792         JNIEnv *env;
15793         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15794         if (get_jenv_res == JNI_EDETACHED) {
15795                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15796         } else {
15797                 DO_ASSERT(get_jenv_res == JNI_OK);
15798         }
15799         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
15800         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
15801         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
15802         int64_tArray txdata_arr = NULL;
15803         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
15804         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
15805         for (size_t c = 0; c < txdata_var.datalen; c++) {
15806                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
15807                 *txdata_conv_28_conv = txdata_var.data[c];
15808                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
15809         }
15810         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
15811         FREE(txdata_var.data);
15812         int32_t height_conv = height;
15813         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15814         CHECK(obj != NULL);
15815         (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height_conv);
15816         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15817                 (*env)->ExceptionDescribe(env);
15818                 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
15819         }
15820         if (get_jenv_res == JNI_EDETACHED) {
15821                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15822         }
15823 }
15824 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
15825         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
15826         JNIEnv *env;
15827         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15828         if (get_jenv_res == JNI_EDETACHED) {
15829                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15830         } else {
15831                 DO_ASSERT(get_jenv_res == JNI_OK);
15832         }
15833         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
15834         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
15835         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15836         CHECK(obj != NULL);
15837         (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
15838         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15839                 (*env)->ExceptionDescribe(env);
15840                 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
15841         }
15842         if (get_jenv_res == JNI_EDETACHED) {
15843                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15844         }
15845 }
15846 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
15847         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
15848         JNIEnv *env;
15849         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15850         if (get_jenv_res == JNI_EDETACHED) {
15851                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15852         } else {
15853                 DO_ASSERT(get_jenv_res == JNI_OK);
15854         }
15855         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
15856         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
15857         int32_t height_conv = height;
15858         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15859         CHECK(obj != NULL);
15860         (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height_conv);
15861         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15862                 (*env)->ExceptionDescribe(env);
15863                 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
15864         }
15865         if (get_jenv_res == JNI_EDETACHED) {
15866                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15867         }
15868 }
15869 LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
15870         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
15871         JNIEnv *env;
15872         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15873         if (get_jenv_res == JNI_EDETACHED) {
15874                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15875         } else {
15876                 DO_ASSERT(get_jenv_res == JNI_OK);
15877         }
15878         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15879         CHECK(obj != NULL);
15880         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
15881         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15882                 (*env)->ExceptionDescribe(env);
15883                 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
15884         }
15885         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret_constr;
15886         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
15887         if (ret_constr.datalen > 0)
15888                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ Elements");
15889         else
15890                 ret_constr.data = NULL;
15891         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
15892         for (size_t x = 0; x < ret_constr.datalen; x++) {
15893                 int64_t ret_conv_49 = ret_vals[x];
15894                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
15895                 CHECK_ACCESS(ret_conv_49_ptr);
15896                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ ret_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)(ret_conv_49_ptr);
15897                 FREE(untag_ptr(ret_conv_49));
15898                 ret_constr.data[x] = ret_conv_49_conv;
15899         }
15900         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
15901         if (get_jenv_res == JNI_EDETACHED) {
15902                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15903         }
15904         return ret_constr;
15905 }
15906 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
15907         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
15908         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15909 }
15910 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
15911         jclass c = (*env)->GetObjectClass(env, o);
15912         CHECK(c != NULL);
15913         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
15914         atomic_init(&calls->refcnt, 1);
15915         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15916         calls->o = (*env)->NewWeakGlobalRef(env, o);
15917         calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
15918         CHECK(calls->transactions_confirmed_meth != NULL);
15919         calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
15920         CHECK(calls->transaction_unconfirmed_meth != NULL);
15921         calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
15922         CHECK(calls->best_block_updated_meth != NULL);
15923         calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[J");
15924         CHECK(calls->get_relevant_txids_meth != NULL);
15925
15926         LDKConfirm ret = {
15927                 .this_arg = (void*) calls,
15928                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
15929                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
15930                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
15931                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
15932                 .free = LDKConfirm_JCalls_free,
15933         };
15934         return ret;
15935 }
15936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
15937         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
15938         *res_ptr = LDKConfirm_init(env, clz, o);
15939         return tag_ptr(res_ptr, true);
15940 }
15941 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) {
15942         void* this_arg_ptr = untag_ptr(this_arg);
15943         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15944         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
15945         uint8_t header_arr[80];
15946         CHECK((*env)->GetArrayLength(env, header) == 80);
15947         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
15948         uint8_t (*header_ref)[80] = &header_arr;
15949         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
15950         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
15951         if (txdata_constr.datalen > 0)
15952                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
15953         else
15954                 txdata_constr.data = NULL;
15955         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
15956         for (size_t c = 0; c < txdata_constr.datalen; c++) {
15957                 int64_t txdata_conv_28 = txdata_vals[c];
15958                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
15959                 CHECK_ACCESS(txdata_conv_28_ptr);
15960                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
15961                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
15962                 txdata_constr.data[c] = txdata_conv_28_conv;
15963         }
15964         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
15965         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
15966 }
15967
15968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
15969         void* this_arg_ptr = untag_ptr(this_arg);
15970         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15971         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
15972         uint8_t txid_arr[32];
15973         CHECK((*env)->GetArrayLength(env, txid) == 32);
15974         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
15975         uint8_t (*txid_ref)[32] = &txid_arr;
15976         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
15977 }
15978
15979 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) {
15980         void* this_arg_ptr = untag_ptr(this_arg);
15981         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15982         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
15983         uint8_t header_arr[80];
15984         CHECK((*env)->GetArrayLength(env, header) == 80);
15985         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
15986         uint8_t (*header_ref)[80] = &header_arr;
15987         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
15988 }
15989
15990 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
15991         void* this_arg_ptr = untag_ptr(this_arg);
15992         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15993         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
15994         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
15995         int64_tArray ret_arr = NULL;
15996         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15997         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15998         for (size_t x = 0; x < ret_var.datalen; x++) {
15999                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
16000                 *ret_conv_49_conv = ret_var.data[x];
16001                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
16002         }
16003         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16004         FREE(ret_var.data);
16005         return ret_arr;
16006 }
16007
16008 typedef struct LDKEventHandler_JCalls {
16009         atomic_size_t refcnt;
16010         JavaVM *vm;
16011         jweak o;
16012         jmethodID handle_event_meth;
16013 } LDKEventHandler_JCalls;
16014 static void LDKEventHandler_JCalls_free(void* this_arg) {
16015         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
16016         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16017                 JNIEnv *env;
16018                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16019                 if (get_jenv_res == JNI_EDETACHED) {
16020                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16021                 } else {
16022                         DO_ASSERT(get_jenv_res == JNI_OK);
16023                 }
16024                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
16025                 if (get_jenv_res == JNI_EDETACHED) {
16026                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16027                 }
16028                 FREE(j_calls);
16029         }
16030 }
16031 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
16032         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
16033         JNIEnv *env;
16034         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16035         if (get_jenv_res == JNI_EDETACHED) {
16036                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16037         } else {
16038                 DO_ASSERT(get_jenv_res == JNI_OK);
16039         }
16040         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16041         *event_copy = event;
16042         int64_t event_ref = tag_ptr(event_copy, true);
16043         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16044         CHECK(obj != NULL);
16045         (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, event_ref);
16046         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16047                 (*env)->ExceptionDescribe(env);
16048                 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
16049         }
16050         if (get_jenv_res == JNI_EDETACHED) {
16051                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16052         }
16053 }
16054 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
16055         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
16056         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16057 }
16058 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
16059         jclass c = (*env)->GetObjectClass(env, o);
16060         CHECK(c != NULL);
16061         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
16062         atomic_init(&calls->refcnt, 1);
16063         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
16064         calls->o = (*env)->NewWeakGlobalRef(env, o);
16065         calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
16066         CHECK(calls->handle_event_meth != NULL);
16067
16068         LDKEventHandler ret = {
16069                 .this_arg = (void*) calls,
16070                 .handle_event = handle_event_LDKEventHandler_jcall,
16071                 .free = LDKEventHandler_JCalls_free,
16072         };
16073         return ret;
16074 }
16075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
16076         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
16077         *res_ptr = LDKEventHandler_init(env, clz, o);
16078         return tag_ptr(res_ptr, true);
16079 }
16080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
16081         void* this_arg_ptr = untag_ptr(this_arg);
16082         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16083         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
16084         void* event_ptr = untag_ptr(event);
16085         CHECK_ACCESS(event_ptr);
16086         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
16087         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
16088         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
16089 }
16090
16091 typedef struct LDKEventsProvider_JCalls {
16092         atomic_size_t refcnt;
16093         JavaVM *vm;
16094         jweak o;
16095         jmethodID process_pending_events_meth;
16096 } LDKEventsProvider_JCalls;
16097 static void LDKEventsProvider_JCalls_free(void* this_arg) {
16098         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
16099         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16100                 JNIEnv *env;
16101                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16102                 if (get_jenv_res == JNI_EDETACHED) {
16103                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16104                 } else {
16105                         DO_ASSERT(get_jenv_res == JNI_OK);
16106                 }
16107                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
16108                 if (get_jenv_res == JNI_EDETACHED) {
16109                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16110                 }
16111                 FREE(j_calls);
16112         }
16113 }
16114 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
16115         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
16116         JNIEnv *env;
16117         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16118         if (get_jenv_res == JNI_EDETACHED) {
16119                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16120         } else {
16121                 DO_ASSERT(get_jenv_res == JNI_OK);
16122         }
16123         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
16124         *handler_ret = handler;
16125         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16126         CHECK(obj != NULL);
16127         (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, tag_ptr(handler_ret, true));
16128         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16129                 (*env)->ExceptionDescribe(env);
16130                 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
16131         }
16132         if (get_jenv_res == JNI_EDETACHED) {
16133                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16134         }
16135 }
16136 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
16137         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
16138         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16139 }
16140 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
16141         jclass c = (*env)->GetObjectClass(env, o);
16142         CHECK(c != NULL);
16143         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
16144         atomic_init(&calls->refcnt, 1);
16145         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
16146         calls->o = (*env)->NewWeakGlobalRef(env, o);
16147         calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
16148         CHECK(calls->process_pending_events_meth != NULL);
16149
16150         LDKEventsProvider ret = {
16151                 .this_arg = (void*) calls,
16152                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
16153                 .free = LDKEventsProvider_JCalls_free,
16154         };
16155         return ret;
16156 }
16157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
16158         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
16159         *res_ptr = LDKEventsProvider_init(env, clz, o);
16160         return tag_ptr(res_ptr, true);
16161 }
16162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
16163         void* this_arg_ptr = untag_ptr(this_arg);
16164         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16165         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
16166         void* handler_ptr = untag_ptr(handler);
16167         CHECK_ACCESS(handler_ptr);
16168         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
16169         if (handler_conv.free == LDKEventHandler_JCalls_free) {
16170                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16171                 LDKEventHandler_JCalls_cloned(&handler_conv);
16172         }
16173         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
16174 }
16175
16176 static jclass LDKFailureCode_TemporaryNodeFailure_class = NULL;
16177 static jmethodID LDKFailureCode_TemporaryNodeFailure_meth = NULL;
16178 static jclass LDKFailureCode_RequiredNodeFeatureMissing_class = NULL;
16179 static jmethodID LDKFailureCode_RequiredNodeFeatureMissing_meth = NULL;
16180 static jclass LDKFailureCode_IncorrectOrUnknownPaymentDetails_class = NULL;
16181 static jmethodID LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth = NULL;
16182 static jclass LDKFailureCode_InvalidOnionPayload_class = NULL;
16183 static jmethodID LDKFailureCode_InvalidOnionPayload_meth = NULL;
16184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFailureCode_init (JNIEnv *env, jclass clz) {
16185         LDKFailureCode_TemporaryNodeFailure_class =
16186                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$TemporaryNodeFailure"));
16187         CHECK(LDKFailureCode_TemporaryNodeFailure_class != NULL);
16188         LDKFailureCode_TemporaryNodeFailure_meth = (*env)->GetMethodID(env, LDKFailureCode_TemporaryNodeFailure_class, "<init>", "()V");
16189         CHECK(LDKFailureCode_TemporaryNodeFailure_meth != NULL);
16190         LDKFailureCode_RequiredNodeFeatureMissing_class =
16191                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$RequiredNodeFeatureMissing"));
16192         CHECK(LDKFailureCode_RequiredNodeFeatureMissing_class != NULL);
16193         LDKFailureCode_RequiredNodeFeatureMissing_meth = (*env)->GetMethodID(env, LDKFailureCode_RequiredNodeFeatureMissing_class, "<init>", "()V");
16194         CHECK(LDKFailureCode_RequiredNodeFeatureMissing_meth != NULL);
16195         LDKFailureCode_IncorrectOrUnknownPaymentDetails_class =
16196                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$IncorrectOrUnknownPaymentDetails"));
16197         CHECK(LDKFailureCode_IncorrectOrUnknownPaymentDetails_class != NULL);
16198         LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth = (*env)->GetMethodID(env, LDKFailureCode_IncorrectOrUnknownPaymentDetails_class, "<init>", "()V");
16199         CHECK(LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth != NULL);
16200         LDKFailureCode_InvalidOnionPayload_class =
16201                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$InvalidOnionPayload"));
16202         CHECK(LDKFailureCode_InvalidOnionPayload_class != NULL);
16203         LDKFailureCode_InvalidOnionPayload_meth = (*env)->GetMethodID(env, LDKFailureCode_InvalidOnionPayload_class, "<init>", "(J)V");
16204         CHECK(LDKFailureCode_InvalidOnionPayload_meth != NULL);
16205 }
16206 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFailureCode_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
16207         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
16208         switch(obj->tag) {
16209                 case LDKFailureCode_TemporaryNodeFailure: {
16210                         return (*env)->NewObject(env, LDKFailureCode_TemporaryNodeFailure_class, LDKFailureCode_TemporaryNodeFailure_meth);
16211                 }
16212                 case LDKFailureCode_RequiredNodeFeatureMissing: {
16213                         return (*env)->NewObject(env, LDKFailureCode_RequiredNodeFeatureMissing_class, LDKFailureCode_RequiredNodeFeatureMissing_meth);
16214                 }
16215                 case LDKFailureCode_IncorrectOrUnknownPaymentDetails: {
16216                         return (*env)->NewObject(env, LDKFailureCode_IncorrectOrUnknownPaymentDetails_class, LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth);
16217                 }
16218                 case LDKFailureCode_InvalidOnionPayload: {
16219                         int64_t invalid_onion_payload_ref = tag_ptr(&obj->invalid_onion_payload, false);
16220                         return (*env)->NewObject(env, LDKFailureCode_InvalidOnionPayload_class, LDKFailureCode_InvalidOnionPayload_meth, invalid_onion_payload_ref);
16221                 }
16222                 default: abort();
16223         }
16224 }
16225 typedef struct LDKMessageSendEventsProvider_JCalls {
16226         atomic_size_t refcnt;
16227         JavaVM *vm;
16228         jweak o;
16229         jmethodID get_and_clear_pending_msg_events_meth;
16230 } LDKMessageSendEventsProvider_JCalls;
16231 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
16232         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
16233         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16234                 JNIEnv *env;
16235                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16236                 if (get_jenv_res == JNI_EDETACHED) {
16237                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16238                 } else {
16239                         DO_ASSERT(get_jenv_res == JNI_OK);
16240                 }
16241                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
16242                 if (get_jenv_res == JNI_EDETACHED) {
16243                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16244                 }
16245                 FREE(j_calls);
16246         }
16247 }
16248 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
16249         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
16250         JNIEnv *env;
16251         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16252         if (get_jenv_res == JNI_EDETACHED) {
16253                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16254         } else {
16255                 DO_ASSERT(get_jenv_res == JNI_OK);
16256         }
16257         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16258         CHECK(obj != NULL);
16259         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
16260         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16261                 (*env)->ExceptionDescribe(env);
16262                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
16263         }
16264         LDKCVec_MessageSendEventZ ret_constr;
16265         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
16266         if (ret_constr.datalen > 0)
16267                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
16268         else
16269                 ret_constr.data = NULL;
16270         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
16271         for (size_t s = 0; s < ret_constr.datalen; s++) {
16272                 int64_t ret_conv_18 = ret_vals[s];
16273                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
16274                 CHECK_ACCESS(ret_conv_18_ptr);
16275                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
16276                 FREE(untag_ptr(ret_conv_18));
16277                 ret_constr.data[s] = ret_conv_18_conv;
16278         }
16279         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
16280         if (get_jenv_res == JNI_EDETACHED) {
16281                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16282         }
16283         return ret_constr;
16284 }
16285 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
16286         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
16287         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16288 }
16289 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
16290         jclass c = (*env)->GetObjectClass(env, o);
16291         CHECK(c != NULL);
16292         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
16293         atomic_init(&calls->refcnt, 1);
16294         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
16295         calls->o = (*env)->NewWeakGlobalRef(env, o);
16296         calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
16297         CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
16298
16299         LDKMessageSendEventsProvider ret = {
16300                 .this_arg = (void*) calls,
16301                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
16302                 .free = LDKMessageSendEventsProvider_JCalls_free,
16303         };
16304         return ret;
16305 }
16306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
16307         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
16308         *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
16309         return tag_ptr(res_ptr, true);
16310 }
16311 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
16312         void* this_arg_ptr = untag_ptr(this_arg);
16313         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16314         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
16315         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
16316         int64_tArray ret_arr = NULL;
16317         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
16318         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
16319         for (size_t s = 0; s < ret_var.datalen; s++) {
16320                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16321                 *ret_conv_18_copy = ret_var.data[s];
16322                 int64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
16323                 ret_arr_ptr[s] = ret_conv_18_ref;
16324         }
16325         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16326         FREE(ret_var.data);
16327         return ret_arr;
16328 }
16329
16330 typedef struct LDKChannelMessageHandler_JCalls {
16331         atomic_size_t refcnt;
16332         JavaVM *vm;
16333         jweak o;
16334         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
16335         jmethodID handle_open_channel_meth;
16336         jmethodID handle_open_channel_v2_meth;
16337         jmethodID handle_accept_channel_meth;
16338         jmethodID handle_accept_channel_v2_meth;
16339         jmethodID handle_funding_created_meth;
16340         jmethodID handle_funding_signed_meth;
16341         jmethodID handle_channel_ready_meth;
16342         jmethodID handle_shutdown_meth;
16343         jmethodID handle_closing_signed_meth;
16344         jmethodID handle_tx_add_input_meth;
16345         jmethodID handle_tx_add_output_meth;
16346         jmethodID handle_tx_remove_input_meth;
16347         jmethodID handle_tx_remove_output_meth;
16348         jmethodID handle_tx_complete_meth;
16349         jmethodID handle_tx_signatures_meth;
16350         jmethodID handle_tx_init_rbf_meth;
16351         jmethodID handle_tx_ack_rbf_meth;
16352         jmethodID handle_tx_abort_meth;
16353         jmethodID handle_update_add_htlc_meth;
16354         jmethodID handle_update_fulfill_htlc_meth;
16355         jmethodID handle_update_fail_htlc_meth;
16356         jmethodID handle_update_fail_malformed_htlc_meth;
16357         jmethodID handle_commitment_signed_meth;
16358         jmethodID handle_revoke_and_ack_meth;
16359         jmethodID handle_update_fee_meth;
16360         jmethodID handle_announcement_signatures_meth;
16361         jmethodID peer_disconnected_meth;
16362         jmethodID peer_connected_meth;
16363         jmethodID handle_channel_reestablish_meth;
16364         jmethodID handle_channel_update_meth;
16365         jmethodID handle_error_meth;
16366         jmethodID provided_node_features_meth;
16367         jmethodID provided_init_features_meth;
16368         jmethodID get_chain_hashes_meth;
16369 } LDKChannelMessageHandler_JCalls;
16370 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
16371         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16372         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16373                 JNIEnv *env;
16374                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16375                 if (get_jenv_res == JNI_EDETACHED) {
16376                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16377                 } else {
16378                         DO_ASSERT(get_jenv_res == JNI_OK);
16379                 }
16380                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
16381                 if (get_jenv_res == JNI_EDETACHED) {
16382                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16383                 }
16384                 FREE(j_calls);
16385         }
16386 }
16387 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * 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         LDKOpenChannel msg_var = *msg;
16399         int64_t msg_ref = 0;
16400         msg_var = OpenChannel_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_open_channel_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_open_channel 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_open_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannelV2 * 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         LDKOpenChannelV2 msg_var = *msg;
16426         int64_t msg_ref = 0;
16427         msg_var = OpenChannelV2_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_open_channel_v2_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_open_channel_v2 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_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * 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         LDKAcceptChannel msg_var = *msg;
16453         int64_t msg_ref = 0;
16454         msg_var = AcceptChannel_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_accept_channel_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_accept_channel 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_accept_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannelV2 * 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         LDKAcceptChannelV2 msg_var = *msg;
16480         int64_t msg_ref = 0;
16481         msg_var = AcceptChannelV2_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_accept_channel_v2_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_accept_channel_v2 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_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * 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         LDKFundingCreated msg_var = *msg;
16507         int64_t msg_ref = 0;
16508         msg_var = FundingCreated_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_funding_created_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_funding_created 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_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * 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         LDKFundingSigned msg_var = *msg;
16534         int64_t msg_ref = 0;
16535         msg_var = FundingSigned_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_funding_signed_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_funding_signed 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_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * 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         LDKChannelReady msg_var = *msg;
16561         int64_t msg_ref = 0;
16562         msg_var = ChannelReady_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_channel_ready_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_channel_ready 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_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * 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         LDKShutdown msg_var = *msg;
16588         int64_t msg_ref = 0;
16589         msg_var = Shutdown_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_shutdown_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_shutdown 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_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * 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         LDKClosingSigned msg_var = *msg;
16615         int64_t msg_ref = 0;
16616         msg_var = ClosingSigned_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_closing_signed_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_closing_signed 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_tx_add_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddInput * 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         LDKTxAddInput msg_var = *msg;
16642         int64_t msg_ref = 0;
16643         msg_var = TxAddInput_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_tx_add_input_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_tx_add_input 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_tx_add_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddOutput * 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         LDKTxAddOutput msg_var = *msg;
16669         int64_t msg_ref = 0;
16670         msg_var = TxAddOutput_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_tx_add_output_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_tx_add_output 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_tx_remove_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveInput * 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         LDKTxRemoveInput msg_var = *msg;
16696         int64_t msg_ref = 0;
16697         msg_var = TxRemoveInput_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_tx_remove_input_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_tx_remove_input 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_tx_remove_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveOutput * 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         LDKTxRemoveOutput msg_var = *msg;
16723         int64_t msg_ref = 0;
16724         msg_var = TxRemoveOutput_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_tx_remove_output_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_tx_remove_output 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_tx_complete_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxComplete * 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         LDKTxComplete msg_var = *msg;
16750         int64_t msg_ref = 0;
16751         msg_var = TxComplete_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_tx_complete_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_tx_complete 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_tx_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxSignatures * 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         LDKTxSignatures msg_var = *msg;
16777         int64_t msg_ref = 0;
16778         msg_var = TxSignatures_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_tx_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_tx_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 handle_tx_init_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxInitRbf * msg) {
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         LDKTxInitRbf msg_var = *msg;
16804         int64_t msg_ref = 0;
16805         msg_var = TxInitRbf_clone(&msg_var);
16806         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16807         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16808         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16809         CHECK(obj != NULL);
16810         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_init_rbf_meth, their_node_id_arr, msg_ref);
16811         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16812                 (*env)->ExceptionDescribe(env);
16813                 (*env)->FatalError(env, "A call to handle_tx_init_rbf in LDKChannelMessageHandler from rust threw an exception.");
16814         }
16815         if (get_jenv_res == JNI_EDETACHED) {
16816                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16817         }
16818 }
16819 void handle_tx_ack_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAckRbf * msg) {
16820         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16821         JNIEnv *env;
16822         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16823         if (get_jenv_res == JNI_EDETACHED) {
16824                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16825         } else {
16826                 DO_ASSERT(get_jenv_res == JNI_OK);
16827         }
16828         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16829         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16830         LDKTxAckRbf msg_var = *msg;
16831         int64_t msg_ref = 0;
16832         msg_var = TxAckRbf_clone(&msg_var);
16833         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16834         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16835         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16836         CHECK(obj != NULL);
16837         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_ack_rbf_meth, their_node_id_arr, msg_ref);
16838         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16839                 (*env)->ExceptionDescribe(env);
16840                 (*env)->FatalError(env, "A call to handle_tx_ack_rbf in LDKChannelMessageHandler from rust threw an exception.");
16841         }
16842         if (get_jenv_res == JNI_EDETACHED) {
16843                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16844         }
16845 }
16846 void handle_tx_abort_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAbort * msg) {
16847         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16848         JNIEnv *env;
16849         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16850         if (get_jenv_res == JNI_EDETACHED) {
16851                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16852         } else {
16853                 DO_ASSERT(get_jenv_res == JNI_OK);
16854         }
16855         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16856         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16857         LDKTxAbort msg_var = *msg;
16858         int64_t msg_ref = 0;
16859         msg_var = TxAbort_clone(&msg_var);
16860         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16861         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16862         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16863         CHECK(obj != NULL);
16864         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_abort_meth, their_node_id_arr, msg_ref);
16865         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16866                 (*env)->ExceptionDescribe(env);
16867                 (*env)->FatalError(env, "A call to handle_tx_abort in LDKChannelMessageHandler from rust threw an exception.");
16868         }
16869         if (get_jenv_res == JNI_EDETACHED) {
16870                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16871         }
16872 }
16873 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
16874         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16875         JNIEnv *env;
16876         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16877         if (get_jenv_res == JNI_EDETACHED) {
16878                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16879         } else {
16880                 DO_ASSERT(get_jenv_res == JNI_OK);
16881         }
16882         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16883         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16884         LDKUpdateAddHTLC msg_var = *msg;
16885         int64_t msg_ref = 0;
16886         msg_var = UpdateAddHTLC_clone(&msg_var);
16887         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16888         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16889         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16890         CHECK(obj != NULL);
16891         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
16892         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16893                 (*env)->ExceptionDescribe(env);
16894                 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
16895         }
16896         if (get_jenv_res == JNI_EDETACHED) {
16897                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16898         }
16899 }
16900 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
16901         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16902         JNIEnv *env;
16903         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16904         if (get_jenv_res == JNI_EDETACHED) {
16905                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16906         } else {
16907                 DO_ASSERT(get_jenv_res == JNI_OK);
16908         }
16909         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16910         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16911         LDKUpdateFulfillHTLC msg_var = *msg;
16912         int64_t msg_ref = 0;
16913         msg_var = UpdateFulfillHTLC_clone(&msg_var);
16914         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16915         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16916         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16917         CHECK(obj != NULL);
16918         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
16919         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16920                 (*env)->ExceptionDescribe(env);
16921                 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
16922         }
16923         if (get_jenv_res == JNI_EDETACHED) {
16924                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16925         }
16926 }
16927 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
16928         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16929         JNIEnv *env;
16930         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16931         if (get_jenv_res == JNI_EDETACHED) {
16932                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16933         } else {
16934                 DO_ASSERT(get_jenv_res == JNI_OK);
16935         }
16936         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16937         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16938         LDKUpdateFailHTLC msg_var = *msg;
16939         int64_t msg_ref = 0;
16940         msg_var = UpdateFailHTLC_clone(&msg_var);
16941         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16942         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16943         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16944         CHECK(obj != NULL);
16945         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
16946         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16947                 (*env)->ExceptionDescribe(env);
16948                 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
16949         }
16950         if (get_jenv_res == JNI_EDETACHED) {
16951                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16952         }
16953 }
16954 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
16955         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16956         JNIEnv *env;
16957         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16958         if (get_jenv_res == JNI_EDETACHED) {
16959                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16960         } else {
16961                 DO_ASSERT(get_jenv_res == JNI_OK);
16962         }
16963         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16964         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16965         LDKUpdateFailMalformedHTLC msg_var = *msg;
16966         int64_t msg_ref = 0;
16967         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
16968         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16969         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16970         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16971         CHECK(obj != NULL);
16972         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
16973         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16974                 (*env)->ExceptionDescribe(env);
16975                 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
16976         }
16977         if (get_jenv_res == JNI_EDETACHED) {
16978                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16979         }
16980 }
16981 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
16982         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16983         JNIEnv *env;
16984         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16985         if (get_jenv_res == JNI_EDETACHED) {
16986                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16987         } else {
16988                 DO_ASSERT(get_jenv_res == JNI_OK);
16989         }
16990         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16991         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16992         LDKCommitmentSigned msg_var = *msg;
16993         int64_t msg_ref = 0;
16994         msg_var = CommitmentSigned_clone(&msg_var);
16995         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16996         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16997         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16998         CHECK(obj != NULL);
16999         (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
17000         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17001                 (*env)->ExceptionDescribe(env);
17002                 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
17003         }
17004         if (get_jenv_res == JNI_EDETACHED) {
17005                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17006         }
17007 }
17008 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
17009         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17010         JNIEnv *env;
17011         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17012         if (get_jenv_res == JNI_EDETACHED) {
17013                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17014         } else {
17015                 DO_ASSERT(get_jenv_res == JNI_OK);
17016         }
17017         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17018         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17019         LDKRevokeAndACK msg_var = *msg;
17020         int64_t msg_ref = 0;
17021         msg_var = RevokeAndACK_clone(&msg_var);
17022         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17023         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17024         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17025         CHECK(obj != NULL);
17026         (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
17027         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17028                 (*env)->ExceptionDescribe(env);
17029                 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
17030         }
17031         if (get_jenv_res == JNI_EDETACHED) {
17032                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17033         }
17034 }
17035 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
17036         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17037         JNIEnv *env;
17038         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17039         if (get_jenv_res == JNI_EDETACHED) {
17040                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17041         } else {
17042                 DO_ASSERT(get_jenv_res == JNI_OK);
17043         }
17044         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17045         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17046         LDKUpdateFee msg_var = *msg;
17047         int64_t msg_ref = 0;
17048         msg_var = UpdateFee_clone(&msg_var);
17049         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17050         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17051         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17052         CHECK(obj != NULL);
17053         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
17054         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17055                 (*env)->ExceptionDescribe(env);
17056                 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
17057         }
17058         if (get_jenv_res == JNI_EDETACHED) {
17059                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17060         }
17061 }
17062 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
17063         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17064         JNIEnv *env;
17065         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17066         if (get_jenv_res == JNI_EDETACHED) {
17067                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17068         } else {
17069                 DO_ASSERT(get_jenv_res == JNI_OK);
17070         }
17071         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17072         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17073         LDKAnnouncementSignatures msg_var = *msg;
17074         int64_t msg_ref = 0;
17075         msg_var = AnnouncementSignatures_clone(&msg_var);
17076         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17077         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17078         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17079         CHECK(obj != NULL);
17080         (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
17081         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17082                 (*env)->ExceptionDescribe(env);
17083                 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
17084         }
17085         if (get_jenv_res == JNI_EDETACHED) {
17086                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17087         }
17088 }
17089 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
17090         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17091         JNIEnv *env;
17092         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17093         if (get_jenv_res == JNI_EDETACHED) {
17094                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17095         } else {
17096                 DO_ASSERT(get_jenv_res == JNI_OK);
17097         }
17098         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17099         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17100         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17101         CHECK(obj != NULL);
17102         (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr);
17103         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17104                 (*env)->ExceptionDescribe(env);
17105                 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
17106         }
17107         if (get_jenv_res == JNI_EDETACHED) {
17108                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17109         }
17110 }
17111 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
17112         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17113         JNIEnv *env;
17114         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17115         if (get_jenv_res == JNI_EDETACHED) {
17116                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17117         } else {
17118                 DO_ASSERT(get_jenv_res == JNI_OK);
17119         }
17120         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17121         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17122         LDKInit msg_var = *msg;
17123         int64_t msg_ref = 0;
17124         msg_var = Init_clone(&msg_var);
17125         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17126         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17127         jboolean inbound_conv = inbound;
17128         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17129         CHECK(obj != NULL);
17130         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref, inbound_conv);
17131         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17132                 (*env)->ExceptionDescribe(env);
17133                 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
17134         }
17135         void* ret_ptr = untag_ptr(ret);
17136         CHECK_ACCESS(ret_ptr);
17137         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
17138         FREE(untag_ptr(ret));
17139         if (get_jenv_res == JNI_EDETACHED) {
17140                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17141         }
17142         return ret_conv;
17143 }
17144 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
17145         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17146         JNIEnv *env;
17147         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17148         if (get_jenv_res == JNI_EDETACHED) {
17149                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17150         } else {
17151                 DO_ASSERT(get_jenv_res == JNI_OK);
17152         }
17153         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17154         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17155         LDKChannelReestablish msg_var = *msg;
17156         int64_t msg_ref = 0;
17157         msg_var = ChannelReestablish_clone(&msg_var);
17158         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17159         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17160         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17161         CHECK(obj != NULL);
17162         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
17163         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17164                 (*env)->ExceptionDescribe(env);
17165                 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
17166         }
17167         if (get_jenv_res == JNI_EDETACHED) {
17168                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17169         }
17170 }
17171 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
17172         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17173         JNIEnv *env;
17174         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17175         if (get_jenv_res == JNI_EDETACHED) {
17176                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17177         } else {
17178                 DO_ASSERT(get_jenv_res == JNI_OK);
17179         }
17180         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17181         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17182         LDKChannelUpdate msg_var = *msg;
17183         int64_t msg_ref = 0;
17184         msg_var = ChannelUpdate_clone(&msg_var);
17185         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17186         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17187         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17188         CHECK(obj != NULL);
17189         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
17190         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17191                 (*env)->ExceptionDescribe(env);
17192                 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
17193         }
17194         if (get_jenv_res == JNI_EDETACHED) {
17195                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17196         }
17197 }
17198 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
17199         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17200         JNIEnv *env;
17201         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17202         if (get_jenv_res == JNI_EDETACHED) {
17203                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17204         } else {
17205                 DO_ASSERT(get_jenv_res == JNI_OK);
17206         }
17207         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17208         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17209         LDKErrorMessage msg_var = *msg;
17210         int64_t msg_ref = 0;
17211         msg_var = ErrorMessage_clone(&msg_var);
17212         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17213         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17214         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17215         CHECK(obj != NULL);
17216         (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
17217         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17218                 (*env)->ExceptionDescribe(env);
17219                 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
17220         }
17221         if (get_jenv_res == JNI_EDETACHED) {
17222                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17223         }
17224 }
17225 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
17226         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17227         JNIEnv *env;
17228         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17229         if (get_jenv_res == JNI_EDETACHED) {
17230                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17231         } else {
17232                 DO_ASSERT(get_jenv_res == JNI_OK);
17233         }
17234         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17235         CHECK(obj != NULL);
17236         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
17237         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17238                 (*env)->ExceptionDescribe(env);
17239                 (*env)->FatalError(env, "A call to provided_node_features in LDKChannelMessageHandler from rust threw an exception.");
17240         }
17241         LDKNodeFeatures ret_conv;
17242         ret_conv.inner = untag_ptr(ret);
17243         ret_conv.is_owned = ptr_is_owned(ret);
17244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
17245         if (get_jenv_res == JNI_EDETACHED) {
17246                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17247         }
17248         return ret_conv;
17249 }
17250 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
17251         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17252         JNIEnv *env;
17253         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17254         if (get_jenv_res == JNI_EDETACHED) {
17255                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17256         } else {
17257                 DO_ASSERT(get_jenv_res == JNI_OK);
17258         }
17259         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17260         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17261         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17262         CHECK(obj != NULL);
17263         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
17264         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17265                 (*env)->ExceptionDescribe(env);
17266                 (*env)->FatalError(env, "A call to provided_init_features in LDKChannelMessageHandler from rust threw an exception.");
17267         }
17268         LDKInitFeatures ret_conv;
17269         ret_conv.inner = untag_ptr(ret);
17270         ret_conv.is_owned = ptr_is_owned(ret);
17271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
17272         if (get_jenv_res == JNI_EDETACHED) {
17273                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17274         }
17275         return ret_conv;
17276 }
17277 LDKCOption_CVec_ThirtyTwoBytesZZ get_chain_hashes_LDKChannelMessageHandler_jcall(const void* this_arg) {
17278         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17279         JNIEnv *env;
17280         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17281         if (get_jenv_res == JNI_EDETACHED) {
17282                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17283         } else {
17284                 DO_ASSERT(get_jenv_res == JNI_OK);
17285         }
17286         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17287         CHECK(obj != NULL);
17288         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_chain_hashes_meth);
17289         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17290                 (*env)->ExceptionDescribe(env);
17291                 (*env)->FatalError(env, "A call to get_chain_hashes in LDKChannelMessageHandler from rust threw an exception.");
17292         }
17293         void* ret_ptr = untag_ptr(ret);
17294         CHECK_ACCESS(ret_ptr);
17295         LDKCOption_CVec_ThirtyTwoBytesZZ ret_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(ret_ptr);
17296         FREE(untag_ptr(ret));
17297         if (get_jenv_res == JNI_EDETACHED) {
17298                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17299         }
17300         return ret_conv;
17301 }
17302 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
17303         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
17304         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17305         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
17306 }
17307 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
17308         jclass c = (*env)->GetObjectClass(env, o);
17309         CHECK(c != NULL);
17310         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
17311         atomic_init(&calls->refcnt, 1);
17312         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17313         calls->o = (*env)->NewWeakGlobalRef(env, o);
17314         calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJ)V");
17315         CHECK(calls->handle_open_channel_meth != NULL);
17316         calls->handle_open_channel_v2_meth = (*env)->GetMethodID(env, c, "handle_open_channel_v2", "([BJ)V");
17317         CHECK(calls->handle_open_channel_v2_meth != NULL);
17318         calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJ)V");
17319         CHECK(calls->handle_accept_channel_meth != NULL);
17320         calls->handle_accept_channel_v2_meth = (*env)->GetMethodID(env, c, "handle_accept_channel_v2", "([BJ)V");
17321         CHECK(calls->handle_accept_channel_v2_meth != NULL);
17322         calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
17323         CHECK(calls->handle_funding_created_meth != NULL);
17324         calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
17325         CHECK(calls->handle_funding_signed_meth != NULL);
17326         calls->handle_channel_ready_meth = (*env)->GetMethodID(env, c, "handle_channel_ready", "([BJ)V");
17327         CHECK(calls->handle_channel_ready_meth != NULL);
17328         calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
17329         CHECK(calls->handle_shutdown_meth != NULL);
17330         calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
17331         CHECK(calls->handle_closing_signed_meth != NULL);
17332         calls->handle_tx_add_input_meth = (*env)->GetMethodID(env, c, "handle_tx_add_input", "([BJ)V");
17333         CHECK(calls->handle_tx_add_input_meth != NULL);
17334         calls->handle_tx_add_output_meth = (*env)->GetMethodID(env, c, "handle_tx_add_output", "([BJ)V");
17335         CHECK(calls->handle_tx_add_output_meth != NULL);
17336         calls->handle_tx_remove_input_meth = (*env)->GetMethodID(env, c, "handle_tx_remove_input", "([BJ)V");
17337         CHECK(calls->handle_tx_remove_input_meth != NULL);
17338         calls->handle_tx_remove_output_meth = (*env)->GetMethodID(env, c, "handle_tx_remove_output", "([BJ)V");
17339         CHECK(calls->handle_tx_remove_output_meth != NULL);
17340         calls->handle_tx_complete_meth = (*env)->GetMethodID(env, c, "handle_tx_complete", "([BJ)V");
17341         CHECK(calls->handle_tx_complete_meth != NULL);
17342         calls->handle_tx_signatures_meth = (*env)->GetMethodID(env, c, "handle_tx_signatures", "([BJ)V");
17343         CHECK(calls->handle_tx_signatures_meth != NULL);
17344         calls->handle_tx_init_rbf_meth = (*env)->GetMethodID(env, c, "handle_tx_init_rbf", "([BJ)V");
17345         CHECK(calls->handle_tx_init_rbf_meth != NULL);
17346         calls->handle_tx_ack_rbf_meth = (*env)->GetMethodID(env, c, "handle_tx_ack_rbf", "([BJ)V");
17347         CHECK(calls->handle_tx_ack_rbf_meth != NULL);
17348         calls->handle_tx_abort_meth = (*env)->GetMethodID(env, c, "handle_tx_abort", "([BJ)V");
17349         CHECK(calls->handle_tx_abort_meth != NULL);
17350         calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
17351         CHECK(calls->handle_update_add_htlc_meth != NULL);
17352         calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
17353         CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
17354         calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
17355         CHECK(calls->handle_update_fail_htlc_meth != NULL);
17356         calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
17357         CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
17358         calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
17359         CHECK(calls->handle_commitment_signed_meth != NULL);
17360         calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
17361         CHECK(calls->handle_revoke_and_ack_meth != NULL);
17362         calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
17363         CHECK(calls->handle_update_fee_meth != NULL);
17364         calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
17365         CHECK(calls->handle_announcement_signatures_meth != NULL);
17366         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([B)V");
17367         CHECK(calls->peer_disconnected_meth != NULL);
17368         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
17369         CHECK(calls->peer_connected_meth != NULL);
17370         calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
17371         CHECK(calls->handle_channel_reestablish_meth != NULL);
17372         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
17373         CHECK(calls->handle_channel_update_meth != NULL);
17374         calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
17375         CHECK(calls->handle_error_meth != NULL);
17376         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
17377         CHECK(calls->provided_node_features_meth != NULL);
17378         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
17379         CHECK(calls->provided_init_features_meth != NULL);
17380         calls->get_chain_hashes_meth = (*env)->GetMethodID(env, c, "get_chain_hashes", "()J");
17381         CHECK(calls->get_chain_hashes_meth != NULL);
17382
17383         LDKChannelMessageHandler ret = {
17384                 .this_arg = (void*) calls,
17385                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
17386                 .handle_open_channel_v2 = handle_open_channel_v2_LDKChannelMessageHandler_jcall,
17387                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
17388                 .handle_accept_channel_v2 = handle_accept_channel_v2_LDKChannelMessageHandler_jcall,
17389                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
17390                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
17391                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
17392                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
17393                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
17394                 .handle_tx_add_input = handle_tx_add_input_LDKChannelMessageHandler_jcall,
17395                 .handle_tx_add_output = handle_tx_add_output_LDKChannelMessageHandler_jcall,
17396                 .handle_tx_remove_input = handle_tx_remove_input_LDKChannelMessageHandler_jcall,
17397                 .handle_tx_remove_output = handle_tx_remove_output_LDKChannelMessageHandler_jcall,
17398                 .handle_tx_complete = handle_tx_complete_LDKChannelMessageHandler_jcall,
17399                 .handle_tx_signatures = handle_tx_signatures_LDKChannelMessageHandler_jcall,
17400                 .handle_tx_init_rbf = handle_tx_init_rbf_LDKChannelMessageHandler_jcall,
17401                 .handle_tx_ack_rbf = handle_tx_ack_rbf_LDKChannelMessageHandler_jcall,
17402                 .handle_tx_abort = handle_tx_abort_LDKChannelMessageHandler_jcall,
17403                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
17404                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
17405                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
17406                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
17407                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
17408                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
17409                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
17410                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
17411                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
17412                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
17413                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
17414                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
17415                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
17416                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
17417                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
17418                 .get_chain_hashes = get_chain_hashes_LDKChannelMessageHandler_jcall,
17419                 .free = LDKChannelMessageHandler_JCalls_free,
17420                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
17421         };
17422         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
17423         return ret;
17424 }
17425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
17426         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
17427         *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
17428         return tag_ptr(res_ptr, true);
17429 }
17430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
17431         LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)untag_ptr(arg);
17432         return tag_ptr(&inp->MessageSendEventsProvider, false);
17433 }
17434 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) {
17435         void* this_arg_ptr = untag_ptr(this_arg);
17436         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17437         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17438         LDKPublicKey their_node_id_ref;
17439         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17440         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17441         LDKOpenChannel msg_conv;
17442         msg_conv.inner = untag_ptr(msg);
17443         msg_conv.is_owned = ptr_is_owned(msg);
17444         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17445         msg_conv.is_owned = false;
17446         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17447 }
17448
17449 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) {
17450         void* this_arg_ptr = untag_ptr(this_arg);
17451         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17452         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17453         LDKPublicKey their_node_id_ref;
17454         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17455         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17456         LDKOpenChannelV2 msg_conv;
17457         msg_conv.inner = untag_ptr(msg);
17458         msg_conv.is_owned = ptr_is_owned(msg);
17459         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17460         msg_conv.is_owned = false;
17461         (this_arg_conv->handle_open_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17462 }
17463
17464 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) {
17465         void* this_arg_ptr = untag_ptr(this_arg);
17466         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17467         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17468         LDKPublicKey their_node_id_ref;
17469         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17470         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17471         LDKAcceptChannel msg_conv;
17472         msg_conv.inner = untag_ptr(msg);
17473         msg_conv.is_owned = ptr_is_owned(msg);
17474         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17475         msg_conv.is_owned = false;
17476         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17477 }
17478
17479 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) {
17480         void* this_arg_ptr = untag_ptr(this_arg);
17481         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17482         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17483         LDKPublicKey their_node_id_ref;
17484         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17485         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17486         LDKAcceptChannelV2 msg_conv;
17487         msg_conv.inner = untag_ptr(msg);
17488         msg_conv.is_owned = ptr_is_owned(msg);
17489         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17490         msg_conv.is_owned = false;
17491         (this_arg_conv->handle_accept_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17492 }
17493
17494 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) {
17495         void* this_arg_ptr = untag_ptr(this_arg);
17496         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17497         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17498         LDKPublicKey their_node_id_ref;
17499         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17500         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17501         LDKFundingCreated msg_conv;
17502         msg_conv.inner = untag_ptr(msg);
17503         msg_conv.is_owned = ptr_is_owned(msg);
17504         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17505         msg_conv.is_owned = false;
17506         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17507 }
17508
17509 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) {
17510         void* this_arg_ptr = untag_ptr(this_arg);
17511         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17512         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17513         LDKPublicKey their_node_id_ref;
17514         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17515         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17516         LDKFundingSigned msg_conv;
17517         msg_conv.inner = untag_ptr(msg);
17518         msg_conv.is_owned = ptr_is_owned(msg);
17519         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17520         msg_conv.is_owned = false;
17521         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17522 }
17523
17524 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) {
17525         void* this_arg_ptr = untag_ptr(this_arg);
17526         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17527         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17528         LDKPublicKey their_node_id_ref;
17529         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17530         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17531         LDKChannelReady msg_conv;
17532         msg_conv.inner = untag_ptr(msg);
17533         msg_conv.is_owned = ptr_is_owned(msg);
17534         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17535         msg_conv.is_owned = false;
17536         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17537 }
17538
17539 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) {
17540         void* this_arg_ptr = untag_ptr(this_arg);
17541         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17542         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17543         LDKPublicKey their_node_id_ref;
17544         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17545         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17546         LDKShutdown msg_conv;
17547         msg_conv.inner = untag_ptr(msg);
17548         msg_conv.is_owned = ptr_is_owned(msg);
17549         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17550         msg_conv.is_owned = false;
17551         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17552 }
17553
17554 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) {
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         LDKClosingSigned 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_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17567 }
17568
17569 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) {
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         LDKTxAddInput 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_tx_add_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17582 }
17583
17584 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) {
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         LDKTxAddOutput 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_tx_add_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17597 }
17598
17599 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) {
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         LDKPublicKey their_node_id_ref;
17604         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17605         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17606         LDKTxRemoveInput msg_conv;
17607         msg_conv.inner = untag_ptr(msg);
17608         msg_conv.is_owned = ptr_is_owned(msg);
17609         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17610         msg_conv.is_owned = false;
17611         (this_arg_conv->handle_tx_remove_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17612 }
17613
17614 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) {
17615         void* this_arg_ptr = untag_ptr(this_arg);
17616         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17617         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17618         LDKPublicKey their_node_id_ref;
17619         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17620         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17621         LDKTxRemoveOutput msg_conv;
17622         msg_conv.inner = untag_ptr(msg);
17623         msg_conv.is_owned = ptr_is_owned(msg);
17624         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17625         msg_conv.is_owned = false;
17626         (this_arg_conv->handle_tx_remove_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17627 }
17628
17629 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) {
17630         void* this_arg_ptr = untag_ptr(this_arg);
17631         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17632         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17633         LDKPublicKey their_node_id_ref;
17634         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17635         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17636         LDKTxComplete msg_conv;
17637         msg_conv.inner = untag_ptr(msg);
17638         msg_conv.is_owned = ptr_is_owned(msg);
17639         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17640         msg_conv.is_owned = false;
17641         (this_arg_conv->handle_tx_complete)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17642 }
17643
17644 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) {
17645         void* this_arg_ptr = untag_ptr(this_arg);
17646         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17647         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17648         LDKPublicKey their_node_id_ref;
17649         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17650         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17651         LDKTxSignatures msg_conv;
17652         msg_conv.inner = untag_ptr(msg);
17653         msg_conv.is_owned = ptr_is_owned(msg);
17654         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17655         msg_conv.is_owned = false;
17656         (this_arg_conv->handle_tx_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17657 }
17658
17659 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) {
17660         void* this_arg_ptr = untag_ptr(this_arg);
17661         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17662         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17663         LDKPublicKey their_node_id_ref;
17664         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17665         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17666         LDKTxInitRbf msg_conv;
17667         msg_conv.inner = untag_ptr(msg);
17668         msg_conv.is_owned = ptr_is_owned(msg);
17669         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17670         msg_conv.is_owned = false;
17671         (this_arg_conv->handle_tx_init_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17672 }
17673
17674 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) {
17675         void* this_arg_ptr = untag_ptr(this_arg);
17676         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17677         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17678         LDKPublicKey their_node_id_ref;
17679         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17680         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17681         LDKTxAckRbf msg_conv;
17682         msg_conv.inner = untag_ptr(msg);
17683         msg_conv.is_owned = ptr_is_owned(msg);
17684         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17685         msg_conv.is_owned = false;
17686         (this_arg_conv->handle_tx_ack_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17687 }
17688
17689 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) {
17690         void* this_arg_ptr = untag_ptr(this_arg);
17691         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17692         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17693         LDKPublicKey their_node_id_ref;
17694         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17695         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17696         LDKTxAbort msg_conv;
17697         msg_conv.inner = untag_ptr(msg);
17698         msg_conv.is_owned = ptr_is_owned(msg);
17699         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17700         msg_conv.is_owned = false;
17701         (this_arg_conv->handle_tx_abort)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17702 }
17703
17704 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) {
17705         void* this_arg_ptr = untag_ptr(this_arg);
17706         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17707         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17708         LDKPublicKey their_node_id_ref;
17709         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17710         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17711         LDKUpdateAddHTLC msg_conv;
17712         msg_conv.inner = untag_ptr(msg);
17713         msg_conv.is_owned = ptr_is_owned(msg);
17714         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17715         msg_conv.is_owned = false;
17716         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17717 }
17718
17719 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) {
17720         void* this_arg_ptr = untag_ptr(this_arg);
17721         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17722         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17723         LDKPublicKey their_node_id_ref;
17724         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17725         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17726         LDKUpdateFulfillHTLC msg_conv;
17727         msg_conv.inner = untag_ptr(msg);
17728         msg_conv.is_owned = ptr_is_owned(msg);
17729         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17730         msg_conv.is_owned = false;
17731         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17732 }
17733
17734 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) {
17735         void* this_arg_ptr = untag_ptr(this_arg);
17736         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17737         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17738         LDKPublicKey their_node_id_ref;
17739         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17740         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17741         LDKUpdateFailHTLC msg_conv;
17742         msg_conv.inner = untag_ptr(msg);
17743         msg_conv.is_owned = ptr_is_owned(msg);
17744         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17745         msg_conv.is_owned = false;
17746         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17747 }
17748
17749 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) {
17750         void* this_arg_ptr = untag_ptr(this_arg);
17751         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17752         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17753         LDKPublicKey their_node_id_ref;
17754         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17755         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17756         LDKUpdateFailMalformedHTLC msg_conv;
17757         msg_conv.inner = untag_ptr(msg);
17758         msg_conv.is_owned = ptr_is_owned(msg);
17759         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17760         msg_conv.is_owned = false;
17761         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17762 }
17763
17764 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) {
17765         void* this_arg_ptr = untag_ptr(this_arg);
17766         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17767         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17768         LDKPublicKey their_node_id_ref;
17769         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17770         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17771         LDKCommitmentSigned msg_conv;
17772         msg_conv.inner = untag_ptr(msg);
17773         msg_conv.is_owned = ptr_is_owned(msg);
17774         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17775         msg_conv.is_owned = false;
17776         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17777 }
17778
17779 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) {
17780         void* this_arg_ptr = untag_ptr(this_arg);
17781         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17782         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17783         LDKPublicKey their_node_id_ref;
17784         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17785         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17786         LDKRevokeAndACK msg_conv;
17787         msg_conv.inner = untag_ptr(msg);
17788         msg_conv.is_owned = ptr_is_owned(msg);
17789         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17790         msg_conv.is_owned = false;
17791         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17792 }
17793
17794 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) {
17795         void* this_arg_ptr = untag_ptr(this_arg);
17796         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17797         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17798         LDKPublicKey their_node_id_ref;
17799         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17800         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17801         LDKUpdateFee msg_conv;
17802         msg_conv.inner = untag_ptr(msg);
17803         msg_conv.is_owned = ptr_is_owned(msg);
17804         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17805         msg_conv.is_owned = false;
17806         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17807 }
17808
17809 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) {
17810         void* this_arg_ptr = untag_ptr(this_arg);
17811         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17812         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17813         LDKPublicKey their_node_id_ref;
17814         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17815         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17816         LDKAnnouncementSignatures msg_conv;
17817         msg_conv.inner = untag_ptr(msg);
17818         msg_conv.is_owned = ptr_is_owned(msg);
17819         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17820         msg_conv.is_owned = false;
17821         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17822 }
17823
17824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
17825         void* this_arg_ptr = untag_ptr(this_arg);
17826         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17827         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17828         LDKPublicKey their_node_id_ref;
17829         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17830         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17831         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
17832 }
17833
17834 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) {
17835         void* this_arg_ptr = untag_ptr(this_arg);
17836         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17837         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17838         LDKPublicKey their_node_id_ref;
17839         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17840         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17841         LDKInit msg_conv;
17842         msg_conv.inner = untag_ptr(msg);
17843         msg_conv.is_owned = ptr_is_owned(msg);
17844         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17845         msg_conv.is_owned = false;
17846         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
17847         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
17848         return tag_ptr(ret_conv, true);
17849 }
17850
17851 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) {
17852         void* this_arg_ptr = untag_ptr(this_arg);
17853         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17854         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17855         LDKPublicKey their_node_id_ref;
17856         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17857         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17858         LDKChannelReestablish msg_conv;
17859         msg_conv.inner = untag_ptr(msg);
17860         msg_conv.is_owned = ptr_is_owned(msg);
17861         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17862         msg_conv.is_owned = false;
17863         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17864 }
17865
17866 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) {
17867         void* this_arg_ptr = untag_ptr(this_arg);
17868         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17869         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17870         LDKPublicKey their_node_id_ref;
17871         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17872         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17873         LDKChannelUpdate msg_conv;
17874         msg_conv.inner = untag_ptr(msg);
17875         msg_conv.is_owned = ptr_is_owned(msg);
17876         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17877         msg_conv.is_owned = false;
17878         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17879 }
17880
17881 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) {
17882         void* this_arg_ptr = untag_ptr(this_arg);
17883         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17884         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17885         LDKPublicKey their_node_id_ref;
17886         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17887         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17888         LDKErrorMessage msg_conv;
17889         msg_conv.inner = untag_ptr(msg);
17890         msg_conv.is_owned = ptr_is_owned(msg);
17891         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17892         msg_conv.is_owned = false;
17893         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17894 }
17895
17896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
17897         void* this_arg_ptr = untag_ptr(this_arg);
17898         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17899         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17900         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
17901         int64_t ret_ref = 0;
17902         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17903         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17904         return ret_ref;
17905 }
17906
17907 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) {
17908         void* this_arg_ptr = untag_ptr(this_arg);
17909         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17910         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17911         LDKPublicKey their_node_id_ref;
17912         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17913         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17914         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
17915         int64_t ret_ref = 0;
17916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17918         return ret_ref;
17919 }
17920
17921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1get_1chain_1hashes(JNIEnv *env, jclass clz, int64_t this_arg) {
17922         void* this_arg_ptr = untag_ptr(this_arg);
17923         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17924         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17925         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
17926         *ret_copy = (this_arg_conv->get_chain_hashes)(this_arg_conv->this_arg);
17927         int64_t ret_ref = tag_ptr(ret_copy, true);
17928         return ret_ref;
17929 }
17930
17931 typedef struct LDKOffersMessageHandler_JCalls {
17932         atomic_size_t refcnt;
17933         JavaVM *vm;
17934         jweak o;
17935         jmethodID handle_message_meth;
17936         jmethodID release_pending_messages_meth;
17937 } LDKOffersMessageHandler_JCalls;
17938 static void LDKOffersMessageHandler_JCalls_free(void* this_arg) {
17939         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
17940         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17941                 JNIEnv *env;
17942                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17943                 if (get_jenv_res == JNI_EDETACHED) {
17944                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17945                 } else {
17946                         DO_ASSERT(get_jenv_res == JNI_OK);
17947                 }
17948                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17949                 if (get_jenv_res == JNI_EDETACHED) {
17950                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17951                 }
17952                 FREE(j_calls);
17953         }
17954 }
17955 LDKCOption_OffersMessageZ handle_message_LDKOffersMessageHandler_jcall(const void* this_arg, LDKOffersMessage message) {
17956         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
17957         JNIEnv *env;
17958         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17959         if (get_jenv_res == JNI_EDETACHED) {
17960                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17961         } else {
17962                 DO_ASSERT(get_jenv_res == JNI_OK);
17963         }
17964         LDKOffersMessage *message_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
17965         *message_copy = message;
17966         int64_t message_ref = tag_ptr(message_copy, true);
17967         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17968         CHECK(obj != NULL);
17969         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_message_meth, message_ref);
17970         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17971                 (*env)->ExceptionDescribe(env);
17972                 (*env)->FatalError(env, "A call to handle_message in LDKOffersMessageHandler from rust threw an exception.");
17973         }
17974         void* ret_ptr = untag_ptr(ret);
17975         CHECK_ACCESS(ret_ptr);
17976         LDKCOption_OffersMessageZ ret_conv = *(LDKCOption_OffersMessageZ*)(ret_ptr);
17977         FREE(untag_ptr(ret));
17978         if (get_jenv_res == JNI_EDETACHED) {
17979                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17980         }
17981         return ret_conv;
17982 }
17983 LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ release_pending_messages_LDKOffersMessageHandler_jcall(const void* this_arg) {
17984         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
17985         JNIEnv *env;
17986         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17987         if (get_jenv_res == JNI_EDETACHED) {
17988                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17989         } else {
17990                 DO_ASSERT(get_jenv_res == JNI_OK);
17991         }
17992         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17993         CHECK(obj != NULL);
17994         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_messages_meth);
17995         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17996                 (*env)->ExceptionDescribe(env);
17997                 (*env)->FatalError(env, "A call to release_pending_messages in LDKOffersMessageHandler from rust threw an exception.");
17998         }
17999         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_constr;
18000         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
18001         if (ret_constr.datalen > 0)
18002                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
18003         else
18004                 ret_constr.data = NULL;
18005         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
18006         for (size_t x = 0; x < ret_constr.datalen; x++) {
18007                 int64_t ret_conv_49 = ret_vals[x];
18008                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
18009                 CHECK_ACCESS(ret_conv_49_ptr);
18010                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ ret_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(ret_conv_49_ptr);
18011                 FREE(untag_ptr(ret_conv_49));
18012                 ret_constr.data[x] = ret_conv_49_conv;
18013         }
18014         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
18015         if (get_jenv_res == JNI_EDETACHED) {
18016                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18017         }
18018         return ret_constr;
18019 }
18020 static void LDKOffersMessageHandler_JCalls_cloned(LDKOffersMessageHandler* new_obj) {
18021         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) new_obj->this_arg;
18022         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18023 }
18024 static inline LDKOffersMessageHandler LDKOffersMessageHandler_init (JNIEnv *env, jclass clz, jobject o) {
18025         jclass c = (*env)->GetObjectClass(env, o);
18026         CHECK(c != NULL);
18027         LDKOffersMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOffersMessageHandler_JCalls), "LDKOffersMessageHandler_JCalls");
18028         atomic_init(&calls->refcnt, 1);
18029         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18030         calls->o = (*env)->NewWeakGlobalRef(env, o);
18031         calls->handle_message_meth = (*env)->GetMethodID(env, c, "handle_message", "(J)J");
18032         CHECK(calls->handle_message_meth != NULL);
18033         calls->release_pending_messages_meth = (*env)->GetMethodID(env, c, "release_pending_messages", "()[J");
18034         CHECK(calls->release_pending_messages_meth != NULL);
18035
18036         LDKOffersMessageHandler ret = {
18037                 .this_arg = (void*) calls,
18038                 .handle_message = handle_message_LDKOffersMessageHandler_jcall,
18039                 .release_pending_messages = release_pending_messages_LDKOffersMessageHandler_jcall,
18040                 .free = LDKOffersMessageHandler_JCalls_free,
18041         };
18042         return ret;
18043 }
18044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOffersMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) {
18045         LDKOffersMessageHandler *res_ptr = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
18046         *res_ptr = LDKOffersMessageHandler_init(env, clz, o);
18047         return tag_ptr(res_ptr, true);
18048 }
18049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1handle_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t message) {
18050         void* this_arg_ptr = untag_ptr(this_arg);
18051         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18052         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
18053         void* message_ptr = untag_ptr(message);
18054         CHECK_ACCESS(message_ptr);
18055         LDKOffersMessage message_conv = *(LDKOffersMessage*)(message_ptr);
18056         message_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(message));
18057         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
18058         *ret_copy = (this_arg_conv->handle_message)(this_arg_conv->this_arg, message_conv);
18059         int64_t ret_ref = tag_ptr(ret_copy, true);
18060         return ret_ref;
18061 }
18062
18063 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1release_1pending_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
18064         void* this_arg_ptr = untag_ptr(this_arg);
18065         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18066         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
18067         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_messages)(this_arg_conv->this_arg);
18068         int64_tArray ret_arr = NULL;
18069         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
18070         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
18071         for (size_t x = 0; x < ret_var.datalen; x++) {
18072                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
18073                 *ret_conv_49_conv = ret_var.data[x];
18074                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
18075         }
18076         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
18077         FREE(ret_var.data);
18078         return ret_arr;
18079 }
18080
18081 typedef struct LDKRoutingMessageHandler_JCalls {
18082         atomic_size_t refcnt;
18083         JavaVM *vm;
18084         jweak o;
18085         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
18086         jmethodID handle_node_announcement_meth;
18087         jmethodID handle_channel_announcement_meth;
18088         jmethodID handle_channel_update_meth;
18089         jmethodID get_next_channel_announcement_meth;
18090         jmethodID get_next_node_announcement_meth;
18091         jmethodID peer_connected_meth;
18092         jmethodID handle_reply_channel_range_meth;
18093         jmethodID handle_reply_short_channel_ids_end_meth;
18094         jmethodID handle_query_channel_range_meth;
18095         jmethodID handle_query_short_channel_ids_meth;
18096         jmethodID processing_queue_high_meth;
18097         jmethodID provided_node_features_meth;
18098         jmethodID provided_init_features_meth;
18099 } LDKRoutingMessageHandler_JCalls;
18100 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
18101         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
18102         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18103                 JNIEnv *env;
18104                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18105                 if (get_jenv_res == JNI_EDETACHED) {
18106                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18107                 } else {
18108                         DO_ASSERT(get_jenv_res == JNI_OK);
18109                 }
18110                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18111                 if (get_jenv_res == JNI_EDETACHED) {
18112                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18113                 }
18114                 FREE(j_calls);
18115         }
18116 }
18117 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
18118         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
18119         JNIEnv *env;
18120         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18121         if (get_jenv_res == JNI_EDETACHED) {
18122                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18123         } else {
18124                 DO_ASSERT(get_jenv_res == JNI_OK);
18125         }
18126         LDKNodeAnnouncement msg_var = *msg;
18127         int64_t msg_ref = 0;
18128         msg_var = NodeAnnouncement_clone(&msg_var);
18129         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18130         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18131         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18132         CHECK(obj != NULL);
18133         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
18134         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18135                 (*env)->ExceptionDescribe(env);
18136                 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
18137         }
18138         void* ret_ptr = untag_ptr(ret);
18139         CHECK_ACCESS(ret_ptr);
18140         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
18141         FREE(untag_ptr(ret));
18142         if (get_jenv_res == JNI_EDETACHED) {
18143                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18144         }
18145         return ret_conv;
18146 }
18147 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
18148         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
18149         JNIEnv *env;
18150         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18151         if (get_jenv_res == JNI_EDETACHED) {
18152                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18153         } else {
18154                 DO_ASSERT(get_jenv_res == JNI_OK);
18155         }
18156         LDKChannelAnnouncement msg_var = *msg;
18157         int64_t msg_ref = 0;
18158         msg_var = ChannelAnnouncement_clone(&msg_var);
18159         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18160         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18161         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18162         CHECK(obj != NULL);
18163         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
18164         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18165                 (*env)->ExceptionDescribe(env);
18166                 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
18167         }
18168         void* ret_ptr = untag_ptr(ret);
18169         CHECK_ACCESS(ret_ptr);
18170         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
18171         FREE(untag_ptr(ret));
18172         if (get_jenv_res == JNI_EDETACHED) {
18173                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18174         }
18175         return ret_conv;
18176 }
18177 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
18178         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
18179         JNIEnv *env;
18180         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18181         if (get_jenv_res == JNI_EDETACHED) {
18182                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18183         } else {
18184                 DO_ASSERT(get_jenv_res == JNI_OK);
18185         }
18186         LDKChannelUpdate msg_var = *msg;
18187         int64_t msg_ref = 0;
18188         msg_var = ChannelUpdate_clone(&msg_var);
18189         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18190         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18191         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18192         CHECK(obj != NULL);
18193         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
18194         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18195                 (*env)->ExceptionDescribe(env);
18196                 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
18197         }
18198         void* ret_ptr = untag_ptr(ret);
18199         CHECK_ACCESS(ret_ptr);
18200         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
18201         FREE(untag_ptr(ret));
18202         if (get_jenv_res == JNI_EDETACHED) {
18203                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18204         }
18205         return ret_conv;
18206 }
18207 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
18208         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
18209         JNIEnv *env;
18210         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18211         if (get_jenv_res == JNI_EDETACHED) {
18212                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18213         } else {
18214                 DO_ASSERT(get_jenv_res == JNI_OK);
18215         }
18216         int64_t starting_point_conv = starting_point;
18217         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18218         CHECK(obj != NULL);
18219         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_next_channel_announcement_meth, starting_point_conv);
18220         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18221                 (*env)->ExceptionDescribe(env);
18222                 (*env)->FatalError(env, "A call to get_next_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
18223         }
18224         void* ret_ptr = untag_ptr(ret);
18225         CHECK_ACCESS(ret_ptr);
18226         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
18227         FREE(untag_ptr(ret));
18228         if (get_jenv_res == JNI_EDETACHED) {
18229                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18230         }
18231         return ret_conv;
18232 }
18233 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
18234         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
18235         JNIEnv *env;
18236         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18237         if (get_jenv_res == JNI_EDETACHED) {
18238                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18239         } else {
18240                 DO_ASSERT(get_jenv_res == JNI_OK);
18241         }
18242         LDKNodeId starting_point_var = starting_point;
18243         int64_t starting_point_ref = 0;
18244         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
18245         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
18246         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18247         CHECK(obj != NULL);
18248         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_next_node_announcement_meth, starting_point_ref);
18249         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18250                 (*env)->ExceptionDescribe(env);
18251                 (*env)->FatalError(env, "A call to get_next_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
18252         }
18253         LDKNodeAnnouncement ret_conv;
18254         ret_conv.inner = untag_ptr(ret);
18255         ret_conv.is_owned = ptr_is_owned(ret);
18256         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
18257         if (get_jenv_res == JNI_EDETACHED) {
18258                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18259         }
18260         return ret_conv;
18261 }
18262 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
18263         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
18264         JNIEnv *env;
18265         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18266         if (get_jenv_res == JNI_EDETACHED) {
18267                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18268         } else {
18269                 DO_ASSERT(get_jenv_res == JNI_OK);
18270         }
18271         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18272         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18273         LDKInit init_var = *init;
18274         int64_t init_ref = 0;
18275         init_var = Init_clone(&init_var);
18276         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
18277         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
18278         jboolean inbound_conv = inbound;
18279         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18280         CHECK(obj != NULL);
18281         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref, inbound_conv);
18282         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18283                 (*env)->ExceptionDescribe(env);
18284                 (*env)->FatalError(env, "A call to peer_connected in LDKRoutingMessageHandler from rust threw an exception.");
18285         }
18286         void* ret_ptr = untag_ptr(ret);
18287         CHECK_ACCESS(ret_ptr);
18288         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
18289         FREE(untag_ptr(ret));
18290         if (get_jenv_res == JNI_EDETACHED) {
18291                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18292         }
18293         return ret_conv;
18294 }
18295 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
18296         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
18297         JNIEnv *env;
18298         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18299         if (get_jenv_res == JNI_EDETACHED) {
18300                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18301         } else {
18302                 DO_ASSERT(get_jenv_res == JNI_OK);
18303         }
18304         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18305         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18306         LDKReplyChannelRange msg_var = msg;
18307         int64_t msg_ref = 0;
18308         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18309         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18310         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18311         CHECK(obj != NULL);
18312         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
18313         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18314                 (*env)->ExceptionDescribe(env);
18315                 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
18316         }
18317         void* ret_ptr = untag_ptr(ret);
18318         CHECK_ACCESS(ret_ptr);
18319         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
18320         FREE(untag_ptr(ret));
18321         if (get_jenv_res == JNI_EDETACHED) {
18322                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18323         }
18324         return ret_conv;
18325 }
18326 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
18327         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
18328         JNIEnv *env;
18329         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18330         if (get_jenv_res == JNI_EDETACHED) {
18331                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18332         } else {
18333                 DO_ASSERT(get_jenv_res == JNI_OK);
18334         }
18335         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18336         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18337         LDKReplyShortChannelIdsEnd msg_var = msg;
18338         int64_t msg_ref = 0;
18339         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18340         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18341         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18342         CHECK(obj != NULL);
18343         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
18344         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18345                 (*env)->ExceptionDescribe(env);
18346                 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
18347         }
18348         void* ret_ptr = untag_ptr(ret);
18349         CHECK_ACCESS(ret_ptr);
18350         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
18351         FREE(untag_ptr(ret));
18352         if (get_jenv_res == JNI_EDETACHED) {
18353                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18354         }
18355         return ret_conv;
18356 }
18357 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
18358         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
18359         JNIEnv *env;
18360         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18361         if (get_jenv_res == JNI_EDETACHED) {
18362                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18363         } else {
18364                 DO_ASSERT(get_jenv_res == JNI_OK);
18365         }
18366         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18367         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18368         LDKQueryChannelRange msg_var = msg;
18369         int64_t msg_ref = 0;
18370         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18371         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18372         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18373         CHECK(obj != NULL);
18374         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
18375         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18376                 (*env)->ExceptionDescribe(env);
18377                 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
18378         }
18379         void* ret_ptr = untag_ptr(ret);
18380         CHECK_ACCESS(ret_ptr);
18381         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
18382         FREE(untag_ptr(ret));
18383         if (get_jenv_res == JNI_EDETACHED) {
18384                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18385         }
18386         return ret_conv;
18387 }
18388 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
18389         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
18390         JNIEnv *env;
18391         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18392         if (get_jenv_res == JNI_EDETACHED) {
18393                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18394         } else {
18395                 DO_ASSERT(get_jenv_res == JNI_OK);
18396         }
18397         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18398         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18399         LDKQueryShortChannelIds msg_var = msg;
18400         int64_t msg_ref = 0;
18401         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18402         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18403         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18404         CHECK(obj != NULL);
18405         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
18406         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18407                 (*env)->ExceptionDescribe(env);
18408                 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
18409         }
18410         void* ret_ptr = untag_ptr(ret);
18411         CHECK_ACCESS(ret_ptr);
18412         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
18413         FREE(untag_ptr(ret));
18414         if (get_jenv_res == JNI_EDETACHED) {
18415                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18416         }
18417         return ret_conv;
18418 }
18419 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
18420         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
18421         JNIEnv *env;
18422         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18423         if (get_jenv_res == JNI_EDETACHED) {
18424                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18425         } else {
18426                 DO_ASSERT(get_jenv_res == JNI_OK);
18427         }
18428         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18429         CHECK(obj != NULL);
18430         jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->processing_queue_high_meth);
18431         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18432                 (*env)->ExceptionDescribe(env);
18433                 (*env)->FatalError(env, "A call to processing_queue_high in LDKRoutingMessageHandler from rust threw an exception.");
18434         }
18435         if (get_jenv_res == JNI_EDETACHED) {
18436                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18437         }
18438         return ret;
18439 }
18440 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
18441         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
18442         JNIEnv *env;
18443         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18444         if (get_jenv_res == JNI_EDETACHED) {
18445                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18446         } else {
18447                 DO_ASSERT(get_jenv_res == JNI_OK);
18448         }
18449         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18450         CHECK(obj != NULL);
18451         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
18452         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18453                 (*env)->ExceptionDescribe(env);
18454                 (*env)->FatalError(env, "A call to provided_node_features in LDKRoutingMessageHandler from rust threw an exception.");
18455         }
18456         LDKNodeFeatures ret_conv;
18457         ret_conv.inner = untag_ptr(ret);
18458         ret_conv.is_owned = ptr_is_owned(ret);
18459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
18460         if (get_jenv_res == JNI_EDETACHED) {
18461                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18462         }
18463         return ret_conv;
18464 }
18465 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
18466         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
18467         JNIEnv *env;
18468         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18469         if (get_jenv_res == JNI_EDETACHED) {
18470                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18471         } else {
18472                 DO_ASSERT(get_jenv_res == JNI_OK);
18473         }
18474         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18475         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18476         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18477         CHECK(obj != NULL);
18478         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
18479         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18480                 (*env)->ExceptionDescribe(env);
18481                 (*env)->FatalError(env, "A call to provided_init_features in LDKRoutingMessageHandler from rust threw an exception.");
18482         }
18483         LDKInitFeatures ret_conv;
18484         ret_conv.inner = untag_ptr(ret);
18485         ret_conv.is_owned = ptr_is_owned(ret);
18486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
18487         if (get_jenv_res == JNI_EDETACHED) {
18488                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18489         }
18490         return ret_conv;
18491 }
18492 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
18493         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
18494         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18495         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
18496 }
18497 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
18498         jclass c = (*env)->GetObjectClass(env, o);
18499         CHECK(c != NULL);
18500         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
18501         atomic_init(&calls->refcnt, 1);
18502         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18503         calls->o = (*env)->NewWeakGlobalRef(env, o);
18504         calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
18505         CHECK(calls->handle_node_announcement_meth != NULL);
18506         calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
18507         CHECK(calls->handle_channel_announcement_meth != NULL);
18508         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
18509         CHECK(calls->handle_channel_update_meth != NULL);
18510         calls->get_next_channel_announcement_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcement", "(J)J");
18511         CHECK(calls->get_next_channel_announcement_meth != NULL);
18512         calls->get_next_node_announcement_meth = (*env)->GetMethodID(env, c, "get_next_node_announcement", "(J)J");
18513         CHECK(calls->get_next_node_announcement_meth != NULL);
18514         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
18515         CHECK(calls->peer_connected_meth != NULL);
18516         calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
18517         CHECK(calls->handle_reply_channel_range_meth != NULL);
18518         calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
18519         CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
18520         calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
18521         CHECK(calls->handle_query_channel_range_meth != NULL);
18522         calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
18523         CHECK(calls->handle_query_short_channel_ids_meth != NULL);
18524         calls->processing_queue_high_meth = (*env)->GetMethodID(env, c, "processing_queue_high", "()Z");
18525         CHECK(calls->processing_queue_high_meth != NULL);
18526         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
18527         CHECK(calls->provided_node_features_meth != NULL);
18528         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
18529         CHECK(calls->provided_init_features_meth != NULL);
18530
18531         LDKRoutingMessageHandler ret = {
18532                 .this_arg = (void*) calls,
18533                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
18534                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
18535                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
18536                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
18537                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
18538                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
18539                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
18540                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
18541                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
18542                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
18543                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
18544                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
18545                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
18546                 .free = LDKRoutingMessageHandler_JCalls_free,
18547                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
18548         };
18549         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
18550         return ret;
18551 }
18552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
18553         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
18554         *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
18555         return tag_ptr(res_ptr, true);
18556 }
18557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
18558         LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)untag_ptr(arg);
18559         return tag_ptr(&inp->MessageSendEventsProvider, false);
18560 }
18561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
18562         void* this_arg_ptr = untag_ptr(this_arg);
18563         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18564         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18565         LDKNodeAnnouncement msg_conv;
18566         msg_conv.inner = untag_ptr(msg);
18567         msg_conv.is_owned = ptr_is_owned(msg);
18568         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18569         msg_conv.is_owned = false;
18570         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
18571         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
18572         return tag_ptr(ret_conv, true);
18573 }
18574
18575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
18576         void* this_arg_ptr = untag_ptr(this_arg);
18577         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18578         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18579         LDKChannelAnnouncement msg_conv;
18580         msg_conv.inner = untag_ptr(msg);
18581         msg_conv.is_owned = ptr_is_owned(msg);
18582         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18583         msg_conv.is_owned = false;
18584         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
18585         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
18586         return tag_ptr(ret_conv, true);
18587 }
18588
18589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
18590         void* this_arg_ptr = untag_ptr(this_arg);
18591         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18592         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18593         LDKChannelUpdate msg_conv;
18594         msg_conv.inner = untag_ptr(msg);
18595         msg_conv.is_owned = ptr_is_owned(msg);
18596         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18597         msg_conv.is_owned = false;
18598         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
18599         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
18600         return tag_ptr(ret_conv, true);
18601 }
18602
18603 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) {
18604         void* this_arg_ptr = untag_ptr(this_arg);
18605         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18606         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18607         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
18608         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
18609         int64_t ret_ref = tag_ptr(ret_copy, true);
18610         return ret_ref;
18611 }
18612
18613 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) {
18614         void* this_arg_ptr = untag_ptr(this_arg);
18615         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18616         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18617         LDKNodeId starting_point_conv;
18618         starting_point_conv.inner = untag_ptr(starting_point);
18619         starting_point_conv.is_owned = ptr_is_owned(starting_point);
18620         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
18621         starting_point_conv = NodeId_clone(&starting_point_conv);
18622         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
18623         int64_t ret_ref = 0;
18624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
18626         return ret_ref;
18627 }
18628
18629 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) {
18630         void* this_arg_ptr = untag_ptr(this_arg);
18631         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18632         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)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         LDKInit init_conv;
18637         init_conv.inner = untag_ptr(init);
18638         init_conv.is_owned = ptr_is_owned(init);
18639         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
18640         init_conv.is_owned = false;
18641         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
18642         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
18643         return tag_ptr(ret_conv, true);
18644 }
18645
18646 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) {
18647         void* this_arg_ptr = untag_ptr(this_arg);
18648         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18649         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18650         LDKPublicKey their_node_id_ref;
18651         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18652         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18653         LDKReplyChannelRange msg_conv;
18654         msg_conv.inner = untag_ptr(msg);
18655         msg_conv.is_owned = ptr_is_owned(msg);
18656         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18657         msg_conv = ReplyChannelRange_clone(&msg_conv);
18658         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18659         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
18660         return tag_ptr(ret_conv, true);
18661 }
18662
18663 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) {
18664         void* this_arg_ptr = untag_ptr(this_arg);
18665         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18666         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18667         LDKPublicKey their_node_id_ref;
18668         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18669         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18670         LDKReplyShortChannelIdsEnd msg_conv;
18671         msg_conv.inner = untag_ptr(msg);
18672         msg_conv.is_owned = ptr_is_owned(msg);
18673         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18674         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
18675         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18676         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
18677         return tag_ptr(ret_conv, true);
18678 }
18679
18680 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) {
18681         void* this_arg_ptr = untag_ptr(this_arg);
18682         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18683         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18684         LDKPublicKey their_node_id_ref;
18685         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18686         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18687         LDKQueryChannelRange msg_conv;
18688         msg_conv.inner = untag_ptr(msg);
18689         msg_conv.is_owned = ptr_is_owned(msg);
18690         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18691         msg_conv = QueryChannelRange_clone(&msg_conv);
18692         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18693         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
18694         return tag_ptr(ret_conv, true);
18695 }
18696
18697 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) {
18698         void* this_arg_ptr = untag_ptr(this_arg);
18699         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18700         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18701         LDKPublicKey their_node_id_ref;
18702         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18703         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18704         LDKQueryShortChannelIds msg_conv;
18705         msg_conv.inner = untag_ptr(msg);
18706         msg_conv.is_owned = ptr_is_owned(msg);
18707         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18708         msg_conv = QueryShortChannelIds_clone(&msg_conv);
18709         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18710         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
18711         return tag_ptr(ret_conv, true);
18712 }
18713
18714 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1processing_1queue_1high(JNIEnv *env, jclass clz, int64_t this_arg) {
18715         void* this_arg_ptr = untag_ptr(this_arg);
18716         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18717         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18718         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
18719         return ret_conv;
18720 }
18721
18722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
18723         void* this_arg_ptr = untag_ptr(this_arg);
18724         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18725         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18726         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
18727         int64_t ret_ref = 0;
18728         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18729         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
18730         return ret_ref;
18731 }
18732
18733 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) {
18734         void* this_arg_ptr = untag_ptr(this_arg);
18735         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18736         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18737         LDKPublicKey their_node_id_ref;
18738         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18739         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18740         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
18741         int64_t ret_ref = 0;
18742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
18744         return ret_ref;
18745 }
18746
18747 typedef struct LDKOnionMessageHandler_JCalls {
18748         atomic_size_t refcnt;
18749         JavaVM *vm;
18750         jweak o;
18751         jmethodID handle_onion_message_meth;
18752         jmethodID next_onion_message_for_peer_meth;
18753         jmethodID peer_connected_meth;
18754         jmethodID peer_disconnected_meth;
18755         jmethodID provided_node_features_meth;
18756         jmethodID provided_init_features_meth;
18757 } LDKOnionMessageHandler_JCalls;
18758 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
18759         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
18760         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18761                 JNIEnv *env;
18762                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18763                 if (get_jenv_res == JNI_EDETACHED) {
18764                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18765                 } else {
18766                         DO_ASSERT(get_jenv_res == JNI_OK);
18767                 }
18768                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18769                 if (get_jenv_res == JNI_EDETACHED) {
18770                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18771                 }
18772                 FREE(j_calls);
18773         }
18774 }
18775 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
18776         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
18777         JNIEnv *env;
18778         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18779         if (get_jenv_res == JNI_EDETACHED) {
18780                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18781         } else {
18782                 DO_ASSERT(get_jenv_res == JNI_OK);
18783         }
18784         int8_tArray peer_node_id_arr = (*env)->NewByteArray(env, 33);
18785         (*env)->SetByteArrayRegion(env, peer_node_id_arr, 0, 33, peer_node_id.compressed_form);
18786         LDKOnionMessage msg_var = *msg;
18787         int64_t msg_ref = 0;
18788         msg_var = OnionMessage_clone(&msg_var);
18789         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18790         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18791         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18792         CHECK(obj != NULL);
18793         (*env)->CallVoidMethod(env, obj, j_calls->handle_onion_message_meth, peer_node_id_arr, msg_ref);
18794         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18795                 (*env)->ExceptionDescribe(env);
18796                 (*env)->FatalError(env, "A call to handle_onion_message in LDKOnionMessageHandler from rust threw an exception.");
18797         }
18798         if (get_jenv_res == JNI_EDETACHED) {
18799                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18800         }
18801 }
18802 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
18803         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
18804         JNIEnv *env;
18805         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18806         if (get_jenv_res == JNI_EDETACHED) {
18807                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18808         } else {
18809                 DO_ASSERT(get_jenv_res == JNI_OK);
18810         }
18811         int8_tArray peer_node_id_arr = (*env)->NewByteArray(env, 33);
18812         (*env)->SetByteArrayRegion(env, peer_node_id_arr, 0, 33, peer_node_id.compressed_form);
18813         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18814         CHECK(obj != NULL);
18815         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->next_onion_message_for_peer_meth, peer_node_id_arr);
18816         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18817                 (*env)->ExceptionDescribe(env);
18818                 (*env)->FatalError(env, "A call to next_onion_message_for_peer in LDKOnionMessageHandler from rust threw an exception.");
18819         }
18820         LDKOnionMessage ret_conv;
18821         ret_conv.inner = untag_ptr(ret);
18822         ret_conv.is_owned = ptr_is_owned(ret);
18823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
18824         if (get_jenv_res == JNI_EDETACHED) {
18825                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18826         }
18827         return ret_conv;
18828 }
18829 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
18830         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
18831         JNIEnv *env;
18832         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18833         if (get_jenv_res == JNI_EDETACHED) {
18834                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18835         } else {
18836                 DO_ASSERT(get_jenv_res == JNI_OK);
18837         }
18838         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18839         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18840         LDKInit init_var = *init;
18841         int64_t init_ref = 0;
18842         init_var = Init_clone(&init_var);
18843         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
18844         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
18845         jboolean inbound_conv = inbound;
18846         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18847         CHECK(obj != NULL);
18848         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref, inbound_conv);
18849         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18850                 (*env)->ExceptionDescribe(env);
18851                 (*env)->FatalError(env, "A call to peer_connected in LDKOnionMessageHandler from rust threw an exception.");
18852         }
18853         void* ret_ptr = untag_ptr(ret);
18854         CHECK_ACCESS(ret_ptr);
18855         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
18856         FREE(untag_ptr(ret));
18857         if (get_jenv_res == JNI_EDETACHED) {
18858                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18859         }
18860         return ret_conv;
18861 }
18862 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
18863         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
18864         JNIEnv *env;
18865         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18866         if (get_jenv_res == JNI_EDETACHED) {
18867                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18868         } else {
18869                 DO_ASSERT(get_jenv_res == JNI_OK);
18870         }
18871         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18872         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18873         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18874         CHECK(obj != NULL);
18875         (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr);
18876         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18877                 (*env)->ExceptionDescribe(env);
18878                 (*env)->FatalError(env, "A call to peer_disconnected in LDKOnionMessageHandler from rust threw an exception.");
18879         }
18880         if (get_jenv_res == JNI_EDETACHED) {
18881                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18882         }
18883 }
18884 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
18885         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
18886         JNIEnv *env;
18887         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18888         if (get_jenv_res == JNI_EDETACHED) {
18889                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18890         } else {
18891                 DO_ASSERT(get_jenv_res == JNI_OK);
18892         }
18893         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18894         CHECK(obj != NULL);
18895         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
18896         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18897                 (*env)->ExceptionDescribe(env);
18898                 (*env)->FatalError(env, "A call to provided_node_features in LDKOnionMessageHandler from rust threw an exception.");
18899         }
18900         LDKNodeFeatures ret_conv;
18901         ret_conv.inner = untag_ptr(ret);
18902         ret_conv.is_owned = ptr_is_owned(ret);
18903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
18904         if (get_jenv_res == JNI_EDETACHED) {
18905                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18906         }
18907         return ret_conv;
18908 }
18909 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
18910         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
18911         JNIEnv *env;
18912         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18913         if (get_jenv_res == JNI_EDETACHED) {
18914                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18915         } else {
18916                 DO_ASSERT(get_jenv_res == JNI_OK);
18917         }
18918         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18919         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18920         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18921         CHECK(obj != NULL);
18922         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
18923         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18924                 (*env)->ExceptionDescribe(env);
18925                 (*env)->FatalError(env, "A call to provided_init_features in LDKOnionMessageHandler from rust threw an exception.");
18926         }
18927         LDKInitFeatures ret_conv;
18928         ret_conv.inner = untag_ptr(ret);
18929         ret_conv.is_owned = ptr_is_owned(ret);
18930         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
18931         if (get_jenv_res == JNI_EDETACHED) {
18932                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18933         }
18934         return ret_conv;
18935 }
18936 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
18937         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
18938         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18939 }
18940 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JNIEnv *env, jclass clz, jobject o) {
18941         jclass c = (*env)->GetObjectClass(env, o);
18942         CHECK(c != NULL);
18943         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
18944         atomic_init(&calls->refcnt, 1);
18945         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18946         calls->o = (*env)->NewWeakGlobalRef(env, o);
18947         calls->handle_onion_message_meth = (*env)->GetMethodID(env, c, "handle_onion_message", "([BJ)V");
18948         CHECK(calls->handle_onion_message_meth != NULL);
18949         calls->next_onion_message_for_peer_meth = (*env)->GetMethodID(env, c, "next_onion_message_for_peer", "([B)J");
18950         CHECK(calls->next_onion_message_for_peer_meth != NULL);
18951         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
18952         CHECK(calls->peer_connected_meth != NULL);
18953         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([B)V");
18954         CHECK(calls->peer_disconnected_meth != NULL);
18955         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
18956         CHECK(calls->provided_node_features_meth != NULL);
18957         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
18958         CHECK(calls->provided_init_features_meth != NULL);
18959
18960         LDKOnionMessageHandler ret = {
18961                 .this_arg = (void*) calls,
18962                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
18963                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageHandler_jcall,
18964                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
18965                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
18966                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
18967                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
18968                 .free = LDKOnionMessageHandler_JCalls_free,
18969         };
18970         return ret;
18971 }
18972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) {
18973         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
18974         *res_ptr = LDKOnionMessageHandler_init(env, clz, o);
18975         return tag_ptr(res_ptr, true);
18976 }
18977 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) {
18978         void* this_arg_ptr = untag_ptr(this_arg);
18979         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18980         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
18981         LDKPublicKey peer_node_id_ref;
18982         CHECK((*env)->GetArrayLength(env, peer_node_id) == 33);
18983         (*env)->GetByteArrayRegion(env, peer_node_id, 0, 33, peer_node_id_ref.compressed_form);
18984         LDKOnionMessage msg_conv;
18985         msg_conv.inner = untag_ptr(msg);
18986         msg_conv.is_owned = ptr_is_owned(msg);
18987         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18988         msg_conv.is_owned = false;
18989         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
18990 }
18991
18992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1next_1onion_1message_1for_1peer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray peer_node_id) {
18993         void* this_arg_ptr = untag_ptr(this_arg);
18994         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18995         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
18996         LDKPublicKey peer_node_id_ref;
18997         CHECK((*env)->GetArrayLength(env, peer_node_id) == 33);
18998         (*env)->GetByteArrayRegion(env, peer_node_id, 0, 33, peer_node_id_ref.compressed_form);
18999         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
19000         int64_t ret_ref = 0;
19001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
19003         return ret_ref;
19004 }
19005
19006 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) {
19007         void* this_arg_ptr = untag_ptr(this_arg);
19008         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19009         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
19010         LDKPublicKey their_node_id_ref;
19011         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19012         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19013         LDKInit init_conv;
19014         init_conv.inner = untag_ptr(init);
19015         init_conv.is_owned = ptr_is_owned(init);
19016         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
19017         init_conv.is_owned = false;
19018         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
19019         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
19020         return tag_ptr(ret_conv, true);
19021 }
19022
19023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
19024         void* this_arg_ptr = untag_ptr(this_arg);
19025         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19026         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
19027         LDKPublicKey their_node_id_ref;
19028         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19029         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19030         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
19031 }
19032
19033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
19034         void* this_arg_ptr = untag_ptr(this_arg);
19035         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19036         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
19037         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
19038         int64_t ret_ref = 0;
19039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
19041         return ret_ref;
19042 }
19043
19044 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) {
19045         void* this_arg_ptr = untag_ptr(this_arg);
19046         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19047         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
19048         LDKPublicKey their_node_id_ref;
19049         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19050         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19051         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
19052         int64_t ret_ref = 0;
19053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
19055         return ret_ref;
19056 }
19057
19058 typedef struct LDKCustomMessageReader_JCalls {
19059         atomic_size_t refcnt;
19060         JavaVM *vm;
19061         jweak o;
19062         jmethodID read_meth;
19063 } LDKCustomMessageReader_JCalls;
19064 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
19065         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
19066         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19067                 JNIEnv *env;
19068                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19069                 if (get_jenv_res == JNI_EDETACHED) {
19070                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19071                 } else {
19072                         DO_ASSERT(get_jenv_res == JNI_OK);
19073                 }
19074                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19075                 if (get_jenv_res == JNI_EDETACHED) {
19076                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19077                 }
19078                 FREE(j_calls);
19079         }
19080 }
19081 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
19082         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
19083         JNIEnv *env;
19084         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19085         if (get_jenv_res == JNI_EDETACHED) {
19086                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19087         } else {
19088                 DO_ASSERT(get_jenv_res == JNI_OK);
19089         }
19090         int16_t message_type_conv = message_type;
19091         LDKu8slice buffer_var = buffer;
19092         int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
19093         (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
19094         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19095         CHECK(obj != NULL);
19096         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type_conv, buffer_arr);
19097         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19098                 (*env)->ExceptionDescribe(env);
19099                 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
19100         }
19101         void* ret_ptr = untag_ptr(ret);
19102         CHECK_ACCESS(ret_ptr);
19103         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
19104         FREE(untag_ptr(ret));
19105         if (get_jenv_res == JNI_EDETACHED) {
19106                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19107         }
19108         return ret_conv;
19109 }
19110 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
19111         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
19112         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
19113 }
19114 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
19115         jclass c = (*env)->GetObjectClass(env, o);
19116         CHECK(c != NULL);
19117         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
19118         atomic_init(&calls->refcnt, 1);
19119         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19120         calls->o = (*env)->NewWeakGlobalRef(env, o);
19121         calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
19122         CHECK(calls->read_meth != NULL);
19123
19124         LDKCustomMessageReader ret = {
19125                 .this_arg = (void*) calls,
19126                 .read = read_LDKCustomMessageReader_jcall,
19127                 .free = LDKCustomMessageReader_JCalls_free,
19128         };
19129         return ret;
19130 }
19131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
19132         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
19133         *res_ptr = LDKCustomMessageReader_init(env, clz, o);
19134         return tag_ptr(res_ptr, true);
19135 }
19136 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) {
19137         void* this_arg_ptr = untag_ptr(this_arg);
19138         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19139         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
19140         LDKu8slice buffer_ref;
19141         buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
19142         buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
19143         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
19144         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
19145         (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
19146         return tag_ptr(ret_conv, true);
19147 }
19148
19149 typedef struct LDKCustomMessageHandler_JCalls {
19150         atomic_size_t refcnt;
19151         JavaVM *vm;
19152         jweak o;
19153         LDKCustomMessageReader_JCalls* CustomMessageReader;
19154         jmethodID handle_custom_message_meth;
19155         jmethodID get_and_clear_pending_msg_meth;
19156         jmethodID provided_node_features_meth;
19157         jmethodID provided_init_features_meth;
19158 } LDKCustomMessageHandler_JCalls;
19159 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
19160         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
19161         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19162                 JNIEnv *env;
19163                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19164                 if (get_jenv_res == JNI_EDETACHED) {
19165                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19166                 } else {
19167                         DO_ASSERT(get_jenv_res == JNI_OK);
19168                 }
19169                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19170                 if (get_jenv_res == JNI_EDETACHED) {
19171                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19172                 }
19173                 FREE(j_calls);
19174         }
19175 }
19176 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
19177         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
19178         JNIEnv *env;
19179         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19180         if (get_jenv_res == JNI_EDETACHED) {
19181                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19182         } else {
19183                 DO_ASSERT(get_jenv_res == JNI_OK);
19184         }
19185         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
19186         *msg_ret = msg;
19187         int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
19188         (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
19189         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19190         CHECK(obj != NULL);
19191         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, tag_ptr(msg_ret, true), sender_node_id_arr);
19192         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19193                 (*env)->ExceptionDescribe(env);
19194                 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
19195         }
19196         void* ret_ptr = untag_ptr(ret);
19197         CHECK_ACCESS(ret_ptr);
19198         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
19199         FREE(untag_ptr(ret));
19200         if (get_jenv_res == JNI_EDETACHED) {
19201                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19202         }
19203         return ret_conv;
19204 }
19205 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
19206         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
19207         JNIEnv *env;
19208         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19209         if (get_jenv_res == JNI_EDETACHED) {
19210                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19211         } else {
19212                 DO_ASSERT(get_jenv_res == JNI_OK);
19213         }
19214         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19215         CHECK(obj != NULL);
19216         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
19217         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19218                 (*env)->ExceptionDescribe(env);
19219                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
19220         }
19221         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
19222         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
19223         if (ret_constr.datalen > 0)
19224                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
19225         else
19226                 ret_constr.data = NULL;
19227         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
19228         for (size_t z = 0; z < ret_constr.datalen; z++) {
19229                 int64_t ret_conv_25 = ret_vals[z];
19230                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
19231                 CHECK_ACCESS(ret_conv_25_ptr);
19232                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
19233                 FREE(untag_ptr(ret_conv_25));
19234                 ret_constr.data[z] = ret_conv_25_conv;
19235         }
19236         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
19237         if (get_jenv_res == JNI_EDETACHED) {
19238                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19239         }
19240         return ret_constr;
19241 }
19242 LDKNodeFeatures provided_node_features_LDKCustomMessageHandler_jcall(const void* this_arg) {
19243         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
19244         JNIEnv *env;
19245         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19246         if (get_jenv_res == JNI_EDETACHED) {
19247                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19248         } else {
19249                 DO_ASSERT(get_jenv_res == JNI_OK);
19250         }
19251         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19252         CHECK(obj != NULL);
19253         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
19254         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19255                 (*env)->ExceptionDescribe(env);
19256                 (*env)->FatalError(env, "A call to provided_node_features in LDKCustomMessageHandler from rust threw an exception.");
19257         }
19258         LDKNodeFeatures ret_conv;
19259         ret_conv.inner = untag_ptr(ret);
19260         ret_conv.is_owned = ptr_is_owned(ret);
19261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
19262         if (get_jenv_res == JNI_EDETACHED) {
19263                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19264         }
19265         return ret_conv;
19266 }
19267 LDKInitFeatures provided_init_features_LDKCustomMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
19268         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
19269         JNIEnv *env;
19270         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19271         if (get_jenv_res == JNI_EDETACHED) {
19272                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19273         } else {
19274                 DO_ASSERT(get_jenv_res == JNI_OK);
19275         }
19276         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19277         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19278         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19279         CHECK(obj != NULL);
19280         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
19281         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19282                 (*env)->ExceptionDescribe(env);
19283                 (*env)->FatalError(env, "A call to provided_init_features in LDKCustomMessageHandler from rust threw an exception.");
19284         }
19285         LDKInitFeatures ret_conv;
19286         ret_conv.inner = untag_ptr(ret);
19287         ret_conv.is_owned = ptr_is_owned(ret);
19288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
19289         if (get_jenv_res == JNI_EDETACHED) {
19290                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19291         }
19292         return ret_conv;
19293 }
19294 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
19295         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
19296         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
19297         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
19298 }
19299 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
19300         jclass c = (*env)->GetObjectClass(env, o);
19301         CHECK(c != NULL);
19302         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
19303         atomic_init(&calls->refcnt, 1);
19304         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19305         calls->o = (*env)->NewWeakGlobalRef(env, o);
19306         calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
19307         CHECK(calls->handle_custom_message_meth != NULL);
19308         calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
19309         CHECK(calls->get_and_clear_pending_msg_meth != NULL);
19310         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
19311         CHECK(calls->provided_node_features_meth != NULL);
19312         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
19313         CHECK(calls->provided_init_features_meth != NULL);
19314
19315         LDKCustomMessageHandler ret = {
19316                 .this_arg = (void*) calls,
19317                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
19318                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
19319                 .provided_node_features = provided_node_features_LDKCustomMessageHandler_jcall,
19320                 .provided_init_features = provided_init_features_LDKCustomMessageHandler_jcall,
19321                 .free = LDKCustomMessageHandler_JCalls_free,
19322                 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
19323         };
19324         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
19325         return ret;
19326 }
19327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
19328         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
19329         *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
19330         return tag_ptr(res_ptr, true);
19331 }
19332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
19333         LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)untag_ptr(arg);
19334         return tag_ptr(&inp->CustomMessageReader, false);
19335 }
19336 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) {
19337         void* this_arg_ptr = untag_ptr(this_arg);
19338         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19339         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
19340         void* msg_ptr = untag_ptr(msg);
19341         CHECK_ACCESS(msg_ptr);
19342         LDKType msg_conv = *(LDKType*)(msg_ptr);
19343         if (msg_conv.free == LDKType_JCalls_free) {
19344                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19345                 LDKType_JCalls_cloned(&msg_conv);
19346         }
19347         LDKPublicKey sender_node_id_ref;
19348         CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
19349         (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
19350         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19351         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
19352         return tag_ptr(ret_conv, true);
19353 }
19354
19355 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
19356         void* this_arg_ptr = untag_ptr(this_arg);
19357         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19358         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
19359         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
19360         int64_tArray ret_arr = NULL;
19361         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
19362         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
19363         for (size_t z = 0; z < ret_var.datalen; z++) {
19364                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
19365                 *ret_conv_25_conv = ret_var.data[z];
19366                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
19367         }
19368         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
19369         FREE(ret_var.data);
19370         return ret_arr;
19371 }
19372
19373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
19374         void* this_arg_ptr = untag_ptr(this_arg);
19375         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19376         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
19377         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
19378         int64_t ret_ref = 0;
19379         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19380         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
19381         return ret_ref;
19382 }
19383
19384 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) {
19385         void* this_arg_ptr = untag_ptr(this_arg);
19386         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19387         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
19388         LDKPublicKey their_node_id_ref;
19389         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19390         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19391         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
19392         int64_t ret_ref = 0;
19393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
19395         return ret_ref;
19396 }
19397
19398 typedef struct LDKCustomOnionMessageHandler_JCalls {
19399         atomic_size_t refcnt;
19400         JavaVM *vm;
19401         jweak o;
19402         jmethodID handle_custom_message_meth;
19403         jmethodID read_custom_message_meth;
19404         jmethodID release_pending_custom_messages_meth;
19405 } LDKCustomOnionMessageHandler_JCalls;
19406 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
19407         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
19408         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19409                 JNIEnv *env;
19410                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19411                 if (get_jenv_res == JNI_EDETACHED) {
19412                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19413                 } else {
19414                         DO_ASSERT(get_jenv_res == JNI_OK);
19415                 }
19416                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19417                 if (get_jenv_res == JNI_EDETACHED) {
19418                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19419                 }
19420                 FREE(j_calls);
19421         }
19422 }
19423 LDKCOption_OnionMessageContentsZ handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKOnionMessageContents msg) {
19424         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
19425         JNIEnv *env;
19426         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19427         if (get_jenv_res == JNI_EDETACHED) {
19428                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19429         } else {
19430                 DO_ASSERT(get_jenv_res == JNI_OK);
19431         }
19432         LDKOnionMessageContents* msg_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
19433         *msg_ret = msg;
19434         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19435         CHECK(obj != NULL);
19436         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, tag_ptr(msg_ret, true));
19437         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19438                 (*env)->ExceptionDescribe(env);
19439                 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomOnionMessageHandler from rust threw an exception.");
19440         }
19441         void* ret_ptr = untag_ptr(ret);
19442         CHECK_ACCESS(ret_ptr);
19443         LDKCOption_OnionMessageContentsZ ret_conv = *(LDKCOption_OnionMessageContentsZ*)(ret_ptr);
19444         FREE(untag_ptr(ret));
19445         if (get_jenv_res == JNI_EDETACHED) {
19446                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19447         }
19448         return ret_conv;
19449 }
19450 LDKCResult_COption_OnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
19451         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
19452         JNIEnv *env;
19453         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19454         if (get_jenv_res == JNI_EDETACHED) {
19455                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19456         } else {
19457                 DO_ASSERT(get_jenv_res == JNI_OK);
19458         }
19459         int64_t message_type_conv = message_type;
19460         LDKu8slice buffer_var = buffer;
19461         int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
19462         (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
19463         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19464         CHECK(obj != NULL);
19465         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_custom_message_meth, message_type_conv, buffer_arr);
19466         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19467                 (*env)->ExceptionDescribe(env);
19468                 (*env)->FatalError(env, "A call to read_custom_message in LDKCustomOnionMessageHandler from rust threw an exception.");
19469         }
19470         void* ret_ptr = untag_ptr(ret);
19471         CHECK_ACCESS(ret_ptr);
19472         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(ret_ptr);
19473         FREE(untag_ptr(ret));
19474         if (get_jenv_res == JNI_EDETACHED) {
19475                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19476         }
19477         return ret_conv;
19478 }
19479 LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall(const void* this_arg) {
19480         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
19481         JNIEnv *env;
19482         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19483         if (get_jenv_res == JNI_EDETACHED) {
19484                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19485         } else {
19486                 DO_ASSERT(get_jenv_res == JNI_OK);
19487         }
19488         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19489         CHECK(obj != NULL);
19490         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_custom_messages_meth);
19491         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19492                 (*env)->ExceptionDescribe(env);
19493                 (*env)->FatalError(env, "A call to release_pending_custom_messages in LDKCustomOnionMessageHandler from rust threw an exception.");
19494         }
19495         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_constr;
19496         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
19497         if (ret_constr.datalen > 0)
19498                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
19499         else
19500                 ret_constr.data = NULL;
19501         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
19502         for (size_t e = 0; e < ret_constr.datalen; e++) {
19503                 int64_t ret_conv_56 = ret_vals[e];
19504                 void* ret_conv_56_ptr = untag_ptr(ret_conv_56);
19505                 CHECK_ACCESS(ret_conv_56_ptr);
19506                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ ret_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(ret_conv_56_ptr);
19507                 FREE(untag_ptr(ret_conv_56));
19508                 ret_constr.data[e] = ret_conv_56_conv;
19509         }
19510         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
19511         if (get_jenv_res == JNI_EDETACHED) {
19512                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19513         }
19514         return ret_constr;
19515 }
19516 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
19517         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
19518         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
19519 }
19520 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JNIEnv *env, jclass clz, jobject o) {
19521         jclass c = (*env)->GetObjectClass(env, o);
19522         CHECK(c != NULL);
19523         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
19524         atomic_init(&calls->refcnt, 1);
19525         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19526         calls->o = (*env)->NewWeakGlobalRef(env, o);
19527         calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J)J");
19528         CHECK(calls->handle_custom_message_meth != NULL);
19529         calls->read_custom_message_meth = (*env)->GetMethodID(env, c, "read_custom_message", "(J[B)J");
19530         CHECK(calls->read_custom_message_meth != NULL);
19531         calls->release_pending_custom_messages_meth = (*env)->GetMethodID(env, c, "release_pending_custom_messages", "()[J");
19532         CHECK(calls->release_pending_custom_messages_meth != NULL);
19533
19534         LDKCustomOnionMessageHandler ret = {
19535                 .this_arg = (void*) calls,
19536                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
19537                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
19538                 .release_pending_custom_messages = release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall,
19539                 .free = LDKCustomOnionMessageHandler_JCalls_free,
19540         };
19541         return ret;
19542 }
19543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomOnionMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) {
19544         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
19545         *res_ptr = LDKCustomOnionMessageHandler_init(env, clz, o);
19546         return tag_ptr(res_ptr, true);
19547 }
19548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1handle_1custom_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
19549         void* this_arg_ptr = untag_ptr(this_arg);
19550         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19551         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
19552         void* msg_ptr = untag_ptr(msg);
19553         CHECK_ACCESS(msg_ptr);
19554         LDKOnionMessageContents msg_conv = *(LDKOnionMessageContents*)(msg_ptr);
19555         if (msg_conv.free == LDKOnionMessageContents_JCalls_free) {
19556                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19557                 LDKOnionMessageContents_JCalls_cloned(&msg_conv);
19558         }
19559         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
19560         *ret_copy = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
19561         int64_t ret_ref = tag_ptr(ret_copy, true);
19562         return ret_ref;
19563 }
19564
19565 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) {
19566         void* this_arg_ptr = untag_ptr(this_arg);
19567         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19568         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
19569         LDKu8slice buffer_ref;
19570         buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
19571         buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
19572         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
19573         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
19574         (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
19575         return tag_ptr(ret_conv, true);
19576 }
19577
19578 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1release_1pending_1custom_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
19579         void* this_arg_ptr = untag_ptr(this_arg);
19580         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19581         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
19582         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_custom_messages)(this_arg_conv->this_arg);
19583         int64_tArray ret_arr = NULL;
19584         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
19585         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
19586         for (size_t e = 0; e < ret_var.datalen; e++) {
19587                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv_56_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
19588                 *ret_conv_56_conv = ret_var.data[e];
19589                 ret_arr_ptr[e] = tag_ptr(ret_conv_56_conv, true);
19590         }
19591         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
19592         FREE(ret_var.data);
19593         return ret_arr;
19594 }
19595
19596 typedef struct LDKSocketDescriptor_JCalls {
19597         atomic_size_t refcnt;
19598         JavaVM *vm;
19599         jweak o;
19600         jmethodID send_data_meth;
19601         jmethodID disconnect_socket_meth;
19602         jmethodID eq_meth;
19603         jmethodID hash_meth;
19604 } LDKSocketDescriptor_JCalls;
19605 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
19606         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
19607         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19608                 JNIEnv *env;
19609                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19610                 if (get_jenv_res == JNI_EDETACHED) {
19611                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19612                 } else {
19613                         DO_ASSERT(get_jenv_res == JNI_OK);
19614                 }
19615                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19616                 if (get_jenv_res == JNI_EDETACHED) {
19617                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19618                 }
19619                 FREE(j_calls);
19620         }
19621 }
19622 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
19623         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
19624         JNIEnv *env;
19625         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19626         if (get_jenv_res == JNI_EDETACHED) {
19627                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19628         } else {
19629                 DO_ASSERT(get_jenv_res == JNI_OK);
19630         }
19631         LDKu8slice data_var = data;
19632         int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
19633         (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
19634         jboolean resume_read_conv = resume_read;
19635         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19636         CHECK(obj != NULL);
19637         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read_conv);
19638         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19639                 (*env)->ExceptionDescribe(env);
19640                 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
19641         }
19642         if (get_jenv_res == JNI_EDETACHED) {
19643                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19644         }
19645         return ret;
19646 }
19647 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
19648         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
19649         JNIEnv *env;
19650         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19651         if (get_jenv_res == JNI_EDETACHED) {
19652                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19653         } else {
19654                 DO_ASSERT(get_jenv_res == JNI_OK);
19655         }
19656         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19657         CHECK(obj != NULL);
19658         (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
19659         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19660                 (*env)->ExceptionDescribe(env);
19661                 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
19662         }
19663         if (get_jenv_res == JNI_EDETACHED) {
19664                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19665         }
19666 }
19667 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
19668         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
19669         JNIEnv *env;
19670         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19671         if (get_jenv_res == JNI_EDETACHED) {
19672                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19673         } else {
19674                 DO_ASSERT(get_jenv_res == JNI_OK);
19675         }
19676         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
19677         *other_arg_clone = SocketDescriptor_clone(other_arg);
19678         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19679         CHECK(obj != NULL);
19680         jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, tag_ptr(other_arg_clone, true));
19681         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19682                 (*env)->ExceptionDescribe(env);
19683                 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
19684         }
19685         if (get_jenv_res == JNI_EDETACHED) {
19686                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19687         }
19688         return ret;
19689 }
19690 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
19691         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
19692         JNIEnv *env;
19693         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19694         if (get_jenv_res == JNI_EDETACHED) {
19695                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19696         } else {
19697                 DO_ASSERT(get_jenv_res == JNI_OK);
19698         }
19699         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19700         CHECK(obj != NULL);
19701         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
19702         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19703                 (*env)->ExceptionDescribe(env);
19704                 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
19705         }
19706         if (get_jenv_res == JNI_EDETACHED) {
19707                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19708         }
19709         return ret;
19710 }
19711 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
19712         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
19713         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
19714 }
19715 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
19716         jclass c = (*env)->GetObjectClass(env, o);
19717         CHECK(c != NULL);
19718         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
19719         atomic_init(&calls->refcnt, 1);
19720         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19721         calls->o = (*env)->NewWeakGlobalRef(env, o);
19722         calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
19723         CHECK(calls->send_data_meth != NULL);
19724         calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
19725         CHECK(calls->disconnect_socket_meth != NULL);
19726         calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
19727         CHECK(calls->eq_meth != NULL);
19728         calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
19729         CHECK(calls->hash_meth != NULL);
19730
19731         LDKSocketDescriptor ret = {
19732                 .this_arg = (void*) calls,
19733                 .send_data = send_data_LDKSocketDescriptor_jcall,
19734                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
19735                 .eq = eq_LDKSocketDescriptor_jcall,
19736                 .hash = hash_LDKSocketDescriptor_jcall,
19737                 .cloned = LDKSocketDescriptor_JCalls_cloned,
19738                 .free = LDKSocketDescriptor_JCalls_free,
19739         };
19740         return ret;
19741 }
19742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
19743         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
19744         *res_ptr = LDKSocketDescriptor_init(env, clz, o);
19745         return tag_ptr(res_ptr, true);
19746 }
19747 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) {
19748         void* this_arg_ptr = untag_ptr(this_arg);
19749         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19750         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
19751         LDKu8slice data_ref;
19752         data_ref.datalen = (*env)->GetArrayLength(env, data);
19753         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
19754         int64_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
19755         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
19756         return ret_conv;
19757 }
19758
19759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
19760         void* this_arg_ptr = untag_ptr(this_arg);
19761         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19762         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
19763         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
19764 }
19765
19766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
19767         void* this_arg_ptr = untag_ptr(this_arg);
19768         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19769         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
19770         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
19771         return ret_conv;
19772 }
19773
19774 static jclass LDKEffectiveCapacity_ExactLiquidity_class = NULL;
19775 static jmethodID LDKEffectiveCapacity_ExactLiquidity_meth = NULL;
19776 static jclass LDKEffectiveCapacity_AdvertisedMaxHTLC_class = NULL;
19777 static jmethodID LDKEffectiveCapacity_AdvertisedMaxHTLC_meth = NULL;
19778 static jclass LDKEffectiveCapacity_Total_class = NULL;
19779 static jmethodID LDKEffectiveCapacity_Total_meth = NULL;
19780 static jclass LDKEffectiveCapacity_Infinite_class = NULL;
19781 static jmethodID LDKEffectiveCapacity_Infinite_meth = NULL;
19782 static jclass LDKEffectiveCapacity_HintMaxHTLC_class = NULL;
19783 static jmethodID LDKEffectiveCapacity_HintMaxHTLC_meth = NULL;
19784 static jclass LDKEffectiveCapacity_Unknown_class = NULL;
19785 static jmethodID LDKEffectiveCapacity_Unknown_meth = NULL;
19786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEffectiveCapacity_init (JNIEnv *env, jclass clz) {
19787         LDKEffectiveCapacity_ExactLiquidity_class =
19788                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$ExactLiquidity"));
19789         CHECK(LDKEffectiveCapacity_ExactLiquidity_class != NULL);
19790         LDKEffectiveCapacity_ExactLiquidity_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_ExactLiquidity_class, "<init>", "(J)V");
19791         CHECK(LDKEffectiveCapacity_ExactLiquidity_meth != NULL);
19792         LDKEffectiveCapacity_AdvertisedMaxHTLC_class =
19793                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$AdvertisedMaxHTLC"));
19794         CHECK(LDKEffectiveCapacity_AdvertisedMaxHTLC_class != NULL);
19795         LDKEffectiveCapacity_AdvertisedMaxHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_AdvertisedMaxHTLC_class, "<init>", "(J)V");
19796         CHECK(LDKEffectiveCapacity_AdvertisedMaxHTLC_meth != NULL);
19797         LDKEffectiveCapacity_Total_class =
19798                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Total"));
19799         CHECK(LDKEffectiveCapacity_Total_class != NULL);
19800         LDKEffectiveCapacity_Total_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Total_class, "<init>", "(JJ)V");
19801         CHECK(LDKEffectiveCapacity_Total_meth != NULL);
19802         LDKEffectiveCapacity_Infinite_class =
19803                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Infinite"));
19804         CHECK(LDKEffectiveCapacity_Infinite_class != NULL);
19805         LDKEffectiveCapacity_Infinite_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Infinite_class, "<init>", "()V");
19806         CHECK(LDKEffectiveCapacity_Infinite_meth != NULL);
19807         LDKEffectiveCapacity_HintMaxHTLC_class =
19808                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$HintMaxHTLC"));
19809         CHECK(LDKEffectiveCapacity_HintMaxHTLC_class != NULL);
19810         LDKEffectiveCapacity_HintMaxHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_HintMaxHTLC_class, "<init>", "(J)V");
19811         CHECK(LDKEffectiveCapacity_HintMaxHTLC_meth != NULL);
19812         LDKEffectiveCapacity_Unknown_class =
19813                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Unknown"));
19814         CHECK(LDKEffectiveCapacity_Unknown_class != NULL);
19815         LDKEffectiveCapacity_Unknown_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Unknown_class, "<init>", "()V");
19816         CHECK(LDKEffectiveCapacity_Unknown_meth != NULL);
19817 }
19818 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEffectiveCapacity_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
19819         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
19820         switch(obj->tag) {
19821                 case LDKEffectiveCapacity_ExactLiquidity: {
19822                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
19823                         return (*env)->NewObject(env, LDKEffectiveCapacity_ExactLiquidity_class, LDKEffectiveCapacity_ExactLiquidity_meth, liquidity_msat_conv);
19824                 }
19825                 case LDKEffectiveCapacity_AdvertisedMaxHTLC: {
19826                         int64_t amount_msat_conv = obj->advertised_max_htlc.amount_msat;
19827                         return (*env)->NewObject(env, LDKEffectiveCapacity_AdvertisedMaxHTLC_class, LDKEffectiveCapacity_AdvertisedMaxHTLC_meth, amount_msat_conv);
19828                 }
19829                 case LDKEffectiveCapacity_Total: {
19830                         int64_t capacity_msat_conv = obj->total.capacity_msat;
19831                         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
19832                         return (*env)->NewObject(env, LDKEffectiveCapacity_Total_class, LDKEffectiveCapacity_Total_meth, capacity_msat_conv, htlc_maximum_msat_conv);
19833                 }
19834                 case LDKEffectiveCapacity_Infinite: {
19835                         return (*env)->NewObject(env, LDKEffectiveCapacity_Infinite_class, LDKEffectiveCapacity_Infinite_meth);
19836                 }
19837                 case LDKEffectiveCapacity_HintMaxHTLC: {
19838                         int64_t amount_msat_conv = obj->hint_max_htlc.amount_msat;
19839                         return (*env)->NewObject(env, LDKEffectiveCapacity_HintMaxHTLC_class, LDKEffectiveCapacity_HintMaxHTLC_meth, amount_msat_conv);
19840                 }
19841                 case LDKEffectiveCapacity_Unknown: {
19842                         return (*env)->NewObject(env, LDKEffectiveCapacity_Unknown_class, LDKEffectiveCapacity_Unknown_meth);
19843                 }
19844                 default: abort();
19845         }
19846 }
19847 static jclass LDKPayee_Blinded_class = NULL;
19848 static jmethodID LDKPayee_Blinded_meth = NULL;
19849 static jclass LDKPayee_Clear_class = NULL;
19850 static jmethodID LDKPayee_Clear_meth = NULL;
19851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPayee_init (JNIEnv *env, jclass clz) {
19852         LDKPayee_Blinded_class =
19853                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPayee$Blinded"));
19854         CHECK(LDKPayee_Blinded_class != NULL);
19855         LDKPayee_Blinded_meth = (*env)->GetMethodID(env, LDKPayee_Blinded_class, "<init>", "([JJ)V");
19856         CHECK(LDKPayee_Blinded_meth != NULL);
19857         LDKPayee_Clear_class =
19858                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPayee$Clear"));
19859         CHECK(LDKPayee_Clear_class != NULL);
19860         LDKPayee_Clear_meth = (*env)->GetMethodID(env, LDKPayee_Clear_class, "<init>", "([B[JJI)V");
19861         CHECK(LDKPayee_Clear_meth != NULL);
19862 }
19863 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPayee_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
19864         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
19865         switch(obj->tag) {
19866                 case LDKPayee_Blinded: {
19867                         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_var = obj->blinded.route_hints;
19868                         int64_tArray route_hints_arr = NULL;
19869                         route_hints_arr = (*env)->NewLongArray(env, route_hints_var.datalen);
19870                         int64_t *route_hints_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, route_hints_arr, NULL);
19871                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
19872                                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* route_hints_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
19873                                 *route_hints_conv_37_conv = route_hints_var.data[l];
19874                                 *route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(route_hints_conv_37_conv);
19875                                 route_hints_arr_ptr[l] = tag_ptr(route_hints_conv_37_conv, true);
19876                         }
19877                         (*env)->ReleasePrimitiveArrayCritical(env, route_hints_arr, route_hints_arr_ptr, 0);
19878                         LDKBolt12InvoiceFeatures features_var = obj->blinded.features;
19879                         int64_t features_ref = 0;
19880                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
19881                         features_ref = tag_ptr(features_var.inner, false);
19882                         return (*env)->NewObject(env, LDKPayee_Blinded_class, LDKPayee_Blinded_meth, route_hints_arr, features_ref);
19883                 }
19884                 case LDKPayee_Clear: {
19885                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
19886                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->clear.node_id.compressed_form);
19887                         LDKCVec_RouteHintZ route_hints_var = obj->clear.route_hints;
19888                         int64_tArray route_hints_arr = NULL;
19889                         route_hints_arr = (*env)->NewLongArray(env, route_hints_var.datalen);
19890                         int64_t *route_hints_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, route_hints_arr, NULL);
19891                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
19892                                 LDKRouteHint route_hints_conv_11_var = route_hints_var.data[l];
19893                                 int64_t route_hints_conv_11_ref = 0;
19894                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_var);
19895                                 route_hints_conv_11_ref = tag_ptr(route_hints_conv_11_var.inner, false);
19896                                 route_hints_arr_ptr[l] = route_hints_conv_11_ref;
19897                         }
19898                         (*env)->ReleasePrimitiveArrayCritical(env, route_hints_arr, route_hints_arr_ptr, 0);
19899                         LDKBolt11InvoiceFeatures features_var = obj->clear.features;
19900                         int64_t features_ref = 0;
19901                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
19902                         features_ref = tag_ptr(features_var.inner, false);
19903                         int32_t final_cltv_expiry_delta_conv = obj->clear.final_cltv_expiry_delta;
19904                         return (*env)->NewObject(env, LDKPayee_Clear_class, LDKPayee_Clear_meth, node_id_arr, route_hints_arr, features_ref, final_cltv_expiry_delta_conv);
19905                 }
19906                 default: abort();
19907         }
19908 }
19909 typedef struct LDKScore_JCalls {
19910         atomic_size_t refcnt;
19911         JavaVM *vm;
19912         jweak o;
19913         LDKScoreLookUp_JCalls* ScoreLookUp;
19914         LDKScoreUpdate_JCalls* ScoreUpdate;
19915         jmethodID write_meth;
19916 } LDKScore_JCalls;
19917 static void LDKScore_JCalls_free(void* this_arg) {
19918         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
19919         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19920                 JNIEnv *env;
19921                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19922                 if (get_jenv_res == JNI_EDETACHED) {
19923                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19924                 } else {
19925                         DO_ASSERT(get_jenv_res == JNI_OK);
19926                 }
19927                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19928                 if (get_jenv_res == JNI_EDETACHED) {
19929                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19930                 }
19931                 FREE(j_calls);
19932         }
19933 }
19934 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
19935         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
19936         JNIEnv *env;
19937         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19938         if (get_jenv_res == JNI_EDETACHED) {
19939                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19940         } else {
19941                 DO_ASSERT(get_jenv_res == JNI_OK);
19942         }
19943         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19944         CHECK(obj != NULL);
19945         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
19946         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19947                 (*env)->ExceptionDescribe(env);
19948                 (*env)->FatalError(env, "A call to write in LDKScore from rust threw an exception.");
19949         }
19950         LDKCVec_u8Z ret_ref;
19951         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
19952         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
19953         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
19954         if (get_jenv_res == JNI_EDETACHED) {
19955                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19956         }
19957         return ret_ref;
19958 }
19959 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
19960         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
19961         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
19962         atomic_fetch_add_explicit(&j_calls->ScoreLookUp->refcnt, 1, memory_order_release);
19963         atomic_fetch_add_explicit(&j_calls->ScoreUpdate->refcnt, 1, memory_order_release);
19964 }
19965 static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o, jobject ScoreLookUp, jobject ScoreUpdate) {
19966         jclass c = (*env)->GetObjectClass(env, o);
19967         CHECK(c != NULL);
19968         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
19969         atomic_init(&calls->refcnt, 1);
19970         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19971         calls->o = (*env)->NewWeakGlobalRef(env, o);
19972         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
19973         CHECK(calls->write_meth != NULL);
19974
19975         LDKScore ret = {
19976                 .this_arg = (void*) calls,
19977                 .write = write_LDKScore_jcall,
19978                 .free = LDKScore_JCalls_free,
19979                 .ScoreLookUp = LDKScoreLookUp_init(env, clz, ScoreLookUp),
19980                 .ScoreUpdate = LDKScoreUpdate_init(env, clz, ScoreUpdate),
19981         };
19982         calls->ScoreLookUp = ret.ScoreLookUp.this_arg;
19983         calls->ScoreUpdate = ret.ScoreUpdate.this_arg;
19984         return ret;
19985 }
19986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o, jobject ScoreLookUp, jobject ScoreUpdate) {
19987         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
19988         *res_ptr = LDKScore_init(env, clz, o, ScoreLookUp, ScoreUpdate);
19989         return tag_ptr(res_ptr, true);
19990 }
19991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1get_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t arg) {
19992         LDKScore *inp = (LDKScore *)untag_ptr(arg);
19993         return tag_ptr(&inp->ScoreLookUp, false);
19994 }
19995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1get_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t arg) {
19996         LDKScore *inp = (LDKScore *)untag_ptr(arg);
19997         return tag_ptr(&inp->ScoreUpdate, false);
19998 }
19999 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
20000         void* this_arg_ptr = untag_ptr(this_arg);
20001         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20002         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
20003         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
20004         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20005         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20006         CVec_u8Z_free(ret_var);
20007         return ret_arr;
20008 }
20009
20010 typedef struct LDKMessageRouter_JCalls {
20011         atomic_size_t refcnt;
20012         JavaVM *vm;
20013         jweak o;
20014         jmethodID find_path_meth;
20015 } LDKMessageRouter_JCalls;
20016 static void LDKMessageRouter_JCalls_free(void* this_arg) {
20017         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
20018         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
20019                 JNIEnv *env;
20020                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20021                 if (get_jenv_res == JNI_EDETACHED) {
20022                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20023                 } else {
20024                         DO_ASSERT(get_jenv_res == JNI_OK);
20025                 }
20026                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
20027                 if (get_jenv_res == JNI_EDETACHED) {
20028                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20029                 }
20030                 FREE(j_calls);
20031         }
20032 }
20033 LDKCResult_OnionMessagePathNoneZ find_path_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey sender, LDKCVec_PublicKeyZ peers, LDKDestination destination) {
20034         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
20035         JNIEnv *env;
20036         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20037         if (get_jenv_res == JNI_EDETACHED) {
20038                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20039         } else {
20040                 DO_ASSERT(get_jenv_res == JNI_OK);
20041         }
20042         int8_tArray sender_arr = (*env)->NewByteArray(env, 33);
20043         (*env)->SetByteArrayRegion(env, sender_arr, 0, 33, sender.compressed_form);
20044         LDKCVec_PublicKeyZ peers_var = peers;
20045         jobjectArray peers_arr = NULL;
20046         peers_arr = (*env)->NewObjectArray(env, peers_var.datalen, arr_of_B_clz, NULL);
20047         ;
20048         for (size_t i = 0; i < peers_var.datalen; i++) {
20049                 int8_tArray peers_conv_8_arr = (*env)->NewByteArray(env, 33);
20050                 (*env)->SetByteArrayRegion(env, peers_conv_8_arr, 0, 33, peers_var.data[i].compressed_form);
20051                 (*env)->SetObjectArrayElement(env, peers_arr, i, peers_conv_8_arr);
20052         }
20053         
20054         FREE(peers_var.data);
20055         LDKDestination *destination_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
20056         *destination_copy = destination;
20057         int64_t destination_ref = tag_ptr(destination_copy, true);
20058         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20059         CHECK(obj != NULL);
20060         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_path_meth, sender_arr, peers_arr, destination_ref);
20061         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20062                 (*env)->ExceptionDescribe(env);
20063                 (*env)->FatalError(env, "A call to find_path in LDKMessageRouter from rust threw an exception.");
20064         }
20065         void* ret_ptr = untag_ptr(ret);
20066         CHECK_ACCESS(ret_ptr);
20067         LDKCResult_OnionMessagePathNoneZ ret_conv = *(LDKCResult_OnionMessagePathNoneZ*)(ret_ptr);
20068         FREE(untag_ptr(ret));
20069         if (get_jenv_res == JNI_EDETACHED) {
20070                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20071         }
20072         return ret_conv;
20073 }
20074 static void LDKMessageRouter_JCalls_cloned(LDKMessageRouter* new_obj) {
20075         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) new_obj->this_arg;
20076         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
20077 }
20078 static inline LDKMessageRouter LDKMessageRouter_init (JNIEnv *env, jclass clz, jobject o) {
20079         jclass c = (*env)->GetObjectClass(env, o);
20080         CHECK(c != NULL);
20081         LDKMessageRouter_JCalls *calls = MALLOC(sizeof(LDKMessageRouter_JCalls), "LDKMessageRouter_JCalls");
20082         atomic_init(&calls->refcnt, 1);
20083         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
20084         calls->o = (*env)->NewWeakGlobalRef(env, o);
20085         calls->find_path_meth = (*env)->GetMethodID(env, c, "find_path", "([B[[BJ)J");
20086         CHECK(calls->find_path_meth != NULL);
20087
20088         LDKMessageRouter ret = {
20089                 .this_arg = (void*) calls,
20090                 .find_path = find_path_LDKMessageRouter_jcall,
20091                 .free = LDKMessageRouter_JCalls_free,
20092         };
20093         return ret;
20094 }
20095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageRouter_1new(JNIEnv *env, jclass clz, jobject o) {
20096         LDKMessageRouter *res_ptr = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
20097         *res_ptr = LDKMessageRouter_init(env, clz, o);
20098         return tag_ptr(res_ptr, true);
20099 }
20100 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) {
20101         void* this_arg_ptr = untag_ptr(this_arg);
20102         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20103         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
20104         LDKPublicKey sender_ref;
20105         CHECK((*env)->GetArrayLength(env, sender) == 33);
20106         (*env)->GetByteArrayRegion(env, sender, 0, 33, sender_ref.compressed_form);
20107         LDKCVec_PublicKeyZ peers_constr;
20108         peers_constr.datalen = (*env)->GetArrayLength(env, peers);
20109         if (peers_constr.datalen > 0)
20110                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
20111         else
20112                 peers_constr.data = NULL;
20113         for (size_t i = 0; i < peers_constr.datalen; i++) {
20114                 int8_tArray peers_conv_8 = (*env)->GetObjectArrayElement(env, peers, i);
20115                 LDKPublicKey peers_conv_8_ref;
20116                 CHECK((*env)->GetArrayLength(env, peers_conv_8) == 33);
20117                 (*env)->GetByteArrayRegion(env, peers_conv_8, 0, 33, peers_conv_8_ref.compressed_form);
20118                 peers_constr.data[i] = peers_conv_8_ref;
20119         }
20120         void* destination_ptr = untag_ptr(destination);
20121         CHECK_ACCESS(destination_ptr);
20122         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
20123         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
20124         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
20125         *ret_conv = (this_arg_conv->find_path)(this_arg_conv->this_arg, sender_ref, peers_constr, destination_conv);
20126         return tag_ptr(ret_conv, true);
20127 }
20128
20129 typedef struct LDKCoinSelectionSource_JCalls {
20130         atomic_size_t refcnt;
20131         JavaVM *vm;
20132         jweak o;
20133         jmethodID select_confirmed_utxos_meth;
20134         jmethodID sign_tx_meth;
20135 } LDKCoinSelectionSource_JCalls;
20136 static void LDKCoinSelectionSource_JCalls_free(void* this_arg) {
20137         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
20138         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
20139                 JNIEnv *env;
20140                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20141                 if (get_jenv_res == JNI_EDETACHED) {
20142                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20143                 } else {
20144                         DO_ASSERT(get_jenv_res == JNI_OK);
20145                 }
20146                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
20147                 if (get_jenv_res == JNI_EDETACHED) {
20148                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20149                 }
20150                 FREE(j_calls);
20151         }
20152 }
20153 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) {
20154         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
20155         JNIEnv *env;
20156         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20157         if (get_jenv_res == JNI_EDETACHED) {
20158                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20159         } else {
20160                 DO_ASSERT(get_jenv_res == JNI_OK);
20161         }
20162         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
20163         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, claim_id.data);
20164         LDKCVec_InputZ must_spend_var = must_spend;
20165         int64_tArray must_spend_arr = NULL;
20166         must_spend_arr = (*env)->NewLongArray(env, must_spend_var.datalen);
20167         int64_t *must_spend_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, must_spend_arr, NULL);
20168         for (size_t h = 0; h < must_spend_var.datalen; h++) {
20169                 LDKInput must_spend_conv_7_var = must_spend_var.data[h];
20170                 int64_t must_spend_conv_7_ref = 0;
20171                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_var);
20172                 must_spend_conv_7_ref = tag_ptr(must_spend_conv_7_var.inner, must_spend_conv_7_var.is_owned);
20173                 must_spend_arr_ptr[h] = must_spend_conv_7_ref;
20174         }
20175         (*env)->ReleasePrimitiveArrayCritical(env, must_spend_arr, must_spend_arr_ptr, 0);
20176         FREE(must_spend_var.data);
20177         LDKCVec_TxOutZ must_pay_to_var = must_pay_to;
20178         int64_tArray must_pay_to_arr = NULL;
20179         must_pay_to_arr = (*env)->NewLongArray(env, must_pay_to_var.datalen);
20180         int64_t *must_pay_to_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, must_pay_to_arr, NULL);
20181         for (size_t h = 0; h < must_pay_to_var.datalen; h++) {
20182                 LDKTxOut* must_pay_to_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
20183                 *must_pay_to_conv_7_ref = must_pay_to_var.data[h];
20184                 must_pay_to_arr_ptr[h] = tag_ptr(must_pay_to_conv_7_ref, true);
20185         }
20186         (*env)->ReleasePrimitiveArrayCritical(env, must_pay_to_arr, must_pay_to_arr_ptr, 0);
20187         FREE(must_pay_to_var.data);
20188         int32_t target_feerate_sat_per_1000_weight_conv = target_feerate_sat_per_1000_weight;
20189         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20190         CHECK(obj != NULL);
20191         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);
20192         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20193                 (*env)->ExceptionDescribe(env);
20194                 (*env)->FatalError(env, "A call to select_confirmed_utxos in LDKCoinSelectionSource from rust threw an exception.");
20195         }
20196         void* ret_ptr = untag_ptr(ret);
20197         CHECK_ACCESS(ret_ptr);
20198         LDKCResult_CoinSelectionNoneZ ret_conv = *(LDKCResult_CoinSelectionNoneZ*)(ret_ptr);
20199         FREE(untag_ptr(ret));
20200         if (get_jenv_res == JNI_EDETACHED) {
20201                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20202         }
20203         return ret_conv;
20204 }
20205 LDKCResult_TransactionNoneZ sign_tx_LDKCoinSelectionSource_jcall(const void* this_arg, LDKTransaction tx) {
20206         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
20207         JNIEnv *env;
20208         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20209         if (get_jenv_res == JNI_EDETACHED) {
20210                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20211         } else {
20212                 DO_ASSERT(get_jenv_res == JNI_OK);
20213         }
20214         LDKTransaction tx_var = tx;
20215         int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
20216         (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
20217         Transaction_free(tx_var);
20218         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20219         CHECK(obj != NULL);
20220         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_tx_meth, tx_arr);
20221         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20222                 (*env)->ExceptionDescribe(env);
20223                 (*env)->FatalError(env, "A call to sign_tx in LDKCoinSelectionSource from rust threw an exception.");
20224         }
20225         void* ret_ptr = untag_ptr(ret);
20226         CHECK_ACCESS(ret_ptr);
20227         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
20228         FREE(untag_ptr(ret));
20229         if (get_jenv_res == JNI_EDETACHED) {
20230                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20231         }
20232         return ret_conv;
20233 }
20234 static void LDKCoinSelectionSource_JCalls_cloned(LDKCoinSelectionSource* new_obj) {
20235         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) new_obj->this_arg;
20236         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
20237 }
20238 static inline LDKCoinSelectionSource LDKCoinSelectionSource_init (JNIEnv *env, jclass clz, jobject o) {
20239         jclass c = (*env)->GetObjectClass(env, o);
20240         CHECK(c != NULL);
20241         LDKCoinSelectionSource_JCalls *calls = MALLOC(sizeof(LDKCoinSelectionSource_JCalls), "LDKCoinSelectionSource_JCalls");
20242         atomic_init(&calls->refcnt, 1);
20243         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
20244         calls->o = (*env)->NewWeakGlobalRef(env, o);
20245         calls->select_confirmed_utxos_meth = (*env)->GetMethodID(env, c, "select_confirmed_utxos", "([B[J[JI)J");
20246         CHECK(calls->select_confirmed_utxos_meth != NULL);
20247         calls->sign_tx_meth = (*env)->GetMethodID(env, c, "sign_tx", "([B)J");
20248         CHECK(calls->sign_tx_meth != NULL);
20249
20250         LDKCoinSelectionSource ret = {
20251                 .this_arg = (void*) calls,
20252                 .select_confirmed_utxos = select_confirmed_utxos_LDKCoinSelectionSource_jcall,
20253                 .sign_tx = sign_tx_LDKCoinSelectionSource_jcall,
20254                 .free = LDKCoinSelectionSource_JCalls_free,
20255         };
20256         return ret;
20257 }
20258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCoinSelectionSource_1new(JNIEnv *env, jclass clz, jobject o) {
20259         LDKCoinSelectionSource *res_ptr = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
20260         *res_ptr = LDKCoinSelectionSource_init(env, clz, o);
20261         return tag_ptr(res_ptr, true);
20262 }
20263 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) {
20264         void* this_arg_ptr = untag_ptr(this_arg);
20265         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20266         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
20267         LDKThirtyTwoBytes claim_id_ref;
20268         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
20269         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
20270         LDKCVec_InputZ must_spend_constr;
20271         must_spend_constr.datalen = (*env)->GetArrayLength(env, must_spend);
20272         if (must_spend_constr.datalen > 0)
20273                 must_spend_constr.data = MALLOC(must_spend_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
20274         else
20275                 must_spend_constr.data = NULL;
20276         int64_t* must_spend_vals = (*env)->GetLongArrayElements (env, must_spend, NULL);
20277         for (size_t h = 0; h < must_spend_constr.datalen; h++) {
20278                 int64_t must_spend_conv_7 = must_spend_vals[h];
20279                 LDKInput must_spend_conv_7_conv;
20280                 must_spend_conv_7_conv.inner = untag_ptr(must_spend_conv_7);
20281                 must_spend_conv_7_conv.is_owned = ptr_is_owned(must_spend_conv_7);
20282                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_conv);
20283                 must_spend_conv_7_conv = Input_clone(&must_spend_conv_7_conv);
20284                 must_spend_constr.data[h] = must_spend_conv_7_conv;
20285         }
20286         (*env)->ReleaseLongArrayElements(env, must_spend, must_spend_vals, 0);
20287         LDKCVec_TxOutZ must_pay_to_constr;
20288         must_pay_to_constr.datalen = (*env)->GetArrayLength(env, must_pay_to);
20289         if (must_pay_to_constr.datalen > 0)
20290                 must_pay_to_constr.data = MALLOC(must_pay_to_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
20291         else
20292                 must_pay_to_constr.data = NULL;
20293         int64_t* must_pay_to_vals = (*env)->GetLongArrayElements (env, must_pay_to, NULL);
20294         for (size_t h = 0; h < must_pay_to_constr.datalen; h++) {
20295                 int64_t must_pay_to_conv_7 = must_pay_to_vals[h];
20296                 void* must_pay_to_conv_7_ptr = untag_ptr(must_pay_to_conv_7);
20297                 CHECK_ACCESS(must_pay_to_conv_7_ptr);
20298                 LDKTxOut must_pay_to_conv_7_conv = *(LDKTxOut*)(must_pay_to_conv_7_ptr);
20299                 must_pay_to_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(must_pay_to_conv_7));
20300                 must_pay_to_constr.data[h] = must_pay_to_conv_7_conv;
20301         }
20302         (*env)->ReleaseLongArrayElements(env, must_pay_to, must_pay_to_vals, 0);
20303         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
20304         *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);
20305         return tag_ptr(ret_conv, true);
20306 }
20307
20308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelectionSource_1sign_1tx(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
20309         void* this_arg_ptr = untag_ptr(this_arg);
20310         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20311         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
20312         LDKTransaction tx_ref;
20313         tx_ref.datalen = (*env)->GetArrayLength(env, tx);
20314         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
20315         (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
20316         tx_ref.data_is_owned = true;
20317         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20318         *ret_conv = (this_arg_conv->sign_tx)(this_arg_conv->this_arg, tx_ref);
20319         return tag_ptr(ret_conv, true);
20320 }
20321
20322 typedef struct LDKWalletSource_JCalls {
20323         atomic_size_t refcnt;
20324         JavaVM *vm;
20325         jweak o;
20326         jmethodID list_confirmed_utxos_meth;
20327         jmethodID get_change_script_meth;
20328         jmethodID sign_tx_meth;
20329 } LDKWalletSource_JCalls;
20330 static void LDKWalletSource_JCalls_free(void* this_arg) {
20331         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
20332         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
20333                 JNIEnv *env;
20334                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20335                 if (get_jenv_res == JNI_EDETACHED) {
20336                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20337                 } else {
20338                         DO_ASSERT(get_jenv_res == JNI_OK);
20339                 }
20340                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
20341                 if (get_jenv_res == JNI_EDETACHED) {
20342                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20343                 }
20344                 FREE(j_calls);
20345         }
20346 }
20347 LDKCResult_CVec_UtxoZNoneZ list_confirmed_utxos_LDKWalletSource_jcall(const void* this_arg) {
20348         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
20349         JNIEnv *env;
20350         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20351         if (get_jenv_res == JNI_EDETACHED) {
20352                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20353         } else {
20354                 DO_ASSERT(get_jenv_res == JNI_OK);
20355         }
20356         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20357         CHECK(obj != NULL);
20358         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->list_confirmed_utxos_meth);
20359         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20360                 (*env)->ExceptionDescribe(env);
20361                 (*env)->FatalError(env, "A call to list_confirmed_utxos in LDKWalletSource from rust threw an exception.");
20362         }
20363         void* ret_ptr = untag_ptr(ret);
20364         CHECK_ACCESS(ret_ptr);
20365         LDKCResult_CVec_UtxoZNoneZ ret_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(ret_ptr);
20366         FREE(untag_ptr(ret));
20367         if (get_jenv_res == JNI_EDETACHED) {
20368                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20369         }
20370         return ret_conv;
20371 }
20372 LDKCResult_CVec_u8ZNoneZ get_change_script_LDKWalletSource_jcall(const void* this_arg) {
20373         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
20374         JNIEnv *env;
20375         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20376         if (get_jenv_res == JNI_EDETACHED) {
20377                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20378         } else {
20379                 DO_ASSERT(get_jenv_res == JNI_OK);
20380         }
20381         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20382         CHECK(obj != NULL);
20383         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_change_script_meth);
20384         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20385                 (*env)->ExceptionDescribe(env);
20386                 (*env)->FatalError(env, "A call to get_change_script in LDKWalletSource from rust threw an exception.");
20387         }
20388         void* ret_ptr = untag_ptr(ret);
20389         CHECK_ACCESS(ret_ptr);
20390         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
20391         FREE(untag_ptr(ret));
20392         if (get_jenv_res == JNI_EDETACHED) {
20393                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20394         }
20395         return ret_conv;
20396 }
20397 LDKCResult_TransactionNoneZ sign_tx_LDKWalletSource_jcall(const void* this_arg, LDKTransaction tx) {
20398         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
20399         JNIEnv *env;
20400         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20401         if (get_jenv_res == JNI_EDETACHED) {
20402                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20403         } else {
20404                 DO_ASSERT(get_jenv_res == JNI_OK);
20405         }
20406         LDKTransaction tx_var = tx;
20407         int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
20408         (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
20409         Transaction_free(tx_var);
20410         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20411         CHECK(obj != NULL);
20412         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_tx_meth, tx_arr);
20413         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20414                 (*env)->ExceptionDescribe(env);
20415                 (*env)->FatalError(env, "A call to sign_tx in LDKWalletSource from rust threw an exception.");
20416         }
20417         void* ret_ptr = untag_ptr(ret);
20418         CHECK_ACCESS(ret_ptr);
20419         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
20420         FREE(untag_ptr(ret));
20421         if (get_jenv_res == JNI_EDETACHED) {
20422                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20423         }
20424         return ret_conv;
20425 }
20426 static void LDKWalletSource_JCalls_cloned(LDKWalletSource* new_obj) {
20427         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) new_obj->this_arg;
20428         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
20429 }
20430 static inline LDKWalletSource LDKWalletSource_init (JNIEnv *env, jclass clz, jobject o) {
20431         jclass c = (*env)->GetObjectClass(env, o);
20432         CHECK(c != NULL);
20433         LDKWalletSource_JCalls *calls = MALLOC(sizeof(LDKWalletSource_JCalls), "LDKWalletSource_JCalls");
20434         atomic_init(&calls->refcnt, 1);
20435         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
20436         calls->o = (*env)->NewWeakGlobalRef(env, o);
20437         calls->list_confirmed_utxos_meth = (*env)->GetMethodID(env, c, "list_confirmed_utxos", "()J");
20438         CHECK(calls->list_confirmed_utxos_meth != NULL);
20439         calls->get_change_script_meth = (*env)->GetMethodID(env, c, "get_change_script", "()J");
20440         CHECK(calls->get_change_script_meth != NULL);
20441         calls->sign_tx_meth = (*env)->GetMethodID(env, c, "sign_tx", "([B)J");
20442         CHECK(calls->sign_tx_meth != NULL);
20443
20444         LDKWalletSource ret = {
20445                 .this_arg = (void*) calls,
20446                 .list_confirmed_utxos = list_confirmed_utxos_LDKWalletSource_jcall,
20447                 .get_change_script = get_change_script_LDKWalletSource_jcall,
20448                 .sign_tx = sign_tx_LDKWalletSource_jcall,
20449                 .free = LDKWalletSource_JCalls_free,
20450         };
20451         return ret;
20452 }
20453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWalletSource_1new(JNIEnv *env, jclass clz, jobject o) {
20454         LDKWalletSource *res_ptr = MALLOC(sizeof(LDKWalletSource), "LDKWalletSource");
20455         *res_ptr = LDKWalletSource_init(env, clz, o);
20456         return tag_ptr(res_ptr, true);
20457 }
20458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1list_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_arg) {
20459         void* this_arg_ptr = untag_ptr(this_arg);
20460         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20461         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
20462         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
20463         *ret_conv = (this_arg_conv->list_confirmed_utxos)(this_arg_conv->this_arg);
20464         return tag_ptr(ret_conv, true);
20465 }
20466
20467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1get_1change_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
20468         void* this_arg_ptr = untag_ptr(this_arg);
20469         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20470         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
20471         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
20472         *ret_conv = (this_arg_conv->get_change_script)(this_arg_conv->this_arg);
20473         return tag_ptr(ret_conv, true);
20474 }
20475
20476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1sign_1tx(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
20477         void* this_arg_ptr = untag_ptr(this_arg);
20478         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20479         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
20480         LDKTransaction tx_ref;
20481         tx_ref.datalen = (*env)->GetArrayLength(env, tx);
20482         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
20483         (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
20484         tx_ref.data_is_owned = true;
20485         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20486         *ret_conv = (this_arg_conv->sign_tx)(this_arg_conv->this_arg, tx_ref);
20487         return tag_ptr(ret_conv, true);
20488 }
20489
20490 static jclass LDKGossipSync_P2P_class = NULL;
20491 static jmethodID LDKGossipSync_P2P_meth = NULL;
20492 static jclass LDKGossipSync_Rapid_class = NULL;
20493 static jmethodID LDKGossipSync_Rapid_meth = NULL;
20494 static jclass LDKGossipSync_None_class = NULL;
20495 static jmethodID LDKGossipSync_None_meth = NULL;
20496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGossipSync_init (JNIEnv *env, jclass clz) {
20497         LDKGossipSync_P2P_class =
20498                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$P2P"));
20499         CHECK(LDKGossipSync_P2P_class != NULL);
20500         LDKGossipSync_P2P_meth = (*env)->GetMethodID(env, LDKGossipSync_P2P_class, "<init>", "(J)V");
20501         CHECK(LDKGossipSync_P2P_meth != NULL);
20502         LDKGossipSync_Rapid_class =
20503                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$Rapid"));
20504         CHECK(LDKGossipSync_Rapid_class != NULL);
20505         LDKGossipSync_Rapid_meth = (*env)->GetMethodID(env, LDKGossipSync_Rapid_class, "<init>", "(J)V");
20506         CHECK(LDKGossipSync_Rapid_meth != NULL);
20507         LDKGossipSync_None_class =
20508                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$None"));
20509         CHECK(LDKGossipSync_None_class != NULL);
20510         LDKGossipSync_None_meth = (*env)->GetMethodID(env, LDKGossipSync_None_class, "<init>", "()V");
20511         CHECK(LDKGossipSync_None_meth != NULL);
20512 }
20513 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGossipSync_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
20514         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
20515         switch(obj->tag) {
20516                 case LDKGossipSync_P2P: {
20517                         LDKP2PGossipSync p2p_var = obj->p2p;
20518                         int64_t p2p_ref = 0;
20519                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
20520                         p2p_ref = tag_ptr(p2p_var.inner, false);
20521                         return (*env)->NewObject(env, LDKGossipSync_P2P_class, LDKGossipSync_P2P_meth, p2p_ref);
20522                 }
20523                 case LDKGossipSync_Rapid: {
20524                         LDKRapidGossipSync rapid_var = obj->rapid;
20525                         int64_t rapid_ref = 0;
20526                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
20527                         rapid_ref = tag_ptr(rapid_var.inner, false);
20528                         return (*env)->NewObject(env, LDKGossipSync_Rapid_class, LDKGossipSync_Rapid_meth, rapid_ref);
20529                 }
20530                 case LDKGossipSync_None: {
20531                         return (*env)->NewObject(env, LDKGossipSync_None_class, LDKGossipSync_None_meth);
20532                 }
20533                 default: abort();
20534         }
20535 }
20536 static jclass LDKFallback_SegWitProgram_class = NULL;
20537 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
20538 static jclass LDKFallback_PubKeyHash_class = NULL;
20539 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
20540 static jclass LDKFallback_ScriptHash_class = NULL;
20541 static jmethodID LDKFallback_ScriptHash_meth = NULL;
20542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
20543         LDKFallback_SegWitProgram_class =
20544                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$SegWitProgram"));
20545         CHECK(LDKFallback_SegWitProgram_class != NULL);
20546         LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
20547         CHECK(LDKFallback_SegWitProgram_meth != NULL);
20548         LDKFallback_PubKeyHash_class =
20549                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$PubKeyHash"));
20550         CHECK(LDKFallback_PubKeyHash_class != NULL);
20551         LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
20552         CHECK(LDKFallback_PubKeyHash_meth != NULL);
20553         LDKFallback_ScriptHash_class =
20554                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$ScriptHash"));
20555         CHECK(LDKFallback_ScriptHash_class != NULL);
20556         LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
20557         CHECK(LDKFallback_ScriptHash_meth != NULL);
20558 }
20559 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
20560         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
20561         switch(obj->tag) {
20562                 case LDKFallback_SegWitProgram: {
20563                         uint8_t version_val = obj->seg_wit_program.version._0;
20564                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
20565                         int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
20566                         (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
20567                         return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
20568                 }
20569                 case LDKFallback_PubKeyHash: {
20570                         int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
20571                         (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
20572                         return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
20573                 }
20574                 case LDKFallback_ScriptHash: {
20575                         int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
20576                         (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
20577                         return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
20578                 }
20579                 default: abort();
20580         }
20581 }
20582 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
20583         LDKStr ret_str = _ldk_get_compiled_version();
20584         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
20585         Str_free(ret_str);
20586         return ret_conv;
20587 }
20588
20589 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
20590         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
20591         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
20592         Str_free(ret_str);
20593         return ret_conv;
20594 }
20595
20596 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_U128_1le_1bytes(JNIEnv *env, jclass clz, int8_tArray val) {
20597         LDKU128 val_ref;
20598         CHECK((*env)->GetArrayLength(env, val) == 16);
20599         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
20600         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
20601         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, U128_le_bytes(val_ref).data);
20602         return ret_arr;
20603 }
20604
20605 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_U128_1new(JNIEnv *env, jclass clz, int8_tArray le_bytes) {
20606         LDKSixteenBytes le_bytes_ref;
20607         CHECK((*env)->GetArrayLength(env, le_bytes) == 16);
20608         (*env)->GetByteArrayRegion(env, le_bytes, 0, 16, le_bytes_ref.data);
20609         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
20610         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, U128_new(le_bytes_ref).le_bytes);
20611         return ret_arr;
20612 }
20613
20614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1new(JNIEnv *env, jclass clz, int8_tArray big_endian_bytes) {
20615         LDKThirtyTwoBytes big_endian_bytes_ref;
20616         CHECK((*env)->GetArrayLength(env, big_endian_bytes) == 32);
20617         (*env)->GetByteArrayRegion(env, big_endian_bytes, 0, 32, big_endian_bytes_ref.data);
20618         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
20619         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
20620         return tag_ptr(ret_ref, true);
20621 }
20622
20623 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
20624         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
20625         *ret_copy = Bech32Error_clone(arg);
20626         int64_t ret_ref = tag_ptr(ret_copy, true);
20627         return ret_ref;
20628 }
20629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20630         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
20631         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
20632         return ret_conv;
20633 }
20634
20635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20636         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
20637         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
20638         *ret_copy = Bech32Error_clone(orig_conv);
20639         int64_t ret_ref = tag_ptr(ret_copy, true);
20640         return ret_ref;
20641 }
20642
20643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bech32Error_1free(JNIEnv *env, jclass clz, int64_t o) {
20644         if (!ptr_is_owned(o)) return;
20645         void* o_ptr = untag_ptr(o);
20646         CHECK_ACCESS(o_ptr);
20647         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
20648         FREE(untag_ptr(o));
20649         Bech32Error_free(o_conv);
20650 }
20651
20652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
20653         LDKTransaction _res_ref;
20654         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
20655         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
20656         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
20657         _res_ref.data_is_owned = true;
20658         Transaction_free(_res_ref);
20659 }
20660
20661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Witness_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
20662         LDKWitness _res_ref;
20663         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
20664         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
20665         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
20666         _res_ref.data_is_owned = true;
20667         Witness_free(_res_ref);
20668 }
20669
20670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxIn_1free(JNIEnv *env, jclass clz, int64_t _res) {
20671         if (!ptr_is_owned(_res)) return;
20672         void* _res_ptr = untag_ptr(_res);
20673         CHECK_ACCESS(_res_ptr);
20674         LDKTxIn _res_conv = *(LDKTxIn*)(_res_ptr);
20675         FREE(untag_ptr(_res));
20676         TxIn_free(_res_conv);
20677 }
20678
20679 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) {
20680         LDKWitness witness_ref;
20681         witness_ref.datalen = (*env)->GetArrayLength(env, witness);
20682         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
20683         (*env)->GetByteArrayRegion(env, witness, 0, witness_ref.datalen, witness_ref.data);
20684         witness_ref.data_is_owned = true;
20685         LDKCVec_u8Z script_sig_ref;
20686         script_sig_ref.datalen = (*env)->GetArrayLength(env, script_sig);
20687         script_sig_ref.data = MALLOC(script_sig_ref.datalen, "LDKCVec_u8Z Bytes");
20688         (*env)->GetByteArrayRegion(env, script_sig, 0, script_sig_ref.datalen, script_sig_ref.data);
20689         LDKThirtyTwoBytes previous_txid_ref;
20690         CHECK((*env)->GetArrayLength(env, previous_txid) == 32);
20691         (*env)->GetByteArrayRegion(env, previous_txid, 0, 32, previous_txid_ref.data);
20692         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
20693         *ret_ref = TxIn_new(witness_ref, script_sig_ref, sequence, previous_txid_ref, previous_vout);
20694         return tag_ptr(ret_ref, true);
20695 }
20696
20697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
20698         LDKCVec_u8Z script_pubkey_ref;
20699         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
20700         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
20701         (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
20702         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
20703         *ret_ref = TxOut_new(script_pubkey_ref, value);
20704         return tag_ptr(ret_ref, true);
20705 }
20706
20707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
20708         if (!ptr_is_owned(_res)) return;
20709         void* _res_ptr = untag_ptr(_res);
20710         CHECK_ACCESS(_res_ptr);
20711         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
20712         FREE(untag_ptr(_res));
20713         TxOut_free(_res_conv);
20714 }
20715
20716 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
20717         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
20718         *ret_ref = TxOut_clone(arg);
20719         return tag_ptr(ret_ref, true);
20720 }
20721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20722         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
20723         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
20724         return ret_conv;
20725 }
20726
20727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20728         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
20729         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
20730         *ret_ref = TxOut_clone(orig_conv);
20731         return tag_ptr(ret_ref, true);
20732 }
20733
20734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
20735         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
20736         Str_free(dummy);
20737 }
20738
20739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
20740         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
20741         *ret_copy = COption_u64Z_some(o);
20742         int64_t ret_ref = tag_ptr(ret_copy, true);
20743         return ret_ref;
20744 }
20745
20746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
20747         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
20748         *ret_copy = COption_u64Z_none();
20749         int64_t ret_ref = tag_ptr(ret_copy, true);
20750         return ret_ref;
20751 }
20752
20753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
20754         if (!ptr_is_owned(_res)) return;
20755         void* _res_ptr = untag_ptr(_res);
20756         CHECK_ACCESS(_res_ptr);
20757         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
20758         FREE(untag_ptr(_res));
20759         COption_u64Z_free(_res_conv);
20760 }
20761
20762 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
20763         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
20764         *ret_copy = COption_u64Z_clone(arg);
20765         int64_t ret_ref = tag_ptr(ret_copy, true);
20766         return ret_ref;
20767 }
20768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20769         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
20770         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
20771         return ret_conv;
20772 }
20773
20774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20775         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
20776         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
20777         *ret_copy = COption_u64Z_clone(orig_conv);
20778         int64_t ret_ref = tag_ptr(ret_copy, true);
20779         return ret_ref;
20780 }
20781
20782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BlindedPathZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20783         LDKCVec_BlindedPathZ _res_constr;
20784         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20785         if (_res_constr.datalen > 0)
20786                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
20787         else
20788                 _res_constr.data = NULL;
20789         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20790         for (size_t n = 0; n < _res_constr.datalen; n++) {
20791                 int64_t _res_conv_13 = _res_vals[n];
20792                 LDKBlindedPath _res_conv_13_conv;
20793                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
20794                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
20795                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
20796                 _res_constr.data[n] = _res_conv_13_conv;
20797         }
20798         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20799         CVec_BlindedPathZ_free(_res_constr);
20800 }
20801
20802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20803         LDKRefund o_conv;
20804         o_conv.inner = untag_ptr(o);
20805         o_conv.is_owned = ptr_is_owned(o);
20806         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20807         o_conv = Refund_clone(&o_conv);
20808         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
20809         *ret_conv = CResult_RefundBolt12ParseErrorZ_ok(o_conv);
20810         return tag_ptr(ret_conv, true);
20811 }
20812
20813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20814         LDKBolt12ParseError e_conv;
20815         e_conv.inner = untag_ptr(e);
20816         e_conv.is_owned = ptr_is_owned(e);
20817         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20818         e_conv = Bolt12ParseError_clone(&e_conv);
20819         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
20820         *ret_conv = CResult_RefundBolt12ParseErrorZ_err(e_conv);
20821         return tag_ptr(ret_conv, true);
20822 }
20823
20824 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20825         LDKCResult_RefundBolt12ParseErrorZ* o_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(o);
20826         jboolean ret_conv = CResult_RefundBolt12ParseErrorZ_is_ok(o_conv);
20827         return ret_conv;
20828 }
20829
20830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_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_RefundBolt12ParseErrorZ _res_conv = *(LDKCResult_RefundBolt12ParseErrorZ*)(_res_ptr);
20835         FREE(untag_ptr(_res));
20836         CResult_RefundBolt12ParseErrorZ_free(_res_conv);
20837 }
20838
20839 static inline uint64_t CResult_RefundBolt12ParseErrorZ_clone_ptr(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR arg) {
20840         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
20841         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(arg);
20842         return tag_ptr(ret_conv, true);
20843 }
20844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20845         LDKCResult_RefundBolt12ParseErrorZ* arg_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(arg);
20846         int64_t ret_conv = CResult_RefundBolt12ParseErrorZ_clone_ptr(arg_conv);
20847         return ret_conv;
20848 }
20849
20850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20851         LDKCResult_RefundBolt12ParseErrorZ* orig_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(orig);
20852         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
20853         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(orig_conv);
20854         return tag_ptr(ret_conv, true);
20855 }
20856
20857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20858         void* o_ptr = untag_ptr(o);
20859         CHECK_ACCESS(o_ptr);
20860         LDKRetry o_conv = *(LDKRetry*)(o_ptr);
20861         o_conv = Retry_clone((LDKRetry*)untag_ptr(o));
20862         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
20863         *ret_conv = CResult_RetryDecodeErrorZ_ok(o_conv);
20864         return tag_ptr(ret_conv, true);
20865 }
20866
20867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20868         void* e_ptr = untag_ptr(e);
20869         CHECK_ACCESS(e_ptr);
20870         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20871         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20872         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
20873         *ret_conv = CResult_RetryDecodeErrorZ_err(e_conv);
20874         return tag_ptr(ret_conv, true);
20875 }
20876
20877 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20878         LDKCResult_RetryDecodeErrorZ* o_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(o);
20879         jboolean ret_conv = CResult_RetryDecodeErrorZ_is_ok(o_conv);
20880         return ret_conv;
20881 }
20882
20883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20884         if (!ptr_is_owned(_res)) return;
20885         void* _res_ptr = untag_ptr(_res);
20886         CHECK_ACCESS(_res_ptr);
20887         LDKCResult_RetryDecodeErrorZ _res_conv = *(LDKCResult_RetryDecodeErrorZ*)(_res_ptr);
20888         FREE(untag_ptr(_res));
20889         CResult_RetryDecodeErrorZ_free(_res_conv);
20890 }
20891
20892 static inline uint64_t CResult_RetryDecodeErrorZ_clone_ptr(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR arg) {
20893         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
20894         *ret_conv = CResult_RetryDecodeErrorZ_clone(arg);
20895         return tag_ptr(ret_conv, true);
20896 }
20897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20898         LDKCResult_RetryDecodeErrorZ* arg_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(arg);
20899         int64_t ret_conv = CResult_RetryDecodeErrorZ_clone_ptr(arg_conv);
20900         return ret_conv;
20901 }
20902
20903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20904         LDKCResult_RetryDecodeErrorZ* orig_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(orig);
20905         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
20906         *ret_conv = CResult_RetryDecodeErrorZ_clone(orig_conv);
20907         return tag_ptr(ret_conv, true);
20908 }
20909
20910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
20911         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
20912         *ret_conv = CResult_NoneAPIErrorZ_ok();
20913         return tag_ptr(ret_conv, true);
20914 }
20915
20916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20917         void* e_ptr = untag_ptr(e);
20918         CHECK_ACCESS(e_ptr);
20919         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
20920         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
20921         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
20922         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
20923         return tag_ptr(ret_conv, true);
20924 }
20925
20926 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20927         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
20928         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
20929         return ret_conv;
20930 }
20931
20932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20933         if (!ptr_is_owned(_res)) return;
20934         void* _res_ptr = untag_ptr(_res);
20935         CHECK_ACCESS(_res_ptr);
20936         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
20937         FREE(untag_ptr(_res));
20938         CResult_NoneAPIErrorZ_free(_res_conv);
20939 }
20940
20941 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
20942         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
20943         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
20944         return tag_ptr(ret_conv, true);
20945 }
20946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20947         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
20948         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
20949         return ret_conv;
20950 }
20951
20952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20953         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
20954         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
20955         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
20956         return tag_ptr(ret_conv, true);
20957 }
20958
20959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20960         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
20961         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20962         if (_res_constr.datalen > 0)
20963                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
20964         else
20965                 _res_constr.data = NULL;
20966         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20967         for (size_t w = 0; w < _res_constr.datalen; w++) {
20968                 int64_t _res_conv_22 = _res_vals[w];
20969                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
20970                 CHECK_ACCESS(_res_conv_22_ptr);
20971                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
20972                 FREE(untag_ptr(_res_conv_22));
20973                 _res_constr.data[w] = _res_conv_22_conv;
20974         }
20975         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20976         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
20977 }
20978
20979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20980         LDKCVec_APIErrorZ _res_constr;
20981         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20982         if (_res_constr.datalen > 0)
20983                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
20984         else
20985                 _res_constr.data = NULL;
20986         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20987         for (size_t k = 0; k < _res_constr.datalen; k++) {
20988                 int64_t _res_conv_10 = _res_vals[k];
20989                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
20990                 CHECK_ACCESS(_res_conv_10_ptr);
20991                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
20992                 FREE(untag_ptr(_res_conv_10));
20993                 _res_constr.data[k] = _res_conv_10_conv;
20994         }
20995         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20996         CVec_APIErrorZ_free(_res_constr);
20997 }
20998
20999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
21000         LDKThirtyTwoBytes o_ref;
21001         CHECK((*env)->GetArrayLength(env, o) == 32);
21002         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
21003         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
21004         *ret_copy = COption_ThirtyTwoBytesZ_some(o_ref);
21005         int64_t ret_ref = tag_ptr(ret_copy, true);
21006         return ret_ref;
21007 }
21008
21009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1none(JNIEnv *env, jclass clz) {
21010         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
21011         *ret_copy = COption_ThirtyTwoBytesZ_none();
21012         int64_t ret_ref = tag_ptr(ret_copy, true);
21013         return ret_ref;
21014 }
21015
21016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21017         if (!ptr_is_owned(_res)) return;
21018         void* _res_ptr = untag_ptr(_res);
21019         CHECK_ACCESS(_res_ptr);
21020         LDKCOption_ThirtyTwoBytesZ _res_conv = *(LDKCOption_ThirtyTwoBytesZ*)(_res_ptr);
21021         FREE(untag_ptr(_res));
21022         COption_ThirtyTwoBytesZ_free(_res_conv);
21023 }
21024
21025 static inline uint64_t COption_ThirtyTwoBytesZ_clone_ptr(LDKCOption_ThirtyTwoBytesZ *NONNULL_PTR arg) {
21026         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
21027         *ret_copy = COption_ThirtyTwoBytesZ_clone(arg);
21028         int64_t ret_ref = tag_ptr(ret_copy, true);
21029         return ret_ref;
21030 }
21031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21032         LDKCOption_ThirtyTwoBytesZ* arg_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(arg);
21033         int64_t ret_conv = COption_ThirtyTwoBytesZ_clone_ptr(arg_conv);
21034         return ret_conv;
21035 }
21036
21037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21038         LDKCOption_ThirtyTwoBytesZ* orig_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(orig);
21039         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
21040         *ret_copy = COption_ThirtyTwoBytesZ_clone(orig_conv);
21041         int64_t ret_ref = tag_ptr(ret_copy, true);
21042         return ret_ref;
21043 }
21044
21045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
21046         LDKCVec_u8Z _res_ref;
21047         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
21048         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
21049         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
21050         CVec_u8Z_free(_res_ref);
21051 }
21052
21053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
21054         LDKCVec_u8Z o_ref;
21055         o_ref.datalen = (*env)->GetArrayLength(env, o);
21056         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
21057         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
21058         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
21059         *ret_copy = COption_CVec_u8ZZ_some(o_ref);
21060         int64_t ret_ref = tag_ptr(ret_copy, true);
21061         return ret_ref;
21062 }
21063
21064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1none(JNIEnv *env, jclass clz) {
21065         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
21066         *ret_copy = COption_CVec_u8ZZ_none();
21067         int64_t ret_ref = tag_ptr(ret_copy, true);
21068         return ret_ref;
21069 }
21070
21071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21072         if (!ptr_is_owned(_res)) return;
21073         void* _res_ptr = untag_ptr(_res);
21074         CHECK_ACCESS(_res_ptr);
21075         LDKCOption_CVec_u8ZZ _res_conv = *(LDKCOption_CVec_u8ZZ*)(_res_ptr);
21076         FREE(untag_ptr(_res));
21077         COption_CVec_u8ZZ_free(_res_conv);
21078 }
21079
21080 static inline uint64_t COption_CVec_u8ZZ_clone_ptr(LDKCOption_CVec_u8ZZ *NONNULL_PTR arg) {
21081         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
21082         *ret_copy = COption_CVec_u8ZZ_clone(arg);
21083         int64_t ret_ref = tag_ptr(ret_copy, true);
21084         return ret_ref;
21085 }
21086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21087         LDKCOption_CVec_u8ZZ* arg_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(arg);
21088         int64_t ret_conv = COption_CVec_u8ZZ_clone_ptr(arg_conv);
21089         return ret_conv;
21090 }
21091
21092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21093         LDKCOption_CVec_u8ZZ* orig_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(orig);
21094         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
21095         *ret_copy = COption_CVec_u8ZZ_clone(orig_conv);
21096         int64_t ret_ref = tag_ptr(ret_copy, true);
21097         return ret_ref;
21098 }
21099
21100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21101         LDKRecipientOnionFields o_conv;
21102         o_conv.inner = untag_ptr(o);
21103         o_conv.is_owned = ptr_is_owned(o);
21104         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21105         o_conv = RecipientOnionFields_clone(&o_conv);
21106         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
21107         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_ok(o_conv);
21108         return tag_ptr(ret_conv, true);
21109 }
21110
21111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21112         void* e_ptr = untag_ptr(e);
21113         CHECK_ACCESS(e_ptr);
21114         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21115         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21116         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
21117         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_err(e_conv);
21118         return tag_ptr(ret_conv, true);
21119 }
21120
21121 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21122         LDKCResult_RecipientOnionFieldsDecodeErrorZ* o_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(o);
21123         jboolean ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o_conv);
21124         return ret_conv;
21125 }
21126
21127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21128         if (!ptr_is_owned(_res)) return;
21129         void* _res_ptr = untag_ptr(_res);
21130         CHECK_ACCESS(_res_ptr);
21131         LDKCResult_RecipientOnionFieldsDecodeErrorZ _res_conv = *(LDKCResult_RecipientOnionFieldsDecodeErrorZ*)(_res_ptr);
21132         FREE(untag_ptr(_res));
21133         CResult_RecipientOnionFieldsDecodeErrorZ_free(_res_conv);
21134 }
21135
21136 static inline uint64_t CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR arg) {
21137         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
21138         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(arg);
21139         return tag_ptr(ret_conv, true);
21140 }
21141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21142         LDKCResult_RecipientOnionFieldsDecodeErrorZ* arg_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(arg);
21143         int64_t ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(arg_conv);
21144         return ret_conv;
21145 }
21146
21147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21148         LDKCResult_RecipientOnionFieldsDecodeErrorZ* orig_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(orig);
21149         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
21150         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig_conv);
21151         return tag_ptr(ret_conv, true);
21152 }
21153
21154 static inline uint64_t C2Tuple_u64CVec_u8ZZ_clone_ptr(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR arg) {
21155         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
21156         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(arg);
21157         return tag_ptr(ret_conv, true);
21158 }
21159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21160         LDKC2Tuple_u64CVec_u8ZZ* arg_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(arg);
21161         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_clone_ptr(arg_conv);
21162         return ret_conv;
21163 }
21164
21165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21166         LDKC2Tuple_u64CVec_u8ZZ* orig_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(orig);
21167         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
21168         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(orig_conv);
21169         return tag_ptr(ret_conv, true);
21170 }
21171
21172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
21173         LDKCVec_u8Z b_ref;
21174         b_ref.datalen = (*env)->GetArrayLength(env, b);
21175         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
21176         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
21177         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
21178         *ret_conv = C2Tuple_u64CVec_u8ZZ_new(a, b_ref);
21179         return tag_ptr(ret_conv, true);
21180 }
21181
21182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21183         if (!ptr_is_owned(_res)) return;
21184         void* _res_ptr = untag_ptr(_res);
21185         CHECK_ACCESS(_res_ptr);
21186         LDKC2Tuple_u64CVec_u8ZZ _res_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_ptr);
21187         FREE(untag_ptr(_res));
21188         C2Tuple_u64CVec_u8ZZ_free(_res_conv);
21189 }
21190
21191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u64CVec_1u8ZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21192         LDKCVec_C2Tuple_u64CVec_u8ZZZ _res_constr;
21193         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21194         if (_res_constr.datalen > 0)
21195                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
21196         else
21197                 _res_constr.data = NULL;
21198         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21199         for (size_t x = 0; x < _res_constr.datalen; x++) {
21200                 int64_t _res_conv_23 = _res_vals[x];
21201                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
21202                 CHECK_ACCESS(_res_conv_23_ptr);
21203                 LDKC2Tuple_u64CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_conv_23_ptr);
21204                 FREE(untag_ptr(_res_conv_23));
21205                 _res_constr.data[x] = _res_conv_23_conv;
21206         }
21207         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21208         CVec_C2Tuple_u64CVec_u8ZZZ_free(_res_constr);
21209 }
21210
21211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21212         LDKRecipientOnionFields o_conv;
21213         o_conv.inner = untag_ptr(o);
21214         o_conv.is_owned = ptr_is_owned(o);
21215         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21216         o_conv = RecipientOnionFields_clone(&o_conv);
21217         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
21218         *ret_conv = CResult_RecipientOnionFieldsNoneZ_ok(o_conv);
21219         return tag_ptr(ret_conv, true);
21220 }
21221
21222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1err(JNIEnv *env, jclass clz) {
21223         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
21224         *ret_conv = CResult_RecipientOnionFieldsNoneZ_err();
21225         return tag_ptr(ret_conv, true);
21226 }
21227
21228 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21229         LDKCResult_RecipientOnionFieldsNoneZ* o_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(o);
21230         jboolean ret_conv = CResult_RecipientOnionFieldsNoneZ_is_ok(o_conv);
21231         return ret_conv;
21232 }
21233
21234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21235         if (!ptr_is_owned(_res)) return;
21236         void* _res_ptr = untag_ptr(_res);
21237         CHECK_ACCESS(_res_ptr);
21238         LDKCResult_RecipientOnionFieldsNoneZ _res_conv = *(LDKCResult_RecipientOnionFieldsNoneZ*)(_res_ptr);
21239         FREE(untag_ptr(_res));
21240         CResult_RecipientOnionFieldsNoneZ_free(_res_conv);
21241 }
21242
21243 static inline uint64_t CResult_RecipientOnionFieldsNoneZ_clone_ptr(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR arg) {
21244         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
21245         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(arg);
21246         return tag_ptr(ret_conv, true);
21247 }
21248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21249         LDKCResult_RecipientOnionFieldsNoneZ* arg_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(arg);
21250         int64_t ret_conv = CResult_RecipientOnionFieldsNoneZ_clone_ptr(arg_conv);
21251         return ret_conv;
21252 }
21253
21254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21255         LDKCResult_RecipientOnionFieldsNoneZ* orig_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(orig);
21256         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
21257         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(orig_conv);
21258         return tag_ptr(ret_conv, true);
21259 }
21260
21261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
21262         LDKCVec_ThirtyTwoBytesZ _res_constr;
21263         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21264         if (_res_constr.datalen > 0)
21265                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
21266         else
21267                 _res_constr.data = NULL;
21268         for (size_t i = 0; i < _res_constr.datalen; i++) {
21269                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
21270                 LDKThirtyTwoBytes _res_conv_8_ref;
21271                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
21272                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
21273                 _res_constr.data[i] = _res_conv_8_ref;
21274         }
21275         CVec_ThirtyTwoBytesZ_free(_res_constr);
21276 }
21277
21278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1some(JNIEnv *env, jclass clz, jobjectArray o) {
21279         LDKCVec_ThirtyTwoBytesZ o_constr;
21280         o_constr.datalen = (*env)->GetArrayLength(env, o);
21281         if (o_constr.datalen > 0)
21282                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
21283         else
21284                 o_constr.data = NULL;
21285         for (size_t i = 0; i < o_constr.datalen; i++) {
21286                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
21287                 LDKThirtyTwoBytes o_conv_8_ref;
21288                 CHECK((*env)->GetArrayLength(env, o_conv_8) == 32);
21289                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 32, o_conv_8_ref.data);
21290                 o_constr.data[i] = o_conv_8_ref;
21291         }
21292         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
21293         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_some(o_constr);
21294         int64_t ret_ref = tag_ptr(ret_copy, true);
21295         return ret_ref;
21296 }
21297
21298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1none(JNIEnv *env, jclass clz) {
21299         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
21300         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_none();
21301         int64_t ret_ref = tag_ptr(ret_copy, true);
21302         return ret_ref;
21303 }
21304
21305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21306         if (!ptr_is_owned(_res)) return;
21307         void* _res_ptr = untag_ptr(_res);
21308         CHECK_ACCESS(_res_ptr);
21309         LDKCOption_CVec_ThirtyTwoBytesZZ _res_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(_res_ptr);
21310         FREE(untag_ptr(_res));
21311         COption_CVec_ThirtyTwoBytesZZ_free(_res_conv);
21312 }
21313
21314 static inline uint64_t COption_CVec_ThirtyTwoBytesZZ_clone_ptr(LDKCOption_CVec_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
21315         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
21316         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(arg);
21317         int64_t ret_ref = tag_ptr(ret_copy, true);
21318         return ret_ref;
21319 }
21320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21321         LDKCOption_CVec_ThirtyTwoBytesZZ* arg_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(arg);
21322         int64_t ret_conv = COption_CVec_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
21323         return ret_conv;
21324 }
21325
21326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21327         LDKCOption_CVec_ThirtyTwoBytesZZ* orig_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(orig);
21328         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
21329         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(orig_conv);
21330         int64_t ret_ref = tag_ptr(ret_copy, true);
21331         return ret_ref;
21332 }
21333
21334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
21335         LDKThirtyTwoBytes o_ref;
21336         CHECK((*env)->GetArrayLength(env, o) == 32);
21337         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
21338         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
21339         *ret_conv = CResult_ThirtyTwoBytesNoneZ_ok(o_ref);
21340         return tag_ptr(ret_conv, true);
21341 }
21342
21343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1err(JNIEnv *env, jclass clz) {
21344         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
21345         *ret_conv = CResult_ThirtyTwoBytesNoneZ_err();
21346         return tag_ptr(ret_conv, true);
21347 }
21348
21349 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21350         LDKCResult_ThirtyTwoBytesNoneZ* o_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(o);
21351         jboolean ret_conv = CResult_ThirtyTwoBytesNoneZ_is_ok(o_conv);
21352         return ret_conv;
21353 }
21354
21355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21356         if (!ptr_is_owned(_res)) return;
21357         void* _res_ptr = untag_ptr(_res);
21358         CHECK_ACCESS(_res_ptr);
21359         LDKCResult_ThirtyTwoBytesNoneZ _res_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(_res_ptr);
21360         FREE(untag_ptr(_res));
21361         CResult_ThirtyTwoBytesNoneZ_free(_res_conv);
21362 }
21363
21364 static inline uint64_t CResult_ThirtyTwoBytesNoneZ_clone_ptr(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR arg) {
21365         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
21366         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(arg);
21367         return tag_ptr(ret_conv, true);
21368 }
21369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21370         LDKCResult_ThirtyTwoBytesNoneZ* arg_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(arg);
21371         int64_t ret_conv = CResult_ThirtyTwoBytesNoneZ_clone_ptr(arg_conv);
21372         return ret_conv;
21373 }
21374
21375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21376         LDKCResult_ThirtyTwoBytesNoneZ* orig_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(orig);
21377         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
21378         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(orig_conv);
21379         return tag_ptr(ret_conv, true);
21380 }
21381
21382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21383         LDKBlindedPayInfo o_conv;
21384         o_conv.inner = untag_ptr(o);
21385         o_conv.is_owned = ptr_is_owned(o);
21386         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21387         o_conv = BlindedPayInfo_clone(&o_conv);
21388         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
21389         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_ok(o_conv);
21390         return tag_ptr(ret_conv, true);
21391 }
21392
21393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21394         void* e_ptr = untag_ptr(e);
21395         CHECK_ACCESS(e_ptr);
21396         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21397         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21398         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
21399         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_err(e_conv);
21400         return tag_ptr(ret_conv, true);
21401 }
21402
21403 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21404         LDKCResult_BlindedPayInfoDecodeErrorZ* o_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(o);
21405         jboolean ret_conv = CResult_BlindedPayInfoDecodeErrorZ_is_ok(o_conv);
21406         return ret_conv;
21407 }
21408
21409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21410         if (!ptr_is_owned(_res)) return;
21411         void* _res_ptr = untag_ptr(_res);
21412         CHECK_ACCESS(_res_ptr);
21413         LDKCResult_BlindedPayInfoDecodeErrorZ _res_conv = *(LDKCResult_BlindedPayInfoDecodeErrorZ*)(_res_ptr);
21414         FREE(untag_ptr(_res));
21415         CResult_BlindedPayInfoDecodeErrorZ_free(_res_conv);
21416 }
21417
21418 static inline uint64_t CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR arg) {
21419         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
21420         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(arg);
21421         return tag_ptr(ret_conv, true);
21422 }
21423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21424         LDKCResult_BlindedPayInfoDecodeErrorZ* arg_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(arg);
21425         int64_t ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(arg_conv);
21426         return ret_conv;
21427 }
21428
21429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21430         LDKCResult_BlindedPayInfoDecodeErrorZ* orig_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(orig);
21431         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
21432         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(orig_conv);
21433         return tag_ptr(ret_conv, true);
21434 }
21435
21436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21437         LDKDelayedPaymentOutputDescriptor o_conv;
21438         o_conv.inner = untag_ptr(o);
21439         o_conv.is_owned = ptr_is_owned(o);
21440         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21441         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
21442         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
21443         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
21444         return tag_ptr(ret_conv, true);
21445 }
21446
21447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21448         void* e_ptr = untag_ptr(e);
21449         CHECK_ACCESS(e_ptr);
21450         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21451         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21452         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
21453         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
21454         return tag_ptr(ret_conv, true);
21455 }
21456
21457 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21458         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
21459         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
21460         return ret_conv;
21461 }
21462
21463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21464         if (!ptr_is_owned(_res)) return;
21465         void* _res_ptr = untag_ptr(_res);
21466         CHECK_ACCESS(_res_ptr);
21467         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
21468         FREE(untag_ptr(_res));
21469         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
21470 }
21471
21472 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
21473         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
21474         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
21475         return tag_ptr(ret_conv, true);
21476 }
21477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21478         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
21479         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
21480         return ret_conv;
21481 }
21482
21483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21484         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
21485         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
21486         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
21487         return tag_ptr(ret_conv, true);
21488 }
21489
21490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21491         LDKStaticPaymentOutputDescriptor o_conv;
21492         o_conv.inner = untag_ptr(o);
21493         o_conv.is_owned = ptr_is_owned(o);
21494         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21495         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
21496         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
21497         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
21498         return tag_ptr(ret_conv, true);
21499 }
21500
21501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21502         void* e_ptr = untag_ptr(e);
21503         CHECK_ACCESS(e_ptr);
21504         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21505         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21506         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
21507         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
21508         return tag_ptr(ret_conv, true);
21509 }
21510
21511 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21512         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
21513         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
21514         return ret_conv;
21515 }
21516
21517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21518         if (!ptr_is_owned(_res)) return;
21519         void* _res_ptr = untag_ptr(_res);
21520         CHECK_ACCESS(_res_ptr);
21521         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
21522         FREE(untag_ptr(_res));
21523         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
21524 }
21525
21526 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
21527         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
21528         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
21529         return tag_ptr(ret_conv, true);
21530 }
21531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21532         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
21533         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
21534         return ret_conv;
21535 }
21536
21537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21538         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
21539         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
21540         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
21541         return tag_ptr(ret_conv, true);
21542 }
21543
21544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21545         void* o_ptr = untag_ptr(o);
21546         CHECK_ACCESS(o_ptr);
21547         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
21548         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
21549         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
21550         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
21551         return tag_ptr(ret_conv, true);
21552 }
21553
21554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21555         void* e_ptr = untag_ptr(e);
21556         CHECK_ACCESS(e_ptr);
21557         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21558         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21559         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
21560         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
21561         return tag_ptr(ret_conv, true);
21562 }
21563
21564 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21565         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
21566         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
21567         return ret_conv;
21568 }
21569
21570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21571         if (!ptr_is_owned(_res)) return;
21572         void* _res_ptr = untag_ptr(_res);
21573         CHECK_ACCESS(_res_ptr);
21574         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
21575         FREE(untag_ptr(_res));
21576         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
21577 }
21578
21579 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
21580         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
21581         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
21582         return tag_ptr(ret_conv, true);
21583 }
21584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21585         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
21586         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
21587         return ret_conv;
21588 }
21589
21590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21591         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
21592         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
21593         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
21594         return tag_ptr(ret_conv, true);
21595 }
21596
21597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21598         LDKCVec_SpendableOutputDescriptorZ _res_constr;
21599         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21600         if (_res_constr.datalen > 0)
21601                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
21602         else
21603                 _res_constr.data = NULL;
21604         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21605         for (size_t b = 0; b < _res_constr.datalen; b++) {
21606                 int64_t _res_conv_27 = _res_vals[b];
21607                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
21608                 CHECK_ACCESS(_res_conv_27_ptr);
21609                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
21610                 FREE(untag_ptr(_res_conv_27));
21611                 _res_constr.data[b] = _res_conv_27_conv;
21612         }
21613         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21614         CVec_SpendableOutputDescriptorZ_free(_res_constr);
21615 }
21616
21617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21618         LDKCVec_TxOutZ _res_constr;
21619         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21620         if (_res_constr.datalen > 0)
21621                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
21622         else
21623                 _res_constr.data = NULL;
21624         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21625         for (size_t h = 0; h < _res_constr.datalen; h++) {
21626                 int64_t _res_conv_7 = _res_vals[h];
21627                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
21628                 CHECK_ACCESS(_res_conv_7_ptr);
21629                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
21630                 FREE(untag_ptr(_res_conv_7));
21631                 _res_constr.data[h] = _res_conv_7_conv;
21632         }
21633         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21634         CVec_TxOutZ_free(_res_constr);
21635 }
21636
21637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
21638         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21639         *ret_copy = COption_u32Z_some(o);
21640         int64_t ret_ref = tag_ptr(ret_copy, true);
21641         return ret_ref;
21642 }
21643
21644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
21645         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21646         *ret_copy = COption_u32Z_none();
21647         int64_t ret_ref = tag_ptr(ret_copy, true);
21648         return ret_ref;
21649 }
21650
21651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
21652         if (!ptr_is_owned(_res)) return;
21653         void* _res_ptr = untag_ptr(_res);
21654         CHECK_ACCESS(_res_ptr);
21655         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
21656         FREE(untag_ptr(_res));
21657         COption_u32Z_free(_res_conv);
21658 }
21659
21660 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
21661         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21662         *ret_copy = COption_u32Z_clone(arg);
21663         int64_t ret_ref = tag_ptr(ret_copy, true);
21664         return ret_ref;
21665 }
21666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21667         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
21668         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
21669         return ret_conv;
21670 }
21671
21672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21673         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
21674         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21675         *ret_copy = COption_u32Z_clone(orig_conv);
21676         int64_t ret_ref = tag_ptr(ret_copy, true);
21677         return ret_ref;
21678 }
21679
21680 static inline uint64_t C2Tuple_CVec_u8ZusizeZ_clone_ptr(LDKC2Tuple_CVec_u8ZusizeZ *NONNULL_PTR arg) {
21681         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
21682         *ret_conv = C2Tuple_CVec_u8ZusizeZ_clone(arg);
21683         return tag_ptr(ret_conv, true);
21684 }
21685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8ZusizeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21686         LDKC2Tuple_CVec_u8ZusizeZ* arg_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(arg);
21687         int64_t ret_conv = C2Tuple_CVec_u8ZusizeZ_clone_ptr(arg_conv);
21688         return ret_conv;
21689 }
21690
21691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8ZusizeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21692         LDKC2Tuple_CVec_u8ZusizeZ* orig_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(orig);
21693         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
21694         *ret_conv = C2Tuple_CVec_u8ZusizeZ_clone(orig_conv);
21695         return tag_ptr(ret_conv, true);
21696 }
21697
21698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8ZusizeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
21699         LDKCVec_u8Z a_ref;
21700         a_ref.datalen = (*env)->GetArrayLength(env, a);
21701         a_ref.data = MALLOC(a_ref.datalen, "LDKCVec_u8Z Bytes");
21702         (*env)->GetByteArrayRegion(env, a, 0, a_ref.datalen, a_ref.data);
21703         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
21704         *ret_conv = C2Tuple_CVec_u8ZusizeZ_new(a_ref, b);
21705         return tag_ptr(ret_conv, true);
21706 }
21707
21708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8ZusizeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21709         if (!ptr_is_owned(_res)) return;
21710         void* _res_ptr = untag_ptr(_res);
21711         CHECK_ACCESS(_res_ptr);
21712         LDKC2Tuple_CVec_u8ZusizeZ _res_conv = *(LDKC2Tuple_CVec_u8ZusizeZ*)(_res_ptr);
21713         FREE(untag_ptr(_res));
21714         C2Tuple_CVec_u8ZusizeZ_free(_res_conv);
21715 }
21716
21717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21718         void* o_ptr = untag_ptr(o);
21719         CHECK_ACCESS(o_ptr);
21720         LDKC2Tuple_CVec_u8ZusizeZ o_conv = *(LDKC2Tuple_CVec_u8ZusizeZ*)(o_ptr);
21721         o_conv = C2Tuple_CVec_u8ZusizeZ_clone((LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(o));
21722         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
21723         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_ok(o_conv);
21724         return tag_ptr(ret_conv, true);
21725 }
21726
21727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1err(JNIEnv *env, jclass clz) {
21728         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
21729         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_err();
21730         return tag_ptr(ret_conv, true);
21731 }
21732
21733 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21734         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* o_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(o);
21735         jboolean ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_is_ok(o_conv);
21736         return ret_conv;
21737 }
21738
21739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21740         if (!ptr_is_owned(_res)) return;
21741         void* _res_ptr = untag_ptr(_res);
21742         CHECK_ACCESS(_res_ptr);
21743         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ _res_conv = *(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)(_res_ptr);
21744         FREE(untag_ptr(_res));
21745         CResult_C2Tuple_CVec_u8ZusizeZNoneZ_free(_res_conv);
21746 }
21747
21748 static inline uint64_t CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone_ptr(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR arg) {
21749         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
21750         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone(arg);
21751         return tag_ptr(ret_conv, true);
21752 }
21753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21754         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* arg_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(arg);
21755         int64_t ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone_ptr(arg_conv);
21756         return ret_conv;
21757 }
21758
21759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21760         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* orig_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(orig);
21761         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
21762         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone(orig_conv);
21763         return tag_ptr(ret_conv, true);
21764 }
21765
21766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21767         LDKChannelDerivationParameters o_conv;
21768         o_conv.inner = untag_ptr(o);
21769         o_conv.is_owned = ptr_is_owned(o);
21770         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21771         o_conv = ChannelDerivationParameters_clone(&o_conv);
21772         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
21773         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_ok(o_conv);
21774         return tag_ptr(ret_conv, true);
21775 }
21776
21777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21778         void* e_ptr = untag_ptr(e);
21779         CHECK_ACCESS(e_ptr);
21780         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21781         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21782         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
21783         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_err(e_conv);
21784         return tag_ptr(ret_conv, true);
21785 }
21786
21787 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21788         LDKCResult_ChannelDerivationParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(o);
21789         jboolean ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o_conv);
21790         return ret_conv;
21791 }
21792
21793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21794         if (!ptr_is_owned(_res)) return;
21795         void* _res_ptr = untag_ptr(_res);
21796         CHECK_ACCESS(_res_ptr);
21797         LDKCResult_ChannelDerivationParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelDerivationParametersDecodeErrorZ*)(_res_ptr);
21798         FREE(untag_ptr(_res));
21799         CResult_ChannelDerivationParametersDecodeErrorZ_free(_res_conv);
21800 }
21801
21802 static inline uint64_t CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR arg) {
21803         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
21804         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(arg);
21805         return tag_ptr(ret_conv, true);
21806 }
21807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21808         LDKCResult_ChannelDerivationParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(arg);
21809         int64_t ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(arg_conv);
21810         return ret_conv;
21811 }
21812
21813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21814         LDKCResult_ChannelDerivationParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(orig);
21815         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
21816         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig_conv);
21817         return tag_ptr(ret_conv, true);
21818 }
21819
21820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21821         LDKHTLCDescriptor o_conv;
21822         o_conv.inner = untag_ptr(o);
21823         o_conv.is_owned = ptr_is_owned(o);
21824         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21825         o_conv = HTLCDescriptor_clone(&o_conv);
21826         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
21827         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_ok(o_conv);
21828         return tag_ptr(ret_conv, true);
21829 }
21830
21831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21832         void* e_ptr = untag_ptr(e);
21833         CHECK_ACCESS(e_ptr);
21834         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21835         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21836         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
21837         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_err(e_conv);
21838         return tag_ptr(ret_conv, true);
21839 }
21840
21841 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21842         LDKCResult_HTLCDescriptorDecodeErrorZ* o_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(o);
21843         jboolean ret_conv = CResult_HTLCDescriptorDecodeErrorZ_is_ok(o_conv);
21844         return ret_conv;
21845 }
21846
21847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21848         if (!ptr_is_owned(_res)) return;
21849         void* _res_ptr = untag_ptr(_res);
21850         CHECK_ACCESS(_res_ptr);
21851         LDKCResult_HTLCDescriptorDecodeErrorZ _res_conv = *(LDKCResult_HTLCDescriptorDecodeErrorZ*)(_res_ptr);
21852         FREE(untag_ptr(_res));
21853         CResult_HTLCDescriptorDecodeErrorZ_free(_res_conv);
21854 }
21855
21856 static inline uint64_t CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR arg) {
21857         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
21858         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(arg);
21859         return tag_ptr(ret_conv, true);
21860 }
21861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21862         LDKCResult_HTLCDescriptorDecodeErrorZ* arg_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(arg);
21863         int64_t ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(arg_conv);
21864         return ret_conv;
21865 }
21866
21867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21868         LDKCResult_HTLCDescriptorDecodeErrorZ* orig_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(orig);
21869         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
21870         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(orig_conv);
21871         return tag_ptr(ret_conv, true);
21872 }
21873
21874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
21875         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
21876         *ret_conv = CResult_NoneNoneZ_ok();
21877         return tag_ptr(ret_conv, true);
21878 }
21879
21880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
21881         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
21882         *ret_conv = CResult_NoneNoneZ_err();
21883         return tag_ptr(ret_conv, true);
21884 }
21885
21886 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21887         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
21888         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
21889         return ret_conv;
21890 }
21891
21892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21893         if (!ptr_is_owned(_res)) return;
21894         void* _res_ptr = untag_ptr(_res);
21895         CHECK_ACCESS(_res_ptr);
21896         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
21897         FREE(untag_ptr(_res));
21898         CResult_NoneNoneZ_free(_res_conv);
21899 }
21900
21901 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
21902         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
21903         *ret_conv = CResult_NoneNoneZ_clone(arg);
21904         return tag_ptr(ret_conv, true);
21905 }
21906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21907         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
21908         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
21909         return ret_conv;
21910 }
21911
21912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21913         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
21914         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
21915         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
21916         return tag_ptr(ret_conv, true);
21917 }
21918
21919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ECDSASignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
21920         LDKCVec_ECDSASignatureZ _res_constr;
21921         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21922         if (_res_constr.datalen > 0)
21923                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
21924         else
21925                 _res_constr.data = NULL;
21926         for (size_t i = 0; i < _res_constr.datalen; i++) {
21927                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
21928                 LDKECDSASignature _res_conv_8_ref;
21929                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
21930                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
21931                 _res_constr.data[i] = _res_conv_8_ref;
21932         }
21933         CVec_ECDSASignatureZ_free(_res_constr);
21934 }
21935
21936 static inline uint64_t C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR arg) {
21937         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
21938         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(arg);
21939         return tag_ptr(ret_conv, true);
21940 }
21941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21942         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* arg_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(arg);
21943         int64_t ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(arg_conv);
21944         return ret_conv;
21945 }
21946
21947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21948         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* orig_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(orig);
21949         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
21950         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig_conv);
21951         return tag_ptr(ret_conv, true);
21952 }
21953
21954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
21955         LDKECDSASignature a_ref;
21956         CHECK((*env)->GetArrayLength(env, a) == 64);
21957         (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
21958         LDKCVec_ECDSASignatureZ b_constr;
21959         b_constr.datalen = (*env)->GetArrayLength(env, b);
21960         if (b_constr.datalen > 0)
21961                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
21962         else
21963                 b_constr.data = NULL;
21964         for (size_t i = 0; i < b_constr.datalen; i++) {
21965                 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
21966                 LDKECDSASignature b_conv_8_ref;
21967                 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
21968                 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
21969                 b_constr.data[i] = b_conv_8_ref;
21970         }
21971         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
21972         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a_ref, b_constr);
21973         return tag_ptr(ret_conv, true);
21974 }
21975
21976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21977         if (!ptr_is_owned(_res)) return;
21978         void* _res_ptr = untag_ptr(_res);
21979         CHECK_ACCESS(_res_ptr);
21980         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ _res_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(_res_ptr);
21981         FREE(untag_ptr(_res));
21982         C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res_conv);
21983 }
21984
21985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21986         void* o_ptr = untag_ptr(o);
21987         CHECK_ACCESS(o_ptr);
21988         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ o_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(o_ptr);
21989         o_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone((LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(o));
21990         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
21991         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o_conv);
21992         return tag_ptr(ret_conv, true);
21993 }
21994
21995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
21996         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
21997         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err();
21998         return tag_ptr(ret_conv, true);
21999 }
22000
22001 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22002         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(o);
22003         jboolean ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o_conv);
22004         return ret_conv;
22005 }
22006
22007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22008         if (!ptr_is_owned(_res)) return;
22009         void* _res_ptr = untag_ptr(_res);
22010         CHECK_ACCESS(_res_ptr);
22011         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(_res_ptr);
22012         FREE(untag_ptr(_res));
22013         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res_conv);
22014 }
22015
22016 static inline uint64_t CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR arg) {
22017         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
22018         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(arg);
22019         return tag_ptr(ret_conv, true);
22020 }
22021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22022         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(arg);
22023         int64_t ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(arg_conv);
22024         return ret_conv;
22025 }
22026
22027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22028         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(orig);
22029         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
22030         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig_conv);
22031         return tag_ptr(ret_conv, true);
22032 }
22033
22034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
22035         LDKECDSASignature o_ref;
22036         CHECK((*env)->GetArrayLength(env, o) == 64);
22037         (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
22038         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
22039         *ret_conv = CResult_ECDSASignatureNoneZ_ok(o_ref);
22040         return tag_ptr(ret_conv, true);
22041 }
22042
22043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1err(JNIEnv *env, jclass clz) {
22044         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
22045         *ret_conv = CResult_ECDSASignatureNoneZ_err();
22046         return tag_ptr(ret_conv, true);
22047 }
22048
22049 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22050         LDKCResult_ECDSASignatureNoneZ* o_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(o);
22051         jboolean ret_conv = CResult_ECDSASignatureNoneZ_is_ok(o_conv);
22052         return ret_conv;
22053 }
22054
22055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22056         if (!ptr_is_owned(_res)) return;
22057         void* _res_ptr = untag_ptr(_res);
22058         CHECK_ACCESS(_res_ptr);
22059         LDKCResult_ECDSASignatureNoneZ _res_conv = *(LDKCResult_ECDSASignatureNoneZ*)(_res_ptr);
22060         FREE(untag_ptr(_res));
22061         CResult_ECDSASignatureNoneZ_free(_res_conv);
22062 }
22063
22064 static inline uint64_t CResult_ECDSASignatureNoneZ_clone_ptr(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR arg) {
22065         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
22066         *ret_conv = CResult_ECDSASignatureNoneZ_clone(arg);
22067         return tag_ptr(ret_conv, true);
22068 }
22069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22070         LDKCResult_ECDSASignatureNoneZ* arg_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(arg);
22071         int64_t ret_conv = CResult_ECDSASignatureNoneZ_clone_ptr(arg_conv);
22072         return ret_conv;
22073 }
22074
22075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22076         LDKCResult_ECDSASignatureNoneZ* orig_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(orig);
22077         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
22078         *ret_conv = CResult_ECDSASignatureNoneZ_clone(orig_conv);
22079         return tag_ptr(ret_conv, true);
22080 }
22081
22082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
22083         LDKPublicKey o_ref;
22084         CHECK((*env)->GetArrayLength(env, o) == 33);
22085         (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
22086         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
22087         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
22088         return tag_ptr(ret_conv, true);
22089 }
22090
22091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1err(JNIEnv *env, jclass clz) {
22092         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
22093         *ret_conv = CResult_PublicKeyNoneZ_err();
22094         return tag_ptr(ret_conv, true);
22095 }
22096
22097 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22098         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
22099         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
22100         return ret_conv;
22101 }
22102
22103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22104         if (!ptr_is_owned(_res)) return;
22105         void* _res_ptr = untag_ptr(_res);
22106         CHECK_ACCESS(_res_ptr);
22107         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
22108         FREE(untag_ptr(_res));
22109         CResult_PublicKeyNoneZ_free(_res_conv);
22110 }
22111
22112 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
22113         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
22114         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
22115         return tag_ptr(ret_conv, true);
22116 }
22117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22118         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
22119         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
22120         return ret_conv;
22121 }
22122
22123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22124         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
22125         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
22126         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
22127         return tag_ptr(ret_conv, true);
22128 }
22129
22130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1some(JNIEnv *env, jclass clz, int64_t o) {
22131         void* o_ptr = untag_ptr(o);
22132         CHECK_ACCESS(o_ptr);
22133         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
22134         // WARNING: we may need a move here but no clone is available for LDKBigEndianScalar
22135         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
22136         *ret_copy = COption_BigEndianScalarZ_some(o_conv);
22137         int64_t ret_ref = tag_ptr(ret_copy, true);
22138         return ret_ref;
22139 }
22140
22141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1none(JNIEnv *env, jclass clz) {
22142         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
22143         *ret_copy = COption_BigEndianScalarZ_none();
22144         int64_t ret_ref = tag_ptr(ret_copy, true);
22145         return ret_ref;
22146 }
22147
22148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22149         if (!ptr_is_owned(_res)) return;
22150         void* _res_ptr = untag_ptr(_res);
22151         CHECK_ACCESS(_res_ptr);
22152         LDKCOption_BigEndianScalarZ _res_conv = *(LDKCOption_BigEndianScalarZ*)(_res_ptr);
22153         FREE(untag_ptr(_res));
22154         COption_BigEndianScalarZ_free(_res_conv);
22155 }
22156
22157 static inline uint64_t COption_BigEndianScalarZ_clone_ptr(LDKCOption_BigEndianScalarZ *NONNULL_PTR arg) {
22158         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
22159         *ret_copy = COption_BigEndianScalarZ_clone(arg);
22160         int64_t ret_ref = tag_ptr(ret_copy, true);
22161         return ret_ref;
22162 }
22163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22164         LDKCOption_BigEndianScalarZ* arg_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(arg);
22165         int64_t ret_conv = COption_BigEndianScalarZ_clone_ptr(arg_conv);
22166         return ret_conv;
22167 }
22168
22169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22170         LDKCOption_BigEndianScalarZ* orig_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(orig);
22171         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
22172         *ret_copy = COption_BigEndianScalarZ_clone(orig_conv);
22173         int64_t ret_ref = tag_ptr(ret_copy, true);
22174         return ret_ref;
22175 }
22176
22177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1U5Z_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
22178         LDKCVec_U5Z _res_constr;
22179         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22180         if (_res_constr.datalen > 0)
22181                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
22182         else
22183                 _res_constr.data = NULL;
22184         int8_t* _res_vals = (*env)->GetByteArrayElements (env, _res, NULL);
22185         for (size_t h = 0; h < _res_constr.datalen; h++) {
22186                 int8_t _res_conv_7 = _res_vals[h];
22187                 
22188                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
22189         }
22190         (*env)->ReleaseByteArrayElements(env, _res, _res_vals, 0);
22191         CVec_U5Z_free(_res_constr);
22192 }
22193
22194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
22195         LDKRecoverableSignature o_ref;
22196         CHECK((*env)->GetArrayLength(env, o) == 68);
22197         (*env)->GetByteArrayRegion(env, o, 0, 68, o_ref.serialized_form);
22198         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
22199         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
22200         return tag_ptr(ret_conv, true);
22201 }
22202
22203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
22204         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
22205         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
22206         return tag_ptr(ret_conv, true);
22207 }
22208
22209 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22210         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
22211         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
22212         return ret_conv;
22213 }
22214
22215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22216         if (!ptr_is_owned(_res)) return;
22217         void* _res_ptr = untag_ptr(_res);
22218         CHECK_ACCESS(_res_ptr);
22219         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
22220         FREE(untag_ptr(_res));
22221         CResult_RecoverableSignatureNoneZ_free(_res_conv);
22222 }
22223
22224 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
22225         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
22226         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
22227         return tag_ptr(ret_conv, true);
22228 }
22229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22230         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
22231         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
22232         return ret_conv;
22233 }
22234
22235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22236         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
22237         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
22238         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
22239         return tag_ptr(ret_conv, true);
22240 }
22241
22242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
22243         LDKSchnorrSignature o_ref;
22244         CHECK((*env)->GetArrayLength(env, o) == 64);
22245         (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
22246         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
22247         *ret_conv = CResult_SchnorrSignatureNoneZ_ok(o_ref);
22248         return tag_ptr(ret_conv, true);
22249 }
22250
22251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
22252         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
22253         *ret_conv = CResult_SchnorrSignatureNoneZ_err();
22254         return tag_ptr(ret_conv, true);
22255 }
22256
22257 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22258         LDKCResult_SchnorrSignatureNoneZ* o_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(o);
22259         jboolean ret_conv = CResult_SchnorrSignatureNoneZ_is_ok(o_conv);
22260         return ret_conv;
22261 }
22262
22263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22264         if (!ptr_is_owned(_res)) return;
22265         void* _res_ptr = untag_ptr(_res);
22266         CHECK_ACCESS(_res_ptr);
22267         LDKCResult_SchnorrSignatureNoneZ _res_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(_res_ptr);
22268         FREE(untag_ptr(_res));
22269         CResult_SchnorrSignatureNoneZ_free(_res_conv);
22270 }
22271
22272 static inline uint64_t CResult_SchnorrSignatureNoneZ_clone_ptr(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR arg) {
22273         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
22274         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(arg);
22275         return tag_ptr(ret_conv, true);
22276 }
22277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22278         LDKCResult_SchnorrSignatureNoneZ* arg_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(arg);
22279         int64_t ret_conv = CResult_SchnorrSignatureNoneZ_clone_ptr(arg_conv);
22280         return ret_conv;
22281 }
22282
22283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22284         LDKCResult_SchnorrSignatureNoneZ* orig_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(orig);
22285         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
22286         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(orig_conv);
22287         return tag_ptr(ret_conv, true);
22288 }
22289
22290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22291         void* o_ptr = untag_ptr(o);
22292         CHECK_ACCESS(o_ptr);
22293         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
22294         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
22295                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22296                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
22297         }
22298         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
22299         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
22300         return tag_ptr(ret_conv, true);
22301 }
22302
22303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22304         void* e_ptr = untag_ptr(e);
22305         CHECK_ACCESS(e_ptr);
22306         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22307         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22308         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
22309         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
22310         return tag_ptr(ret_conv, true);
22311 }
22312
22313 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22314         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
22315         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
22316         return ret_conv;
22317 }
22318
22319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22320         if (!ptr_is_owned(_res)) return;
22321         void* _res_ptr = untag_ptr(_res);
22322         CHECK_ACCESS(_res_ptr);
22323         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
22324         FREE(untag_ptr(_res));
22325         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
22326 }
22327
22328 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
22329         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
22330         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
22331         return tag_ptr(ret_conv, true);
22332 }
22333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22334         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
22335         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
22336         return ret_conv;
22337 }
22338
22339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22340         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
22341         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
22342         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
22343         return tag_ptr(ret_conv, true);
22344 }
22345
22346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
22347         LDKCVec_u8Z o_ref;
22348         o_ref.datalen = (*env)->GetArrayLength(env, o);
22349         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
22350         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
22351         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
22352         *ret_conv = CResult_CVec_u8ZNoneZ_ok(o_ref);
22353         return tag_ptr(ret_conv, true);
22354 }
22355
22356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1err(JNIEnv *env, jclass clz) {
22357         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
22358         *ret_conv = CResult_CVec_u8ZNoneZ_err();
22359         return tag_ptr(ret_conv, true);
22360 }
22361
22362 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22363         LDKCResult_CVec_u8ZNoneZ* o_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(o);
22364         jboolean ret_conv = CResult_CVec_u8ZNoneZ_is_ok(o_conv);
22365         return ret_conv;
22366 }
22367
22368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22369         if (!ptr_is_owned(_res)) return;
22370         void* _res_ptr = untag_ptr(_res);
22371         CHECK_ACCESS(_res_ptr);
22372         LDKCResult_CVec_u8ZNoneZ _res_conv = *(LDKCResult_CVec_u8ZNoneZ*)(_res_ptr);
22373         FREE(untag_ptr(_res));
22374         CResult_CVec_u8ZNoneZ_free(_res_conv);
22375 }
22376
22377 static inline uint64_t CResult_CVec_u8ZNoneZ_clone_ptr(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR arg) {
22378         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
22379         *ret_conv = CResult_CVec_u8ZNoneZ_clone(arg);
22380         return tag_ptr(ret_conv, true);
22381 }
22382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22383         LDKCResult_CVec_u8ZNoneZ* arg_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(arg);
22384         int64_t ret_conv = CResult_CVec_u8ZNoneZ_clone_ptr(arg_conv);
22385         return ret_conv;
22386 }
22387
22388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22389         LDKCResult_CVec_u8ZNoneZ* orig_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(orig);
22390         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
22391         *ret_conv = CResult_CVec_u8ZNoneZ_clone(orig_conv);
22392         return tag_ptr(ret_conv, true);
22393 }
22394
22395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22396         LDKShutdownScript o_conv;
22397         o_conv.inner = untag_ptr(o);
22398         o_conv.is_owned = ptr_is_owned(o);
22399         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22400         o_conv = ShutdownScript_clone(&o_conv);
22401         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
22402         *ret_conv = CResult_ShutdownScriptNoneZ_ok(o_conv);
22403         return tag_ptr(ret_conv, true);
22404 }
22405
22406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1err(JNIEnv *env, jclass clz) {
22407         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
22408         *ret_conv = CResult_ShutdownScriptNoneZ_err();
22409         return tag_ptr(ret_conv, true);
22410 }
22411
22412 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22413         LDKCResult_ShutdownScriptNoneZ* o_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(o);
22414         jboolean ret_conv = CResult_ShutdownScriptNoneZ_is_ok(o_conv);
22415         return ret_conv;
22416 }
22417
22418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22419         if (!ptr_is_owned(_res)) return;
22420         void* _res_ptr = untag_ptr(_res);
22421         CHECK_ACCESS(_res_ptr);
22422         LDKCResult_ShutdownScriptNoneZ _res_conv = *(LDKCResult_ShutdownScriptNoneZ*)(_res_ptr);
22423         FREE(untag_ptr(_res));
22424         CResult_ShutdownScriptNoneZ_free(_res_conv);
22425 }
22426
22427 static inline uint64_t CResult_ShutdownScriptNoneZ_clone_ptr(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR arg) {
22428         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
22429         *ret_conv = CResult_ShutdownScriptNoneZ_clone(arg);
22430         return tag_ptr(ret_conv, true);
22431 }
22432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22433         LDKCResult_ShutdownScriptNoneZ* arg_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(arg);
22434         int64_t ret_conv = CResult_ShutdownScriptNoneZ_clone_ptr(arg_conv);
22435         return ret_conv;
22436 }
22437
22438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22439         LDKCResult_ShutdownScriptNoneZ* orig_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(orig);
22440         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
22441         *ret_conv = CResult_ShutdownScriptNoneZ_clone(orig_conv);
22442         return tag_ptr(ret_conv, true);
22443 }
22444
22445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
22446         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
22447         *ret_copy = COption_u16Z_some(o);
22448         int64_t ret_ref = tag_ptr(ret_copy, true);
22449         return ret_ref;
22450 }
22451
22452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
22453         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
22454         *ret_copy = COption_u16Z_none();
22455         int64_t ret_ref = tag_ptr(ret_copy, true);
22456         return ret_ref;
22457 }
22458
22459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
22460         if (!ptr_is_owned(_res)) return;
22461         void* _res_ptr = untag_ptr(_res);
22462         CHECK_ACCESS(_res_ptr);
22463         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
22464         FREE(untag_ptr(_res));
22465         COption_u16Z_free(_res_conv);
22466 }
22467
22468 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
22469         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
22470         *ret_copy = COption_u16Z_clone(arg);
22471         int64_t ret_ref = tag_ptr(ret_copy, true);
22472         return ret_ref;
22473 }
22474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22475         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
22476         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
22477         return ret_conv;
22478 }
22479
22480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22481         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
22482         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
22483         *ret_copy = COption_u16Z_clone(orig_conv);
22484         int64_t ret_ref = tag_ptr(ret_copy, true);
22485         return ret_ref;
22486 }
22487
22488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1some(JNIEnv *env, jclass clz, jboolean o) {
22489         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
22490         *ret_copy = COption_boolZ_some(o);
22491         int64_t ret_ref = tag_ptr(ret_copy, true);
22492         return ret_ref;
22493 }
22494
22495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1none(JNIEnv *env, jclass clz) {
22496         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
22497         *ret_copy = COption_boolZ_none();
22498         int64_t ret_ref = tag_ptr(ret_copy, true);
22499         return ret_ref;
22500 }
22501
22502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22503         if (!ptr_is_owned(_res)) return;
22504         void* _res_ptr = untag_ptr(_res);
22505         CHECK_ACCESS(_res_ptr);
22506         LDKCOption_boolZ _res_conv = *(LDKCOption_boolZ*)(_res_ptr);
22507         FREE(untag_ptr(_res));
22508         COption_boolZ_free(_res_conv);
22509 }
22510
22511 static inline uint64_t COption_boolZ_clone_ptr(LDKCOption_boolZ *NONNULL_PTR arg) {
22512         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
22513         *ret_copy = COption_boolZ_clone(arg);
22514         int64_t ret_ref = tag_ptr(ret_copy, true);
22515         return ret_ref;
22516 }
22517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22518         LDKCOption_boolZ* arg_conv = (LDKCOption_boolZ*)untag_ptr(arg);
22519         int64_t ret_conv = COption_boolZ_clone_ptr(arg_conv);
22520         return ret_conv;
22521 }
22522
22523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22524         LDKCOption_boolZ* orig_conv = (LDKCOption_boolZ*)untag_ptr(orig);
22525         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
22526         *ret_copy = COption_boolZ_clone(orig_conv);
22527         int64_t ret_ref = tag_ptr(ret_copy, true);
22528         return ret_ref;
22529 }
22530
22531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
22532         LDKCVec_CVec_u8ZZ _res_constr;
22533         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22534         if (_res_constr.datalen > 0)
22535                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
22536         else
22537                 _res_constr.data = NULL;
22538         for (size_t i = 0; i < _res_constr.datalen; i++) {
22539                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
22540                 LDKCVec_u8Z _res_conv_8_ref;
22541                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
22542                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
22543                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
22544                 _res_constr.data[i] = _res_conv_8_ref;
22545         }
22546         CVec_CVec_u8ZZ_free(_res_constr);
22547 }
22548
22549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
22550         LDKCVec_CVec_u8ZZ o_constr;
22551         o_constr.datalen = (*env)->GetArrayLength(env, o);
22552         if (o_constr.datalen > 0)
22553                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
22554         else
22555                 o_constr.data = NULL;
22556         for (size_t i = 0; i < o_constr.datalen; i++) {
22557                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
22558                 LDKCVec_u8Z o_conv_8_ref;
22559                 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
22560                 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
22561                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
22562                 o_constr.data[i] = o_conv_8_ref;
22563         }
22564         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
22565         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
22566         return tag_ptr(ret_conv, true);
22567 }
22568
22569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
22570         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
22571         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
22572         return tag_ptr(ret_conv, true);
22573 }
22574
22575 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22576         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
22577         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
22578         return ret_conv;
22579 }
22580
22581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22582         if (!ptr_is_owned(_res)) return;
22583         void* _res_ptr = untag_ptr(_res);
22584         CHECK_ACCESS(_res_ptr);
22585         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
22586         FREE(untag_ptr(_res));
22587         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
22588 }
22589
22590 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
22591         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
22592         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
22593         return tag_ptr(ret_conv, true);
22594 }
22595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22596         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
22597         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
22598         return ret_conv;
22599 }
22600
22601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22602         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
22603         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
22604         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
22605         return tag_ptr(ret_conv, true);
22606 }
22607
22608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22609         LDKInMemorySigner o_conv;
22610         o_conv.inner = untag_ptr(o);
22611         o_conv.is_owned = ptr_is_owned(o);
22612         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22613         o_conv = InMemorySigner_clone(&o_conv);
22614         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
22615         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
22616         return tag_ptr(ret_conv, true);
22617 }
22618
22619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22620         void* e_ptr = untag_ptr(e);
22621         CHECK_ACCESS(e_ptr);
22622         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22623         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22624         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
22625         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
22626         return tag_ptr(ret_conv, true);
22627 }
22628
22629 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22630         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
22631         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
22632         return ret_conv;
22633 }
22634
22635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22636         if (!ptr_is_owned(_res)) return;
22637         void* _res_ptr = untag_ptr(_res);
22638         CHECK_ACCESS(_res_ptr);
22639         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
22640         FREE(untag_ptr(_res));
22641         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
22642 }
22643
22644 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
22645         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
22646         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
22647         return tag_ptr(ret_conv, true);
22648 }
22649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22650         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
22651         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
22652         return ret_conv;
22653 }
22654
22655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22656         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
22657         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
22658         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
22659         return tag_ptr(ret_conv, true);
22660 }
22661
22662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
22663         LDKTransaction o_ref;
22664         o_ref.datalen = (*env)->GetArrayLength(env, o);
22665         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
22666         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
22667         o_ref.data_is_owned = true;
22668         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
22669         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
22670         return tag_ptr(ret_conv, true);
22671 }
22672
22673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
22674         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
22675         *ret_conv = CResult_TransactionNoneZ_err();
22676         return tag_ptr(ret_conv, true);
22677 }
22678
22679 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22680         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
22681         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
22682         return ret_conv;
22683 }
22684
22685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22686         if (!ptr_is_owned(_res)) return;
22687         void* _res_ptr = untag_ptr(_res);
22688         CHECK_ACCESS(_res_ptr);
22689         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
22690         FREE(untag_ptr(_res));
22691         CResult_TransactionNoneZ_free(_res_conv);
22692 }
22693
22694 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
22695         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
22696         *ret_conv = CResult_TransactionNoneZ_clone(arg);
22697         return tag_ptr(ret_conv, true);
22698 }
22699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22700         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
22701         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
22702         return ret_conv;
22703 }
22704
22705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22706         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
22707         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
22708         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
22709         return tag_ptr(ret_conv, true);
22710 }
22711
22712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1some(JNIEnv *env, jclass clz, int64_t o) {
22713         void* o_ptr = untag_ptr(o);
22714         CHECK_ACCESS(o_ptr);
22715         LDKWriteableScore o_conv = *(LDKWriteableScore*)(o_ptr);
22716         if (o_conv.free == LDKWriteableScore_JCalls_free) {
22717                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22718                 LDKWriteableScore_JCalls_cloned(&o_conv);
22719         }
22720         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
22721         *ret_copy = COption_WriteableScoreZ_some(o_conv);
22722         int64_t ret_ref = tag_ptr(ret_copy, true);
22723         return ret_ref;
22724 }
22725
22726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1none(JNIEnv *env, jclass clz) {
22727         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
22728         *ret_copy = COption_WriteableScoreZ_none();
22729         int64_t ret_ref = tag_ptr(ret_copy, true);
22730         return ret_ref;
22731 }
22732
22733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22734         if (!ptr_is_owned(_res)) return;
22735         void* _res_ptr = untag_ptr(_res);
22736         CHECK_ACCESS(_res_ptr);
22737         LDKCOption_WriteableScoreZ _res_conv = *(LDKCOption_WriteableScoreZ*)(_res_ptr);
22738         FREE(untag_ptr(_res));
22739         COption_WriteableScoreZ_free(_res_conv);
22740 }
22741
22742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1ok(JNIEnv *env, jclass clz) {
22743         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
22744         *ret_conv = CResult_NoneIOErrorZ_ok();
22745         return tag_ptr(ret_conv, true);
22746 }
22747
22748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
22749         LDKIOError e_conv = LDKIOError_from_java(env, e);
22750         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
22751         *ret_conv = CResult_NoneIOErrorZ_err(e_conv);
22752         return tag_ptr(ret_conv, true);
22753 }
22754
22755 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22756         LDKCResult_NoneIOErrorZ* o_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(o);
22757         jboolean ret_conv = CResult_NoneIOErrorZ_is_ok(o_conv);
22758         return ret_conv;
22759 }
22760
22761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_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_NoneIOErrorZ _res_conv = *(LDKCResult_NoneIOErrorZ*)(_res_ptr);
22766         FREE(untag_ptr(_res));
22767         CResult_NoneIOErrorZ_free(_res_conv);
22768 }
22769
22770 static inline uint64_t CResult_NoneIOErrorZ_clone_ptr(LDKCResult_NoneIOErrorZ *NONNULL_PTR arg) {
22771         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
22772         *ret_conv = CResult_NoneIOErrorZ_clone(arg);
22773         return tag_ptr(ret_conv, true);
22774 }
22775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22776         LDKCResult_NoneIOErrorZ* arg_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(arg);
22777         int64_t ret_conv = CResult_NoneIOErrorZ_clone_ptr(arg_conv);
22778         return ret_conv;
22779 }
22780
22781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22782         LDKCResult_NoneIOErrorZ* orig_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(orig);
22783         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
22784         *ret_conv = CResult_NoneIOErrorZ_clone(orig_conv);
22785         return tag_ptr(ret_conv, true);
22786 }
22787
22788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22789         LDKCVec_ChannelDetailsZ _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(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
22793         else
22794                 _res_constr.data = NULL;
22795         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22796         for (size_t q = 0; q < _res_constr.datalen; q++) {
22797                 int64_t _res_conv_16 = _res_vals[q];
22798                 LDKChannelDetails _res_conv_16_conv;
22799                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
22800                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
22801                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
22802                 _res_constr.data[q] = _res_conv_16_conv;
22803         }
22804         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22805         CVec_ChannelDetailsZ_free(_res_constr);
22806 }
22807
22808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22809         LDKRoute o_conv;
22810         o_conv.inner = untag_ptr(o);
22811         o_conv.is_owned = ptr_is_owned(o);
22812         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22813         o_conv = Route_clone(&o_conv);
22814         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
22815         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
22816         return tag_ptr(ret_conv, true);
22817 }
22818
22819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22820         LDKLightningError e_conv;
22821         e_conv.inner = untag_ptr(e);
22822         e_conv.is_owned = ptr_is_owned(e);
22823         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22824         e_conv = LightningError_clone(&e_conv);
22825         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
22826         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
22827         return tag_ptr(ret_conv, true);
22828 }
22829
22830 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22831         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
22832         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
22833         return ret_conv;
22834 }
22835
22836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22837         if (!ptr_is_owned(_res)) return;
22838         void* _res_ptr = untag_ptr(_res);
22839         CHECK_ACCESS(_res_ptr);
22840         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
22841         FREE(untag_ptr(_res));
22842         CResult_RouteLightningErrorZ_free(_res_conv);
22843 }
22844
22845 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
22846         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
22847         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
22848         return tag_ptr(ret_conv, true);
22849 }
22850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22851         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
22852         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
22853         return ret_conv;
22854 }
22855
22856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22857         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
22858         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
22859         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
22860         return tag_ptr(ret_conv, true);
22861 }
22862
22863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22864         LDKInFlightHtlcs o_conv;
22865         o_conv.inner = untag_ptr(o);
22866         o_conv.is_owned = ptr_is_owned(o);
22867         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22868         o_conv = InFlightHtlcs_clone(&o_conv);
22869         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
22870         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
22871         return tag_ptr(ret_conv, true);
22872 }
22873
22874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22875         void* e_ptr = untag_ptr(e);
22876         CHECK_ACCESS(e_ptr);
22877         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22878         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22879         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
22880         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
22881         return tag_ptr(ret_conv, true);
22882 }
22883
22884 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22885         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
22886         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
22887         return ret_conv;
22888 }
22889
22890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22891         if (!ptr_is_owned(_res)) return;
22892         void* _res_ptr = untag_ptr(_res);
22893         CHECK_ACCESS(_res_ptr);
22894         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
22895         FREE(untag_ptr(_res));
22896         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
22897 }
22898
22899 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
22900         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
22901         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
22902         return tag_ptr(ret_conv, true);
22903 }
22904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22905         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
22906         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
22907         return ret_conv;
22908 }
22909
22910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22911         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
22912         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
22913         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
22914         return tag_ptr(ret_conv, true);
22915 }
22916
22917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22918         LDKRouteHop o_conv;
22919         o_conv.inner = untag_ptr(o);
22920         o_conv.is_owned = ptr_is_owned(o);
22921         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22922         o_conv = RouteHop_clone(&o_conv);
22923         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
22924         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
22925         return tag_ptr(ret_conv, true);
22926 }
22927
22928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22929         void* e_ptr = untag_ptr(e);
22930         CHECK_ACCESS(e_ptr);
22931         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22932         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22933         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
22934         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
22935         return tag_ptr(ret_conv, true);
22936 }
22937
22938 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22939         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
22940         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
22941         return ret_conv;
22942 }
22943
22944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22945         if (!ptr_is_owned(_res)) return;
22946         void* _res_ptr = untag_ptr(_res);
22947         CHECK_ACCESS(_res_ptr);
22948         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
22949         FREE(untag_ptr(_res));
22950         CResult_RouteHopDecodeErrorZ_free(_res_conv);
22951 }
22952
22953 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
22954         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
22955         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
22956         return tag_ptr(ret_conv, true);
22957 }
22958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22959         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
22960         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
22961         return ret_conv;
22962 }
22963
22964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22965         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
22966         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
22967         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
22968         return tag_ptr(ret_conv, true);
22969 }
22970
22971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BlindedHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22972         LDKCVec_BlindedHopZ _res_constr;
22973         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22974         if (_res_constr.datalen > 0)
22975                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
22976         else
22977                 _res_constr.data = NULL;
22978         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22979         for (size_t m = 0; m < _res_constr.datalen; m++) {
22980                 int64_t _res_conv_12 = _res_vals[m];
22981                 LDKBlindedHop _res_conv_12_conv;
22982                 _res_conv_12_conv.inner = untag_ptr(_res_conv_12);
22983                 _res_conv_12_conv.is_owned = ptr_is_owned(_res_conv_12);
22984                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv);
22985                 _res_constr.data[m] = _res_conv_12_conv;
22986         }
22987         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22988         CVec_BlindedHopZ_free(_res_constr);
22989 }
22990
22991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22992         LDKBlindedTail o_conv;
22993         o_conv.inner = untag_ptr(o);
22994         o_conv.is_owned = ptr_is_owned(o);
22995         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22996         o_conv = BlindedTail_clone(&o_conv);
22997         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
22998         *ret_conv = CResult_BlindedTailDecodeErrorZ_ok(o_conv);
22999         return tag_ptr(ret_conv, true);
23000 }
23001
23002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23003         void* e_ptr = untag_ptr(e);
23004         CHECK_ACCESS(e_ptr);
23005         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23006         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23007         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
23008         *ret_conv = CResult_BlindedTailDecodeErrorZ_err(e_conv);
23009         return tag_ptr(ret_conv, true);
23010 }
23011
23012 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23013         LDKCResult_BlindedTailDecodeErrorZ* o_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(o);
23014         jboolean ret_conv = CResult_BlindedTailDecodeErrorZ_is_ok(o_conv);
23015         return ret_conv;
23016 }
23017
23018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23019         if (!ptr_is_owned(_res)) return;
23020         void* _res_ptr = untag_ptr(_res);
23021         CHECK_ACCESS(_res_ptr);
23022         LDKCResult_BlindedTailDecodeErrorZ _res_conv = *(LDKCResult_BlindedTailDecodeErrorZ*)(_res_ptr);
23023         FREE(untag_ptr(_res));
23024         CResult_BlindedTailDecodeErrorZ_free(_res_conv);
23025 }
23026
23027 static inline uint64_t CResult_BlindedTailDecodeErrorZ_clone_ptr(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR arg) {
23028         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
23029         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(arg);
23030         return tag_ptr(ret_conv, true);
23031 }
23032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23033         LDKCResult_BlindedTailDecodeErrorZ* arg_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(arg);
23034         int64_t ret_conv = CResult_BlindedTailDecodeErrorZ_clone_ptr(arg_conv);
23035         return ret_conv;
23036 }
23037
23038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23039         LDKCResult_BlindedTailDecodeErrorZ* orig_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(orig);
23040         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
23041         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(orig_conv);
23042         return tag_ptr(ret_conv, true);
23043 }
23044
23045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23046         LDKCVec_RouteHopZ _res_constr;
23047         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23048         if (_res_constr.datalen > 0)
23049                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23050         else
23051                 _res_constr.data = NULL;
23052         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23053         for (size_t k = 0; k < _res_constr.datalen; k++) {
23054                 int64_t _res_conv_10 = _res_vals[k];
23055                 LDKRouteHop _res_conv_10_conv;
23056                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
23057                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
23058                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
23059                 _res_constr.data[k] = _res_conv_10_conv;
23060         }
23061         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23062         CVec_RouteHopZ_free(_res_constr);
23063 }
23064
23065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PathZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23066         LDKCVec_PathZ _res_constr;
23067         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23068         if (_res_constr.datalen > 0)
23069                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
23070         else
23071                 _res_constr.data = NULL;
23072         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23073         for (size_t g = 0; g < _res_constr.datalen; g++) {
23074                 int64_t _res_conv_6 = _res_vals[g];
23075                 LDKPath _res_conv_6_conv;
23076                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
23077                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
23078                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
23079                 _res_constr.data[g] = _res_conv_6_conv;
23080         }
23081         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23082         CVec_PathZ_free(_res_constr);
23083 }
23084
23085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23086         LDKRoute o_conv;
23087         o_conv.inner = untag_ptr(o);
23088         o_conv.is_owned = ptr_is_owned(o);
23089         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23090         o_conv = Route_clone(&o_conv);
23091         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
23092         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
23093         return tag_ptr(ret_conv, true);
23094 }
23095
23096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23097         void* e_ptr = untag_ptr(e);
23098         CHECK_ACCESS(e_ptr);
23099         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23100         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23101         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
23102         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
23103         return tag_ptr(ret_conv, true);
23104 }
23105
23106 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23107         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
23108         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
23109         return ret_conv;
23110 }
23111
23112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23113         if (!ptr_is_owned(_res)) return;
23114         void* _res_ptr = untag_ptr(_res);
23115         CHECK_ACCESS(_res_ptr);
23116         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
23117         FREE(untag_ptr(_res));
23118         CResult_RouteDecodeErrorZ_free(_res_conv);
23119 }
23120
23121 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
23122         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
23123         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
23124         return tag_ptr(ret_conv, true);
23125 }
23126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23127         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
23128         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
23129         return ret_conv;
23130 }
23131
23132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23133         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
23134         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
23135         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
23136         return tag_ptr(ret_conv, true);
23137 }
23138
23139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23140         LDKRouteParameters o_conv;
23141         o_conv.inner = untag_ptr(o);
23142         o_conv.is_owned = ptr_is_owned(o);
23143         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23144         o_conv = RouteParameters_clone(&o_conv);
23145         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
23146         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
23147         return tag_ptr(ret_conv, true);
23148 }
23149
23150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23151         void* e_ptr = untag_ptr(e);
23152         CHECK_ACCESS(e_ptr);
23153         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23154         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23155         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
23156         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
23157         return tag_ptr(ret_conv, true);
23158 }
23159
23160 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23161         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
23162         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
23163         return ret_conv;
23164 }
23165
23166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23167         if (!ptr_is_owned(_res)) return;
23168         void* _res_ptr = untag_ptr(_res);
23169         CHECK_ACCESS(_res_ptr);
23170         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
23171         FREE(untag_ptr(_res));
23172         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
23173 }
23174
23175 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
23176         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
23177         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
23178         return tag_ptr(ret_conv, true);
23179 }
23180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23181         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
23182         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
23183         return ret_conv;
23184 }
23185
23186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23187         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
23188         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
23189         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
23190         return tag_ptr(ret_conv, true);
23191 }
23192
23193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23194         LDKCVec_u64Z _res_constr;
23195         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23196         if (_res_constr.datalen > 0)
23197                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
23198         else
23199                 _res_constr.data = NULL;
23200         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23201         for (size_t g = 0; g < _res_constr.datalen; g++) {
23202                 int64_t _res_conv_6 = _res_vals[g];
23203                 _res_constr.data[g] = _res_conv_6;
23204         }
23205         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23206         CVec_u64Z_free(_res_constr);
23207 }
23208
23209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23210         LDKPaymentParameters o_conv;
23211         o_conv.inner = untag_ptr(o);
23212         o_conv.is_owned = ptr_is_owned(o);
23213         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23214         o_conv = PaymentParameters_clone(&o_conv);
23215         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
23216         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
23217         return tag_ptr(ret_conv, true);
23218 }
23219
23220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23221         void* e_ptr = untag_ptr(e);
23222         CHECK_ACCESS(e_ptr);
23223         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23224         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23225         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
23226         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
23227         return tag_ptr(ret_conv, true);
23228 }
23229
23230 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23231         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
23232         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
23233         return ret_conv;
23234 }
23235
23236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23237         if (!ptr_is_owned(_res)) return;
23238         void* _res_ptr = untag_ptr(_res);
23239         CHECK_ACCESS(_res_ptr);
23240         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
23241         FREE(untag_ptr(_res));
23242         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
23243 }
23244
23245 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
23246         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
23247         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
23248         return tag_ptr(ret_conv, true);
23249 }
23250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23251         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
23252         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
23253         return ret_conv;
23254 }
23255
23256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23257         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
23258         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
23259         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
23260         return tag_ptr(ret_conv, true);
23261 }
23262
23263 static inline uint64_t C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR arg) {
23264         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
23265         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(arg);
23266         return tag_ptr(ret_conv, true);
23267 }
23268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23269         LDKC2Tuple_BlindedPayInfoBlindedPathZ* arg_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(arg);
23270         int64_t ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(arg_conv);
23271         return ret_conv;
23272 }
23273
23274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23275         LDKC2Tuple_BlindedPayInfoBlindedPathZ* orig_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(orig);
23276         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
23277         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig_conv);
23278         return tag_ptr(ret_conv, true);
23279 }
23280
23281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
23282         LDKBlindedPayInfo a_conv;
23283         a_conv.inner = untag_ptr(a);
23284         a_conv.is_owned = ptr_is_owned(a);
23285         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23286         a_conv = BlindedPayInfo_clone(&a_conv);
23287         LDKBlindedPath b_conv;
23288         b_conv.inner = untag_ptr(b);
23289         b_conv.is_owned = ptr_is_owned(b);
23290         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23291         b_conv = BlindedPath_clone(&b_conv);
23292         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
23293         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_new(a_conv, b_conv);
23294         return tag_ptr(ret_conv, true);
23295 }
23296
23297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23298         if (!ptr_is_owned(_res)) return;
23299         void* _res_ptr = untag_ptr(_res);
23300         CHECK_ACCESS(_res_ptr);
23301         LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_ptr);
23302         FREE(untag_ptr(_res));
23303         C2Tuple_BlindedPayInfoBlindedPathZ_free(_res_conv);
23304 }
23305
23306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23307         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res_constr;
23308         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23309         if (_res_constr.datalen > 0)
23310                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
23311         else
23312                 _res_constr.data = NULL;
23313         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23314         for (size_t l = 0; l < _res_constr.datalen; l++) {
23315                 int64_t _res_conv_37 = _res_vals[l];
23316                 void* _res_conv_37_ptr = untag_ptr(_res_conv_37);
23317                 CHECK_ACCESS(_res_conv_37_ptr);
23318                 LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_conv_37_ptr);
23319                 FREE(untag_ptr(_res_conv_37));
23320                 _res_constr.data[l] = _res_conv_37_conv;
23321         }
23322         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23323         CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res_constr);
23324 }
23325
23326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23327         LDKCVec_RouteHintZ _res_constr;
23328         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23329         if (_res_constr.datalen > 0)
23330                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
23331         else
23332                 _res_constr.data = NULL;
23333         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23334         for (size_t l = 0; l < _res_constr.datalen; l++) {
23335                 int64_t _res_conv_11 = _res_vals[l];
23336                 LDKRouteHint _res_conv_11_conv;
23337                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
23338                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
23339                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
23340                 _res_constr.data[l] = _res_conv_11_conv;
23341         }
23342         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23343         CVec_RouteHintZ_free(_res_constr);
23344 }
23345
23346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23347         LDKCVec_RouteHintHopZ _res_constr;
23348         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23349         if (_res_constr.datalen > 0)
23350                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
23351         else
23352                 _res_constr.data = NULL;
23353         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23354         for (size_t o = 0; o < _res_constr.datalen; o++) {
23355                 int64_t _res_conv_14 = _res_vals[o];
23356                 LDKRouteHintHop _res_conv_14_conv;
23357                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
23358                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
23359                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
23360                 _res_constr.data[o] = _res_conv_14_conv;
23361         }
23362         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23363         CVec_RouteHintHopZ_free(_res_constr);
23364 }
23365
23366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23367         LDKRouteHint o_conv;
23368         o_conv.inner = untag_ptr(o);
23369         o_conv.is_owned = ptr_is_owned(o);
23370         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23371         o_conv = RouteHint_clone(&o_conv);
23372         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
23373         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
23374         return tag_ptr(ret_conv, true);
23375 }
23376
23377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23378         void* e_ptr = untag_ptr(e);
23379         CHECK_ACCESS(e_ptr);
23380         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23381         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23382         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
23383         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
23384         return tag_ptr(ret_conv, true);
23385 }
23386
23387 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23388         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
23389         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
23390         return ret_conv;
23391 }
23392
23393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23394         if (!ptr_is_owned(_res)) return;
23395         void* _res_ptr = untag_ptr(_res);
23396         CHECK_ACCESS(_res_ptr);
23397         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
23398         FREE(untag_ptr(_res));
23399         CResult_RouteHintDecodeErrorZ_free(_res_conv);
23400 }
23401
23402 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
23403         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
23404         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
23405         return tag_ptr(ret_conv, true);
23406 }
23407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23408         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
23409         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
23410         return ret_conv;
23411 }
23412
23413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23414         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
23415         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
23416         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
23417         return tag_ptr(ret_conv, true);
23418 }
23419
23420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23421         LDKRouteHintHop o_conv;
23422         o_conv.inner = untag_ptr(o);
23423         o_conv.is_owned = ptr_is_owned(o);
23424         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23425         o_conv = RouteHintHop_clone(&o_conv);
23426         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
23427         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
23428         return tag_ptr(ret_conv, true);
23429 }
23430
23431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23432         void* e_ptr = untag_ptr(e);
23433         CHECK_ACCESS(e_ptr);
23434         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23435         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23436         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
23437         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
23438         return tag_ptr(ret_conv, true);
23439 }
23440
23441 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23442         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
23443         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
23444         return ret_conv;
23445 }
23446
23447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23448         if (!ptr_is_owned(_res)) return;
23449         void* _res_ptr = untag_ptr(_res);
23450         CHECK_ACCESS(_res_ptr);
23451         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
23452         FREE(untag_ptr(_res));
23453         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
23454 }
23455
23456 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
23457         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
23458         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
23459         return tag_ptr(ret_conv, true);
23460 }
23461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23462         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
23463         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
23464         return ret_conv;
23465 }
23466
23467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23468         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
23469         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
23470         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
23471         return tag_ptr(ret_conv, true);
23472 }
23473
23474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
23475         LDKCVec_PublicKeyZ _res_constr;
23476         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23477         if (_res_constr.datalen > 0)
23478                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
23479         else
23480                 _res_constr.data = NULL;
23481         for (size_t i = 0; i < _res_constr.datalen; i++) {
23482                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
23483                 LDKPublicKey _res_conv_8_ref;
23484                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
23485                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
23486                 _res_constr.data[i] = _res_conv_8_ref;
23487         }
23488         CVec_PublicKeyZ_free(_res_constr);
23489 }
23490
23491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23492         LDKFixedPenaltyScorer o_conv;
23493         o_conv.inner = untag_ptr(o);
23494         o_conv.is_owned = ptr_is_owned(o);
23495         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23496         o_conv = FixedPenaltyScorer_clone(&o_conv);
23497         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
23498         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
23499         return tag_ptr(ret_conv, true);
23500 }
23501
23502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23503         void* e_ptr = untag_ptr(e);
23504         CHECK_ACCESS(e_ptr);
23505         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23506         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23507         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
23508         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
23509         return tag_ptr(ret_conv, true);
23510 }
23511
23512 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23513         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
23514         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
23515         return ret_conv;
23516 }
23517
23518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23519         if (!ptr_is_owned(_res)) return;
23520         void* _res_ptr = untag_ptr(_res);
23521         CHECK_ACCESS(_res_ptr);
23522         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
23523         FREE(untag_ptr(_res));
23524         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
23525 }
23526
23527 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
23528         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
23529         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
23530         return tag_ptr(ret_conv, true);
23531 }
23532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23533         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
23534         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
23535         return ret_conv;
23536 }
23537
23538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23539         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
23540         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
23541         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
23542         return tag_ptr(ret_conv, true);
23543 }
23544
23545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23546         LDKCVec_NodeIdZ _res_constr;
23547         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23548         if (_res_constr.datalen > 0)
23549                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
23550         else
23551                 _res_constr.data = NULL;
23552         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23553         for (size_t i = 0; i < _res_constr.datalen; i++) {
23554                 int64_t _res_conv_8 = _res_vals[i];
23555                 LDKNodeId _res_conv_8_conv;
23556                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
23557                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
23558                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
23559                 _res_constr.data[i] = _res_conv_8_conv;
23560         }
23561         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23562         CVec_NodeIdZ_free(_res_constr);
23563 }
23564
23565 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
23566         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
23567         *ret_conv = C2Tuple_u64u64Z_clone(arg);
23568         return tag_ptr(ret_conv, true);
23569 }
23570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23571         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
23572         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
23573         return ret_conv;
23574 }
23575
23576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23577         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
23578         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
23579         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
23580         return tag_ptr(ret_conv, true);
23581 }
23582
23583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
23584         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
23585         *ret_conv = C2Tuple_u64u64Z_new(a, b);
23586         return tag_ptr(ret_conv, true);
23587 }
23588
23589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
23590         if (!ptr_is_owned(_res)) return;
23591         void* _res_ptr = untag_ptr(_res);
23592         CHECK_ACCESS(_res_ptr);
23593         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
23594         FREE(untag_ptr(_res));
23595         C2Tuple_u64u64Z_free(_res_conv);
23596 }
23597
23598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
23599         void* o_ptr = untag_ptr(o);
23600         CHECK_ACCESS(o_ptr);
23601         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
23602         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
23603         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
23604         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
23605         int64_t ret_ref = tag_ptr(ret_copy, true);
23606         return ret_ref;
23607 }
23608
23609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1none(JNIEnv *env, jclass clz) {
23610         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
23611         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
23612         int64_t ret_ref = tag_ptr(ret_copy, true);
23613         return ret_ref;
23614 }
23615
23616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23617         if (!ptr_is_owned(_res)) return;
23618         void* _res_ptr = untag_ptr(_res);
23619         CHECK_ACCESS(_res_ptr);
23620         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
23621         FREE(untag_ptr(_res));
23622         COption_C2Tuple_u64u64ZZ_free(_res_conv);
23623 }
23624
23625 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
23626         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
23627         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
23628         int64_t ret_ref = tag_ptr(ret_copy, true);
23629         return ret_ref;
23630 }
23631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23632         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
23633         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
23634         return ret_conv;
23635 }
23636
23637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23638         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
23639         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
23640         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
23641         int64_t ret_ref = tag_ptr(ret_copy, true);
23642         return ret_ref;
23643 }
23644
23645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1new(JNIEnv *env, jclass clz, int16_tArray a, int16_tArray b) {
23646         LDKThirtyTwoU16s a_ref;
23647         CHECK((*env)->GetArrayLength(env, a) == 32);
23648         (*env)->GetShortArrayRegion(env, a, 0, 32, a_ref.data);
23649         LDKThirtyTwoU16s b_ref;
23650         CHECK((*env)->GetArrayLength(env, b) == 32);
23651         (*env)->GetShortArrayRegion(env, b, 0, 32, b_ref.data);
23652         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
23653         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
23654         return tag_ptr(ret_conv, true);
23655 }
23656
23657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
23658         if (!ptr_is_owned(_res)) return;
23659         void* _res_ptr = untag_ptr(_res);
23660         CHECK_ACCESS(_res_ptr);
23661         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
23662         FREE(untag_ptr(_res));
23663         C2Tuple_Z_free(_res_conv);
23664 }
23665
23666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1new(JNIEnv *env, jclass clz, int16_tArray a, int16_tArray b) {
23667         LDKThirtyTwoU16s a_ref;
23668         CHECK((*env)->GetArrayLength(env, a) == 32);
23669         (*env)->GetShortArrayRegion(env, a, 0, 32, a_ref.data);
23670         LDKThirtyTwoU16s b_ref;
23671         CHECK((*env)->GetArrayLength(env, b) == 32);
23672         (*env)->GetShortArrayRegion(env, b, 0, 32, b_ref.data);
23673         LDKC2Tuple__u1632_u1632Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u1632_u1632Z), "LDKC2Tuple__u1632_u1632Z");
23674         *ret_conv = C2Tuple__u1632_u1632Z_new(a_ref, b_ref);
23675         return tag_ptr(ret_conv, true);
23676 }
23677
23678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
23679         if (!ptr_is_owned(_res)) return;
23680         void* _res_ptr = untag_ptr(_res);
23681         CHECK_ACCESS(_res_ptr);
23682         LDKC2Tuple__u1632_u1632Z _res_conv = *(LDKC2Tuple__u1632_u1632Z*)(_res_ptr);
23683         FREE(untag_ptr(_res));
23684         C2Tuple__u1632_u1632Z_free(_res_conv);
23685 }
23686
23687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
23688         void* o_ptr = untag_ptr(o);
23689         CHECK_ACCESS(o_ptr);
23690         LDKC2Tuple__u1632_u1632Z o_conv = *(LDKC2Tuple__u1632_u1632Z*)(o_ptr);
23691         // WARNING: we may need a move here but no clone is available for LDKC2Tuple__u1632_u1632Z
23692         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
23693         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o_conv);
23694         int64_t ret_ref = tag_ptr(ret_copy, true);
23695         return ret_ref;
23696 }
23697
23698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1none(JNIEnv *env, jclass clz) {
23699         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
23700         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none();
23701         int64_t ret_ref = tag_ptr(ret_copy, true);
23702         return ret_ref;
23703 }
23704
23705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23706         if (!ptr_is_owned(_res)) return;
23707         void* _res_ptr = untag_ptr(_res);
23708         CHECK_ACCESS(_res_ptr);
23709         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ _res_conv = *(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)(_res_ptr);
23710         FREE(untag_ptr(_res));
23711         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res_conv);
23712 }
23713
23714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1some(JNIEnv *env, jclass clz, double o) {
23715         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
23716         *ret_copy = COption_f64Z_some(o);
23717         int64_t ret_ref = tag_ptr(ret_copy, true);
23718         return ret_ref;
23719 }
23720
23721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1none(JNIEnv *env, jclass clz) {
23722         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
23723         *ret_copy = COption_f64Z_none();
23724         int64_t ret_ref = tag_ptr(ret_copy, true);
23725         return ret_ref;
23726 }
23727
23728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
23729         if (!ptr_is_owned(_res)) return;
23730         void* _res_ptr = untag_ptr(_res);
23731         CHECK_ACCESS(_res_ptr);
23732         LDKCOption_f64Z _res_conv = *(LDKCOption_f64Z*)(_res_ptr);
23733         FREE(untag_ptr(_res));
23734         COption_f64Z_free(_res_conv);
23735 }
23736
23737 static inline uint64_t COption_f64Z_clone_ptr(LDKCOption_f64Z *NONNULL_PTR arg) {
23738         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
23739         *ret_copy = COption_f64Z_clone(arg);
23740         int64_t ret_ref = tag_ptr(ret_copy, true);
23741         return ret_ref;
23742 }
23743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23744         LDKCOption_f64Z* arg_conv = (LDKCOption_f64Z*)untag_ptr(arg);
23745         int64_t ret_conv = COption_f64Z_clone_ptr(arg_conv);
23746         return ret_conv;
23747 }
23748
23749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23750         LDKCOption_f64Z* orig_conv = (LDKCOption_f64Z*)untag_ptr(orig);
23751         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
23752         *ret_copy = COption_f64Z_clone(orig_conv);
23753         int64_t ret_ref = tag_ptr(ret_copy, true);
23754         return ret_ref;
23755 }
23756
23757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23758         LDKProbabilisticScorer o_conv;
23759         o_conv.inner = untag_ptr(o);
23760         o_conv.is_owned = ptr_is_owned(o);
23761         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23762         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
23763         
23764         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
23765         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
23766         return tag_ptr(ret_conv, true);
23767 }
23768
23769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_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_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
23775         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
23776         return tag_ptr(ret_conv, true);
23777 }
23778
23779 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23780         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
23781         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
23782         return ret_conv;
23783 }
23784
23785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_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_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
23790         FREE(untag_ptr(_res));
23791         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
23792 }
23793
23794 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
23795         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
23796         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
23797         return tag_ptr(ret_conv, true);
23798 }
23799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23800         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
23801         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
23802         return ret_conv;
23803 }
23804
23805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23806         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
23807         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
23808         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
23809         return tag_ptr(ret_conv, true);
23810 }
23811
23812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
23813         LDKTransaction b_ref;
23814         b_ref.datalen = (*env)->GetArrayLength(env, b);
23815         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
23816         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
23817         b_ref.data_is_owned = true;
23818         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
23819         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
23820         return tag_ptr(ret_conv, true);
23821 }
23822
23823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23824         if (!ptr_is_owned(_res)) return;
23825         void* _res_ptr = untag_ptr(_res);
23826         CHECK_ACCESS(_res_ptr);
23827         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
23828         FREE(untag_ptr(_res));
23829         C2Tuple_usizeTransactionZ_free(_res_conv);
23830 }
23831
23832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23833         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
23834         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23835         if (_res_constr.datalen > 0)
23836                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
23837         else
23838                 _res_constr.data = NULL;
23839         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23840         for (size_t c = 0; c < _res_constr.datalen; c++) {
23841                 int64_t _res_conv_28 = _res_vals[c];
23842                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
23843                 CHECK_ACCESS(_res_conv_28_ptr);
23844                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
23845                 FREE(untag_ptr(_res_conv_28));
23846                 _res_constr.data[c] = _res_conv_28_conv;
23847         }
23848         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23849         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
23850 }
23851
23852 static inline uint64_t C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
23853         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
23854         *ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(arg);
23855         return tag_ptr(ret_conv, true);
23856 }
23857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCOption_1ThirtyTwoBytesZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23858         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(arg);
23859         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
23860         return ret_conv;
23861 }
23862
23863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCOption_1ThirtyTwoBytesZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23864         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(orig);
23865         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
23866         *ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(orig_conv);
23867         return tag_ptr(ret_conv, true);
23868 }
23869
23870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCOption_1ThirtyTwoBytesZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
23871         LDKThirtyTwoBytes a_ref;
23872         CHECK((*env)->GetArrayLength(env, a) == 32);
23873         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
23874         void* b_ptr = untag_ptr(b);
23875         CHECK_ACCESS(b_ptr);
23876         LDKCOption_ThirtyTwoBytesZ b_conv = *(LDKCOption_ThirtyTwoBytesZ*)(b_ptr);
23877         b_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(b));
23878         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
23879         *ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_new(a_ref, b_conv);
23880         return tag_ptr(ret_conv, true);
23881 }
23882
23883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCOption_1ThirtyTwoBytesZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23884         if (!ptr_is_owned(_res)) return;
23885         void* _res_ptr = untag_ptr(_res);
23886         CHECK_ACCESS(_res_ptr);
23887         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)(_res_ptr);
23888         FREE(untag_ptr(_res));
23889         C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_free(_res_conv);
23890 }
23891
23892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesCOption_1ThirtyTwoBytesZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23893         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ _res_constr;
23894         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23895         if (_res_constr.datalen > 0)
23896                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ Elements");
23897         else
23898                 _res_constr.data = NULL;
23899         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23900         for (size_t x = 0; x < _res_constr.datalen; x++) {
23901                 int64_t _res_conv_49 = _res_vals[x];
23902                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
23903                 CHECK_ACCESS(_res_conv_49_ptr);
23904                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ _res_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)(_res_conv_49_ptr);
23905                 FREE(untag_ptr(_res_conv_49));
23906                 _res_constr.data[x] = _res_conv_49_conv;
23907         }
23908         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23909         CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_free(_res_constr);
23910 }
23911
23912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) {
23913         LDKChannelMonitorUpdateStatus o_conv = LDKChannelMonitorUpdateStatus_from_java(env, o);
23914         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
23915         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_ok(o_conv);
23916         return tag_ptr(ret_conv, true);
23917 }
23918
23919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1err(JNIEnv *env, jclass clz) {
23920         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
23921         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_err();
23922         return tag_ptr(ret_conv, true);
23923 }
23924
23925 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23926         LDKCResult_ChannelMonitorUpdateStatusNoneZ* o_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(o);
23927         jboolean ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o_conv);
23928         return ret_conv;
23929 }
23930
23931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23932         if (!ptr_is_owned(_res)) return;
23933         void* _res_ptr = untag_ptr(_res);
23934         CHECK_ACCESS(_res_ptr);
23935         LDKCResult_ChannelMonitorUpdateStatusNoneZ _res_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(_res_ptr);
23936         FREE(untag_ptr(_res));
23937         CResult_ChannelMonitorUpdateStatusNoneZ_free(_res_conv);
23938 }
23939
23940 static inline uint64_t CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR arg) {
23941         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
23942         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(arg);
23943         return tag_ptr(ret_conv, true);
23944 }
23945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23946         LDKCResult_ChannelMonitorUpdateStatusNoneZ* arg_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(arg);
23947         int64_t ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(arg_conv);
23948         return ret_conv;
23949 }
23950
23951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23952         LDKCResult_ChannelMonitorUpdateStatusNoneZ* orig_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(orig);
23953         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
23954         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig_conv);
23955         return tag_ptr(ret_conv, true);
23956 }
23957
23958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23959         LDKCVec_MonitorEventZ _res_constr;
23960         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23961         if (_res_constr.datalen > 0)
23962                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
23963         else
23964                 _res_constr.data = NULL;
23965         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23966         for (size_t o = 0; o < _res_constr.datalen; o++) {
23967                 int64_t _res_conv_14 = _res_vals[o];
23968                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
23969                 CHECK_ACCESS(_res_conv_14_ptr);
23970                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
23971                 FREE(untag_ptr(_res_conv_14));
23972                 _res_constr.data[o] = _res_conv_14_conv;
23973         }
23974         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23975         CVec_MonitorEventZ_free(_res_constr);
23976 }
23977
23978 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
23979         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
23980         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
23981         return tag_ptr(ret_conv, true);
23982 }
23983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23984         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
23985         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
23986         return ret_conv;
23987 }
23988
23989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23990         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
23991         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
23992         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
23993         return tag_ptr(ret_conv, true);
23994 }
23995
23996 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) {
23997         LDKOutPoint a_conv;
23998         a_conv.inner = untag_ptr(a);
23999         a_conv.is_owned = ptr_is_owned(a);
24000         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24001         a_conv = OutPoint_clone(&a_conv);
24002         LDKCVec_MonitorEventZ b_constr;
24003         b_constr.datalen = (*env)->GetArrayLength(env, b);
24004         if (b_constr.datalen > 0)
24005                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
24006         else
24007                 b_constr.data = NULL;
24008         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
24009         for (size_t o = 0; o < b_constr.datalen; o++) {
24010                 int64_t b_conv_14 = b_vals[o];
24011                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
24012                 CHECK_ACCESS(b_conv_14_ptr);
24013                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
24014                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
24015                 b_constr.data[o] = b_conv_14_conv;
24016         }
24017         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
24018         LDKPublicKey c_ref;
24019         CHECK((*env)->GetArrayLength(env, c) == 33);
24020         (*env)->GetByteArrayRegion(env, c, 0, 33, c_ref.compressed_form);
24021         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
24022         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
24023         return tag_ptr(ret_conv, true);
24024 }
24025
24026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24027         if (!ptr_is_owned(_res)) return;
24028         void* _res_ptr = untag_ptr(_res);
24029         CHECK_ACCESS(_res_ptr);
24030         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
24031         FREE(untag_ptr(_res));
24032         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
24033 }
24034
24035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24036         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
24037         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24038         if (_res_constr.datalen > 0)
24039                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
24040         else
24041                 _res_constr.data = NULL;
24042         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24043         for (size_t x = 0; x < _res_constr.datalen; x++) {
24044                 int64_t _res_conv_49 = _res_vals[x];
24045                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
24046                 CHECK_ACCESS(_res_conv_49_ptr);
24047                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
24048                 FREE(untag_ptr(_res_conv_49));
24049                 _res_constr.data[x] = _res_conv_49_conv;
24050         }
24051         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24052         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
24053 }
24054
24055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24056         LDKInitFeatures o_conv;
24057         o_conv.inner = untag_ptr(o);
24058         o_conv.is_owned = ptr_is_owned(o);
24059         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24060         o_conv = InitFeatures_clone(&o_conv);
24061         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
24062         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
24063         return tag_ptr(ret_conv, true);
24064 }
24065
24066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24067         void* e_ptr = untag_ptr(e);
24068         CHECK_ACCESS(e_ptr);
24069         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24070         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24071         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
24072         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
24073         return tag_ptr(ret_conv, true);
24074 }
24075
24076 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24077         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
24078         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
24079         return ret_conv;
24080 }
24081
24082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24083         if (!ptr_is_owned(_res)) return;
24084         void* _res_ptr = untag_ptr(_res);
24085         CHECK_ACCESS(_res_ptr);
24086         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
24087         FREE(untag_ptr(_res));
24088         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
24089 }
24090
24091 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
24092         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
24093         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
24094         return tag_ptr(ret_conv, true);
24095 }
24096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24097         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
24098         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
24099         return ret_conv;
24100 }
24101
24102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24103         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
24104         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
24105         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
24106         return tag_ptr(ret_conv, true);
24107 }
24108
24109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24110         LDKChannelFeatures o_conv;
24111         o_conv.inner = untag_ptr(o);
24112         o_conv.is_owned = ptr_is_owned(o);
24113         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24114         o_conv = ChannelFeatures_clone(&o_conv);
24115         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
24116         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
24117         return tag_ptr(ret_conv, true);
24118 }
24119
24120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24121         void* e_ptr = untag_ptr(e);
24122         CHECK_ACCESS(e_ptr);
24123         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24124         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24125         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
24126         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
24127         return tag_ptr(ret_conv, true);
24128 }
24129
24130 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24131         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
24132         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
24133         return ret_conv;
24134 }
24135
24136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24137         if (!ptr_is_owned(_res)) return;
24138         void* _res_ptr = untag_ptr(_res);
24139         CHECK_ACCESS(_res_ptr);
24140         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
24141         FREE(untag_ptr(_res));
24142         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
24143 }
24144
24145 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
24146         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
24147         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
24148         return tag_ptr(ret_conv, true);
24149 }
24150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24151         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
24152         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
24153         return ret_conv;
24154 }
24155
24156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24157         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
24158         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
24159         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
24160         return tag_ptr(ret_conv, true);
24161 }
24162
24163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24164         LDKNodeFeatures o_conv;
24165         o_conv.inner = untag_ptr(o);
24166         o_conv.is_owned = ptr_is_owned(o);
24167         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24168         o_conv = NodeFeatures_clone(&o_conv);
24169         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
24170         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
24171         return tag_ptr(ret_conv, true);
24172 }
24173
24174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24175         void* e_ptr = untag_ptr(e);
24176         CHECK_ACCESS(e_ptr);
24177         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24178         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24179         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
24180         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
24181         return tag_ptr(ret_conv, true);
24182 }
24183
24184 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24185         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
24186         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
24187         return ret_conv;
24188 }
24189
24190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24191         if (!ptr_is_owned(_res)) return;
24192         void* _res_ptr = untag_ptr(_res);
24193         CHECK_ACCESS(_res_ptr);
24194         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
24195         FREE(untag_ptr(_res));
24196         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
24197 }
24198
24199 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
24200         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
24201         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
24202         return tag_ptr(ret_conv, true);
24203 }
24204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24205         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
24206         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
24207         return ret_conv;
24208 }
24209
24210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24211         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
24212         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
24213         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
24214         return tag_ptr(ret_conv, true);
24215 }
24216
24217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24218         LDKBolt11InvoiceFeatures o_conv;
24219         o_conv.inner = untag_ptr(o);
24220         o_conv.is_owned = ptr_is_owned(o);
24221         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24222         o_conv = Bolt11InvoiceFeatures_clone(&o_conv);
24223         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
24224         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o_conv);
24225         return tag_ptr(ret_conv, true);
24226 }
24227
24228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24229         void* e_ptr = untag_ptr(e);
24230         CHECK_ACCESS(e_ptr);
24231         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24232         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24233         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
24234         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e_conv);
24235         return tag_ptr(ret_conv, true);
24236 }
24237
24238 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24239         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
24240         jboolean ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
24241         return ret_conv;
24242 }
24243
24244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24245         if (!ptr_is_owned(_res)) return;
24246         void* _res_ptr = untag_ptr(_res);
24247         CHECK_ACCESS(_res_ptr);
24248         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
24249         FREE(untag_ptr(_res));
24250         CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res_conv);
24251 }
24252
24253 static inline uint64_t CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
24254         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
24255         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(arg);
24256         return tag_ptr(ret_conv, true);
24257 }
24258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24259         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
24260         int64_t ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
24261         return ret_conv;
24262 }
24263
24264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24265         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
24266         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
24267         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
24268         return tag_ptr(ret_conv, true);
24269 }
24270
24271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24272         LDKBolt12InvoiceFeatures o_conv;
24273         o_conv.inner = untag_ptr(o);
24274         o_conv.is_owned = ptr_is_owned(o);
24275         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24276         o_conv = Bolt12InvoiceFeatures_clone(&o_conv);
24277         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
24278         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o_conv);
24279         return tag_ptr(ret_conv, true);
24280 }
24281
24282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24283         void* e_ptr = untag_ptr(e);
24284         CHECK_ACCESS(e_ptr);
24285         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24286         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24287         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
24288         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e_conv);
24289         return tag_ptr(ret_conv, true);
24290 }
24291
24292 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24293         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
24294         jboolean ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
24295         return ret_conv;
24296 }
24297
24298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24299         if (!ptr_is_owned(_res)) return;
24300         void* _res_ptr = untag_ptr(_res);
24301         CHECK_ACCESS(_res_ptr);
24302         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
24303         FREE(untag_ptr(_res));
24304         CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res_conv);
24305 }
24306
24307 static inline uint64_t CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
24308         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
24309         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(arg);
24310         return tag_ptr(ret_conv, true);
24311 }
24312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24313         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
24314         int64_t ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
24315         return ret_conv;
24316 }
24317
24318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24319         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
24320         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
24321         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
24322         return tag_ptr(ret_conv, true);
24323 }
24324
24325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24326         LDKBlindedHopFeatures o_conv;
24327         o_conv.inner = untag_ptr(o);
24328         o_conv.is_owned = ptr_is_owned(o);
24329         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24330         o_conv = BlindedHopFeatures_clone(&o_conv);
24331         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
24332         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
24333         return tag_ptr(ret_conv, true);
24334 }
24335
24336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24337         void* e_ptr = untag_ptr(e);
24338         CHECK_ACCESS(e_ptr);
24339         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24340         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24341         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
24342         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
24343         return tag_ptr(ret_conv, true);
24344 }
24345
24346 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24347         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
24348         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
24349         return ret_conv;
24350 }
24351
24352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24353         if (!ptr_is_owned(_res)) return;
24354         void* _res_ptr = untag_ptr(_res);
24355         CHECK_ACCESS(_res_ptr);
24356         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
24357         FREE(untag_ptr(_res));
24358         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
24359 }
24360
24361 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
24362         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
24363         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
24364         return tag_ptr(ret_conv, true);
24365 }
24366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24367         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
24368         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
24369         return ret_conv;
24370 }
24371
24372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24373         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
24374         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
24375         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
24376         return tag_ptr(ret_conv, true);
24377 }
24378
24379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24380         LDKChannelTypeFeatures o_conv;
24381         o_conv.inner = untag_ptr(o);
24382         o_conv.is_owned = ptr_is_owned(o);
24383         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24384         o_conv = ChannelTypeFeatures_clone(&o_conv);
24385         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
24386         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
24387         return tag_ptr(ret_conv, true);
24388 }
24389
24390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24391         void* e_ptr = untag_ptr(e);
24392         CHECK_ACCESS(e_ptr);
24393         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24394         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24395         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
24396         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
24397         return tag_ptr(ret_conv, true);
24398 }
24399
24400 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24401         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
24402         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
24403         return ret_conv;
24404 }
24405
24406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24407         if (!ptr_is_owned(_res)) return;
24408         void* _res_ptr = untag_ptr(_res);
24409         CHECK_ACCESS(_res_ptr);
24410         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
24411         FREE(untag_ptr(_res));
24412         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
24413 }
24414
24415 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
24416         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
24417         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
24418         return tag_ptr(ret_conv, true);
24419 }
24420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24421         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
24422         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
24423         return ret_conv;
24424 }
24425
24426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24427         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
24428         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
24429         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
24430         return tag_ptr(ret_conv, true);
24431 }
24432
24433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24434         LDKOffer o_conv;
24435         o_conv.inner = untag_ptr(o);
24436         o_conv.is_owned = ptr_is_owned(o);
24437         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24438         o_conv = Offer_clone(&o_conv);
24439         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
24440         *ret_conv = CResult_OfferBolt12ParseErrorZ_ok(o_conv);
24441         return tag_ptr(ret_conv, true);
24442 }
24443
24444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24445         LDKBolt12ParseError e_conv;
24446         e_conv.inner = untag_ptr(e);
24447         e_conv.is_owned = ptr_is_owned(e);
24448         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24449         e_conv = Bolt12ParseError_clone(&e_conv);
24450         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
24451         *ret_conv = CResult_OfferBolt12ParseErrorZ_err(e_conv);
24452         return tag_ptr(ret_conv, true);
24453 }
24454
24455 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24456         LDKCResult_OfferBolt12ParseErrorZ* o_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(o);
24457         jboolean ret_conv = CResult_OfferBolt12ParseErrorZ_is_ok(o_conv);
24458         return ret_conv;
24459 }
24460
24461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24462         if (!ptr_is_owned(_res)) return;
24463         void* _res_ptr = untag_ptr(_res);
24464         CHECK_ACCESS(_res_ptr);
24465         LDKCResult_OfferBolt12ParseErrorZ _res_conv = *(LDKCResult_OfferBolt12ParseErrorZ*)(_res_ptr);
24466         FREE(untag_ptr(_res));
24467         CResult_OfferBolt12ParseErrorZ_free(_res_conv);
24468 }
24469
24470 static inline uint64_t CResult_OfferBolt12ParseErrorZ_clone_ptr(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR arg) {
24471         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
24472         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(arg);
24473         return tag_ptr(ret_conv, true);
24474 }
24475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24476         LDKCResult_OfferBolt12ParseErrorZ* arg_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(arg);
24477         int64_t ret_conv = CResult_OfferBolt12ParseErrorZ_clone_ptr(arg_conv);
24478         return ret_conv;
24479 }
24480
24481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24482         LDKCResult_OfferBolt12ParseErrorZ* orig_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(orig);
24483         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
24484         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(orig_conv);
24485         return tag_ptr(ret_conv, true);
24486 }
24487
24488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
24489         LDKPublicKey o_ref;
24490         CHECK((*env)->GetArrayLength(env, o) == 33);
24491         (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
24492         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
24493         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_ok(o_ref);
24494         return tag_ptr(ret_conv, true);
24495 }
24496
24497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
24498         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
24499         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
24500         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_err(e_conv);
24501         return tag_ptr(ret_conv, true);
24502 }
24503
24504 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24505         LDKCResult_PublicKeySecp256k1ErrorZ* o_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(o);
24506         jboolean ret_conv = CResult_PublicKeySecp256k1ErrorZ_is_ok(o_conv);
24507         return ret_conv;
24508 }
24509
24510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24511         if (!ptr_is_owned(_res)) return;
24512         void* _res_ptr = untag_ptr(_res);
24513         CHECK_ACCESS(_res_ptr);
24514         LDKCResult_PublicKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(_res_ptr);
24515         FREE(untag_ptr(_res));
24516         CResult_PublicKeySecp256k1ErrorZ_free(_res_conv);
24517 }
24518
24519 static inline uint64_t CResult_PublicKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR arg) {
24520         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
24521         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(arg);
24522         return tag_ptr(ret_conv, true);
24523 }
24524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24525         LDKCResult_PublicKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(arg);
24526         int64_t ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone_ptr(arg_conv);
24527         return ret_conv;
24528 }
24529
24530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24531         LDKCResult_PublicKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(orig);
24532         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
24533         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(orig_conv);
24534         return tag_ptr(ret_conv, true);
24535 }
24536
24537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24538         LDKNodeId o_conv;
24539         o_conv.inner = untag_ptr(o);
24540         o_conv.is_owned = ptr_is_owned(o);
24541         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24542         o_conv = NodeId_clone(&o_conv);
24543         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
24544         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
24545         return tag_ptr(ret_conv, true);
24546 }
24547
24548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24549         void* e_ptr = untag_ptr(e);
24550         CHECK_ACCESS(e_ptr);
24551         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24552         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24553         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
24554         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
24555         return tag_ptr(ret_conv, true);
24556 }
24557
24558 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24559         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
24560         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
24561         return ret_conv;
24562 }
24563
24564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24565         if (!ptr_is_owned(_res)) return;
24566         void* _res_ptr = untag_ptr(_res);
24567         CHECK_ACCESS(_res_ptr);
24568         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
24569         FREE(untag_ptr(_res));
24570         CResult_NodeIdDecodeErrorZ_free(_res_conv);
24571 }
24572
24573 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
24574         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
24575         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
24576         return tag_ptr(ret_conv, true);
24577 }
24578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24579         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
24580         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
24581         return ret_conv;
24582 }
24583
24584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24585         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
24586         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
24587         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
24588         return tag_ptr(ret_conv, true);
24589 }
24590
24591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
24592         void* o_ptr = untag_ptr(o);
24593         CHECK_ACCESS(o_ptr);
24594         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
24595         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
24596         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
24597         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
24598         int64_t ret_ref = tag_ptr(ret_copy, true);
24599         return ret_ref;
24600 }
24601
24602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
24603         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
24604         *ret_copy = COption_NetworkUpdateZ_none();
24605         int64_t ret_ref = tag_ptr(ret_copy, true);
24606         return ret_ref;
24607 }
24608
24609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24610         if (!ptr_is_owned(_res)) return;
24611         void* _res_ptr = untag_ptr(_res);
24612         CHECK_ACCESS(_res_ptr);
24613         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
24614         FREE(untag_ptr(_res));
24615         COption_NetworkUpdateZ_free(_res_conv);
24616 }
24617
24618 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
24619         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
24620         *ret_copy = COption_NetworkUpdateZ_clone(arg);
24621         int64_t ret_ref = tag_ptr(ret_copy, true);
24622         return ret_ref;
24623 }
24624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24625         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
24626         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
24627         return ret_conv;
24628 }
24629
24630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24631         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
24632         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
24633         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
24634         int64_t ret_ref = tag_ptr(ret_copy, true);
24635         return ret_ref;
24636 }
24637
24638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24639         void* o_ptr = untag_ptr(o);
24640         CHECK_ACCESS(o_ptr);
24641         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
24642         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
24643         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
24644         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
24645         return tag_ptr(ret_conv, true);
24646 }
24647
24648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24649         void* e_ptr = untag_ptr(e);
24650         CHECK_ACCESS(e_ptr);
24651         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24652         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24653         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
24654         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
24655         return tag_ptr(ret_conv, true);
24656 }
24657
24658 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24659         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
24660         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
24661         return ret_conv;
24662 }
24663
24664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24665         if (!ptr_is_owned(_res)) return;
24666         void* _res_ptr = untag_ptr(_res);
24667         CHECK_ACCESS(_res_ptr);
24668         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
24669         FREE(untag_ptr(_res));
24670         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
24671 }
24672
24673 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
24674         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
24675         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
24676         return tag_ptr(ret_conv, true);
24677 }
24678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24679         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
24680         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
24681         return ret_conv;
24682 }
24683
24684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24685         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
24686         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
24687         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
24688         return tag_ptr(ret_conv, true);
24689 }
24690
24691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1some(JNIEnv *env, jclass clz, int64_t o) {
24692         void* o_ptr = untag_ptr(o);
24693         CHECK_ACCESS(o_ptr);
24694         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
24695         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
24696                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24697                 LDKUtxoLookup_JCalls_cloned(&o_conv);
24698         }
24699         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
24700         *ret_copy = COption_UtxoLookupZ_some(o_conv);
24701         int64_t ret_ref = tag_ptr(ret_copy, true);
24702         return ret_ref;
24703 }
24704
24705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1none(JNIEnv *env, jclass clz) {
24706         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
24707         *ret_copy = COption_UtxoLookupZ_none();
24708         int64_t ret_ref = tag_ptr(ret_copy, true);
24709         return ret_ref;
24710 }
24711
24712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24713         if (!ptr_is_owned(_res)) return;
24714         void* _res_ptr = untag_ptr(_res);
24715         CHECK_ACCESS(_res_ptr);
24716         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
24717         FREE(untag_ptr(_res));
24718         COption_UtxoLookupZ_free(_res_conv);
24719 }
24720
24721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
24722         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24723         *ret_conv = CResult_NoneLightningErrorZ_ok();
24724         return tag_ptr(ret_conv, true);
24725 }
24726
24727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24728         LDKLightningError e_conv;
24729         e_conv.inner = untag_ptr(e);
24730         e_conv.is_owned = ptr_is_owned(e);
24731         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24732         e_conv = LightningError_clone(&e_conv);
24733         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24734         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
24735         return tag_ptr(ret_conv, true);
24736 }
24737
24738 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24739         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
24740         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
24741         return ret_conv;
24742 }
24743
24744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24745         if (!ptr_is_owned(_res)) return;
24746         void* _res_ptr = untag_ptr(_res);
24747         CHECK_ACCESS(_res_ptr);
24748         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
24749         FREE(untag_ptr(_res));
24750         CResult_NoneLightningErrorZ_free(_res_conv);
24751 }
24752
24753 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
24754         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24755         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
24756         return tag_ptr(ret_conv, true);
24757 }
24758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24759         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
24760         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
24761         return ret_conv;
24762 }
24763
24764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24765         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
24766         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24767         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
24768         return tag_ptr(ret_conv, true);
24769 }
24770
24771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
24772         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
24773         *ret_conv = CResult_boolLightningErrorZ_ok(o);
24774         return tag_ptr(ret_conv, true);
24775 }
24776
24777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24778         LDKLightningError e_conv;
24779         e_conv.inner = untag_ptr(e);
24780         e_conv.is_owned = ptr_is_owned(e);
24781         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24782         e_conv = LightningError_clone(&e_conv);
24783         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
24784         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
24785         return tag_ptr(ret_conv, true);
24786 }
24787
24788 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24789         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
24790         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
24791         return ret_conv;
24792 }
24793
24794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_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_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
24799         FREE(untag_ptr(_res));
24800         CResult_boolLightningErrorZ_free(_res_conv);
24801 }
24802
24803 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
24804         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
24805         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
24806         return tag_ptr(ret_conv, true);
24807 }
24808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24809         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
24810         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
24811         return ret_conv;
24812 }
24813
24814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24815         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
24816         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
24817         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
24818         return tag_ptr(ret_conv, true);
24819 }
24820
24821 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
24822         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
24823         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
24824         return tag_ptr(ret_conv, true);
24825 }
24826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24827         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
24828         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
24829         return ret_conv;
24830 }
24831
24832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24833         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
24834         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
24835         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
24836         return tag_ptr(ret_conv, true);
24837 }
24838
24839 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) {
24840         LDKChannelAnnouncement a_conv;
24841         a_conv.inner = untag_ptr(a);
24842         a_conv.is_owned = ptr_is_owned(a);
24843         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24844         a_conv = ChannelAnnouncement_clone(&a_conv);
24845         LDKChannelUpdate b_conv;
24846         b_conv.inner = untag_ptr(b);
24847         b_conv.is_owned = ptr_is_owned(b);
24848         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24849         b_conv = ChannelUpdate_clone(&b_conv);
24850         LDKChannelUpdate c_conv;
24851         c_conv.inner = untag_ptr(c);
24852         c_conv.is_owned = ptr_is_owned(c);
24853         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
24854         c_conv = ChannelUpdate_clone(&c_conv);
24855         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
24856         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
24857         return tag_ptr(ret_conv, true);
24858 }
24859
24860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24861         if (!ptr_is_owned(_res)) return;
24862         void* _res_ptr = untag_ptr(_res);
24863         CHECK_ACCESS(_res_ptr);
24864         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
24865         FREE(untag_ptr(_res));
24866         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
24867 }
24868
24869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
24870         void* o_ptr = untag_ptr(o);
24871         CHECK_ACCESS(o_ptr);
24872         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
24873         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
24874         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
24875         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
24876         int64_t ret_ref = tag_ptr(ret_copy, true);
24877         return ret_ref;
24878 }
24879
24880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1none(JNIEnv *env, jclass clz) {
24881         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
24882         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
24883         int64_t ret_ref = tag_ptr(ret_copy, true);
24884         return ret_ref;
24885 }
24886
24887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24888         if (!ptr_is_owned(_res)) return;
24889         void* _res_ptr = untag_ptr(_res);
24890         CHECK_ACCESS(_res_ptr);
24891         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
24892         FREE(untag_ptr(_res));
24893         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
24894 }
24895
24896 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
24897         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
24898         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
24899         int64_t ret_ref = tag_ptr(ret_copy, true);
24900         return ret_ref;
24901 }
24902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24903         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
24904         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
24905         return ret_conv;
24906 }
24907
24908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24909         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
24910         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
24911         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
24912         int64_t ret_ref = tag_ptr(ret_copy, true);
24913         return ret_ref;
24914 }
24915
24916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24917         LDKCVec_MessageSendEventZ _res_constr;
24918         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24919         if (_res_constr.datalen > 0)
24920                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
24921         else
24922                 _res_constr.data = NULL;
24923         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24924         for (size_t s = 0; s < _res_constr.datalen; s++) {
24925                 int64_t _res_conv_18 = _res_vals[s];
24926                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
24927                 CHECK_ACCESS(_res_conv_18_ptr);
24928                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
24929                 FREE(untag_ptr(_res_conv_18));
24930                 _res_constr.data[s] = _res_conv_18_conv;
24931         }
24932         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24933         CVec_MessageSendEventZ_free(_res_constr);
24934 }
24935
24936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24937         LDKChannelUpdateInfo o_conv;
24938         o_conv.inner = untag_ptr(o);
24939         o_conv.is_owned = ptr_is_owned(o);
24940         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24941         o_conv = ChannelUpdateInfo_clone(&o_conv);
24942         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
24943         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
24944         return tag_ptr(ret_conv, true);
24945 }
24946
24947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24948         void* e_ptr = untag_ptr(e);
24949         CHECK_ACCESS(e_ptr);
24950         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24951         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24952         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
24953         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
24954         return tag_ptr(ret_conv, true);
24955 }
24956
24957 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24958         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
24959         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
24960         return ret_conv;
24961 }
24962
24963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24964         if (!ptr_is_owned(_res)) return;
24965         void* _res_ptr = untag_ptr(_res);
24966         CHECK_ACCESS(_res_ptr);
24967         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
24968         FREE(untag_ptr(_res));
24969         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
24970 }
24971
24972 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
24973         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
24974         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
24975         return tag_ptr(ret_conv, true);
24976 }
24977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24978         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
24979         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
24980         return ret_conv;
24981 }
24982
24983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24984         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
24985         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
24986         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
24987         return tag_ptr(ret_conv, true);
24988 }
24989
24990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24991         LDKChannelInfo o_conv;
24992         o_conv.inner = untag_ptr(o);
24993         o_conv.is_owned = ptr_is_owned(o);
24994         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24995         o_conv = ChannelInfo_clone(&o_conv);
24996         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
24997         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
24998         return tag_ptr(ret_conv, true);
24999 }
25000
25001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25002         void* e_ptr = untag_ptr(e);
25003         CHECK_ACCESS(e_ptr);
25004         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25005         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25006         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
25007         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
25008         return tag_ptr(ret_conv, true);
25009 }
25010
25011 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25012         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
25013         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
25014         return ret_conv;
25015 }
25016
25017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25018         if (!ptr_is_owned(_res)) return;
25019         void* _res_ptr = untag_ptr(_res);
25020         CHECK_ACCESS(_res_ptr);
25021         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
25022         FREE(untag_ptr(_res));
25023         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
25024 }
25025
25026 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
25027         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
25028         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
25029         return tag_ptr(ret_conv, true);
25030 }
25031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25032         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
25033         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
25034         return ret_conv;
25035 }
25036
25037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25038         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
25039         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
25040         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
25041         return tag_ptr(ret_conv, true);
25042 }
25043
25044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25045         LDKRoutingFees o_conv;
25046         o_conv.inner = untag_ptr(o);
25047         o_conv.is_owned = ptr_is_owned(o);
25048         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25049         o_conv = RoutingFees_clone(&o_conv);
25050         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
25051         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
25052         return tag_ptr(ret_conv, true);
25053 }
25054
25055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25056         void* e_ptr = untag_ptr(e);
25057         CHECK_ACCESS(e_ptr);
25058         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25059         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25060         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
25061         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
25062         return tag_ptr(ret_conv, true);
25063 }
25064
25065 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25066         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
25067         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
25068         return ret_conv;
25069 }
25070
25071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25072         if (!ptr_is_owned(_res)) return;
25073         void* _res_ptr = untag_ptr(_res);
25074         CHECK_ACCESS(_res_ptr);
25075         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
25076         FREE(untag_ptr(_res));
25077         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
25078 }
25079
25080 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
25081         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
25082         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
25083         return tag_ptr(ret_conv, true);
25084 }
25085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25086         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
25087         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
25088         return ret_conv;
25089 }
25090
25091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25092         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
25093         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
25094         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
25095         return tag_ptr(ret_conv, true);
25096 }
25097
25098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SocketAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25099         LDKCVec_SocketAddressZ _res_constr;
25100         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25101         if (_res_constr.datalen > 0)
25102                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
25103         else
25104                 _res_constr.data = NULL;
25105         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25106         for (size_t p = 0; p < _res_constr.datalen; p++) {
25107                 int64_t _res_conv_15 = _res_vals[p];
25108                 void* _res_conv_15_ptr = untag_ptr(_res_conv_15);
25109                 CHECK_ACCESS(_res_conv_15_ptr);
25110                 LDKSocketAddress _res_conv_15_conv = *(LDKSocketAddress*)(_res_conv_15_ptr);
25111                 FREE(untag_ptr(_res_conv_15));
25112                 _res_constr.data[p] = _res_conv_15_conv;
25113         }
25114         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25115         CVec_SocketAddressZ_free(_res_constr);
25116 }
25117
25118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25119         LDKNodeAnnouncementInfo o_conv;
25120         o_conv.inner = untag_ptr(o);
25121         o_conv.is_owned = ptr_is_owned(o);
25122         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25123         o_conv = NodeAnnouncementInfo_clone(&o_conv);
25124         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
25125         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
25126         return tag_ptr(ret_conv, true);
25127 }
25128
25129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25130         void* e_ptr = untag_ptr(e);
25131         CHECK_ACCESS(e_ptr);
25132         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25133         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25134         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
25135         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
25136         return tag_ptr(ret_conv, true);
25137 }
25138
25139 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25140         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
25141         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
25142         return ret_conv;
25143 }
25144
25145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25146         if (!ptr_is_owned(_res)) return;
25147         void* _res_ptr = untag_ptr(_res);
25148         CHECK_ACCESS(_res_ptr);
25149         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
25150         FREE(untag_ptr(_res));
25151         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
25152 }
25153
25154 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
25155         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
25156         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
25157         return tag_ptr(ret_conv, true);
25158 }
25159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25160         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
25161         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
25162         return ret_conv;
25163 }
25164
25165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25166         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
25167         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
25168         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
25169         return tag_ptr(ret_conv, true);
25170 }
25171
25172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25173         LDKNodeAlias o_conv;
25174         o_conv.inner = untag_ptr(o);
25175         o_conv.is_owned = ptr_is_owned(o);
25176         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25177         o_conv = NodeAlias_clone(&o_conv);
25178         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
25179         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
25180         return tag_ptr(ret_conv, true);
25181 }
25182
25183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25184         void* e_ptr = untag_ptr(e);
25185         CHECK_ACCESS(e_ptr);
25186         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25187         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25188         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
25189         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
25190         return tag_ptr(ret_conv, true);
25191 }
25192
25193 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25194         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
25195         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
25196         return ret_conv;
25197 }
25198
25199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25200         if (!ptr_is_owned(_res)) return;
25201         void* _res_ptr = untag_ptr(_res);
25202         CHECK_ACCESS(_res_ptr);
25203         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
25204         FREE(untag_ptr(_res));
25205         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
25206 }
25207
25208 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
25209         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
25210         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
25211         return tag_ptr(ret_conv, true);
25212 }
25213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25214         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
25215         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
25216         return ret_conv;
25217 }
25218
25219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25220         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
25221         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
25222         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
25223         return tag_ptr(ret_conv, true);
25224 }
25225
25226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25227         LDKNodeInfo o_conv;
25228         o_conv.inner = untag_ptr(o);
25229         o_conv.is_owned = ptr_is_owned(o);
25230         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25231         o_conv = NodeInfo_clone(&o_conv);
25232         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
25233         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
25234         return tag_ptr(ret_conv, true);
25235 }
25236
25237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25238         void* e_ptr = untag_ptr(e);
25239         CHECK_ACCESS(e_ptr);
25240         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25241         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25242         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
25243         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
25244         return tag_ptr(ret_conv, true);
25245 }
25246
25247 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25248         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
25249         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
25250         return ret_conv;
25251 }
25252
25253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25254         if (!ptr_is_owned(_res)) return;
25255         void* _res_ptr = untag_ptr(_res);
25256         CHECK_ACCESS(_res_ptr);
25257         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
25258         FREE(untag_ptr(_res));
25259         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
25260 }
25261
25262 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
25263         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
25264         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
25265         return tag_ptr(ret_conv, true);
25266 }
25267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25268         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
25269         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
25270         return ret_conv;
25271 }
25272
25273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25274         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
25275         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
25276         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
25277         return tag_ptr(ret_conv, true);
25278 }
25279
25280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25281         LDKNetworkGraph o_conv;
25282         o_conv.inner = untag_ptr(o);
25283         o_conv.is_owned = ptr_is_owned(o);
25284         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25285         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
25286         
25287         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
25288         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
25289         return tag_ptr(ret_conv, true);
25290 }
25291
25292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25293         void* e_ptr = untag_ptr(e);
25294         CHECK_ACCESS(e_ptr);
25295         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25296         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25297         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
25298         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
25299         return tag_ptr(ret_conv, true);
25300 }
25301
25302 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25303         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
25304         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
25305         return ret_conv;
25306 }
25307
25308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25309         if (!ptr_is_owned(_res)) return;
25310         void* _res_ptr = untag_ptr(_res);
25311         CHECK_ACCESS(_res_ptr);
25312         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
25313         FREE(untag_ptr(_res));
25314         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
25315 }
25316
25317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) {
25318         LDKCVec_SocketAddressZ o_constr;
25319         o_constr.datalen = (*env)->GetArrayLength(env, o);
25320         if (o_constr.datalen > 0)
25321                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
25322         else
25323                 o_constr.data = NULL;
25324         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
25325         for (size_t p = 0; p < o_constr.datalen; p++) {
25326                 int64_t o_conv_15 = o_vals[p];
25327                 void* o_conv_15_ptr = untag_ptr(o_conv_15);
25328                 CHECK_ACCESS(o_conv_15_ptr);
25329                 LDKSocketAddress o_conv_15_conv = *(LDKSocketAddress*)(o_conv_15_ptr);
25330                 o_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o_conv_15));
25331                 o_constr.data[p] = o_conv_15_conv;
25332         }
25333         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
25334         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
25335         *ret_copy = COption_CVec_SocketAddressZZ_some(o_constr);
25336         int64_t ret_ref = tag_ptr(ret_copy, true);
25337         return ret_ref;
25338 }
25339
25340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1none(JNIEnv *env, jclass clz) {
25341         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
25342         *ret_copy = COption_CVec_SocketAddressZZ_none();
25343         int64_t ret_ref = tag_ptr(ret_copy, true);
25344         return ret_ref;
25345 }
25346
25347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25348         if (!ptr_is_owned(_res)) return;
25349         void* _res_ptr = untag_ptr(_res);
25350         CHECK_ACCESS(_res_ptr);
25351         LDKCOption_CVec_SocketAddressZZ _res_conv = *(LDKCOption_CVec_SocketAddressZZ*)(_res_ptr);
25352         FREE(untag_ptr(_res));
25353         COption_CVec_SocketAddressZZ_free(_res_conv);
25354 }
25355
25356 static inline uint64_t COption_CVec_SocketAddressZZ_clone_ptr(LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR arg) {
25357         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
25358         *ret_copy = COption_CVec_SocketAddressZZ_clone(arg);
25359         int64_t ret_ref = tag_ptr(ret_copy, true);
25360         return ret_ref;
25361 }
25362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25363         LDKCOption_CVec_SocketAddressZZ* arg_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(arg);
25364         int64_t ret_conv = COption_CVec_SocketAddressZZ_clone_ptr(arg_conv);
25365         return ret_conv;
25366 }
25367
25368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25369         LDKCOption_CVec_SocketAddressZZ* orig_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(orig);
25370         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
25371         *ret_copy = COption_CVec_SocketAddressZZ_clone(orig_conv);
25372         int64_t ret_ref = tag_ptr(ret_copy, true);
25373         return ret_ref;
25374 }
25375
25376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25377         LDKCVec_HTLCOutputInCommitmentZ _res_constr;
25378         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25379         if (_res_constr.datalen > 0)
25380                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
25381         else
25382                 _res_constr.data = NULL;
25383         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25384         for (size_t y = 0; y < _res_constr.datalen; y++) {
25385                 int64_t _res_conv_24 = _res_vals[y];
25386                 LDKHTLCOutputInCommitment _res_conv_24_conv;
25387                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
25388                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
25389                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
25390                 _res_constr.data[y] = _res_conv_24_conv;
25391         }
25392         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25393         CVec_HTLCOutputInCommitmentZ_free(_res_constr);
25394 }
25395
25396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25397         LDKCVec_HTLCDescriptorZ _res_constr;
25398         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25399         if (_res_constr.datalen > 0)
25400                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
25401         else
25402                 _res_constr.data = NULL;
25403         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25404         for (size_t q = 0; q < _res_constr.datalen; q++) {
25405                 int64_t _res_conv_16 = _res_vals[q];
25406                 LDKHTLCDescriptor _res_conv_16_conv;
25407                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
25408                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
25409                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
25410                 _res_constr.data[q] = _res_conv_16_conv;
25411         }
25412         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25413         CVec_HTLCDescriptorZ_free(_res_constr);
25414 }
25415
25416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UtxoZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25417         LDKCVec_UtxoZ _res_constr;
25418         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25419         if (_res_constr.datalen > 0)
25420                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
25421         else
25422                 _res_constr.data = NULL;
25423         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25424         for (size_t g = 0; g < _res_constr.datalen; g++) {
25425                 int64_t _res_conv_6 = _res_vals[g];
25426                 LDKUtxo _res_conv_6_conv;
25427                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
25428                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
25429                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
25430                 _res_constr.data[g] = _res_conv_6_conv;
25431         }
25432         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25433         CVec_UtxoZ_free(_res_constr);
25434 }
25435
25436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1some(JNIEnv *env, jclass clz, int64_t o) {
25437         void* o_ptr = untag_ptr(o);
25438         CHECK_ACCESS(o_ptr);
25439         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
25440         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
25441         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
25442         *ret_copy = COption_TxOutZ_some(o_conv);
25443         int64_t ret_ref = tag_ptr(ret_copy, true);
25444         return ret_ref;
25445 }
25446
25447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1none(JNIEnv *env, jclass clz) {
25448         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
25449         *ret_copy = COption_TxOutZ_none();
25450         int64_t ret_ref = tag_ptr(ret_copy, true);
25451         return ret_ref;
25452 }
25453
25454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25455         if (!ptr_is_owned(_res)) return;
25456         void* _res_ptr = untag_ptr(_res);
25457         CHECK_ACCESS(_res_ptr);
25458         LDKCOption_TxOutZ _res_conv = *(LDKCOption_TxOutZ*)(_res_ptr);
25459         FREE(untag_ptr(_res));
25460         COption_TxOutZ_free(_res_conv);
25461 }
25462
25463 static inline uint64_t COption_TxOutZ_clone_ptr(LDKCOption_TxOutZ *NONNULL_PTR arg) {
25464         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
25465         *ret_copy = COption_TxOutZ_clone(arg);
25466         int64_t ret_ref = tag_ptr(ret_copy, true);
25467         return ret_ref;
25468 }
25469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25470         LDKCOption_TxOutZ* arg_conv = (LDKCOption_TxOutZ*)untag_ptr(arg);
25471         int64_t ret_conv = COption_TxOutZ_clone_ptr(arg_conv);
25472         return ret_conv;
25473 }
25474
25475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25476         LDKCOption_TxOutZ* orig_conv = (LDKCOption_TxOutZ*)untag_ptr(orig);
25477         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
25478         *ret_copy = COption_TxOutZ_clone(orig_conv);
25479         int64_t ret_ref = tag_ptr(ret_copy, true);
25480         return ret_ref;
25481 }
25482
25483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1InputZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25484         LDKCVec_InputZ _res_constr;
25485         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25486         if (_res_constr.datalen > 0)
25487                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
25488         else
25489                 _res_constr.data = NULL;
25490         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25491         for (size_t h = 0; h < _res_constr.datalen; h++) {
25492                 int64_t _res_conv_7 = _res_vals[h];
25493                 LDKInput _res_conv_7_conv;
25494                 _res_conv_7_conv.inner = untag_ptr(_res_conv_7);
25495                 _res_conv_7_conv.is_owned = ptr_is_owned(_res_conv_7);
25496                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_7_conv);
25497                 _res_constr.data[h] = _res_conv_7_conv;
25498         }
25499         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25500         CVec_InputZ_free(_res_constr);
25501 }
25502
25503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25504         LDKCoinSelection o_conv;
25505         o_conv.inner = untag_ptr(o);
25506         o_conv.is_owned = ptr_is_owned(o);
25507         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25508         o_conv = CoinSelection_clone(&o_conv);
25509         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
25510         *ret_conv = CResult_CoinSelectionNoneZ_ok(o_conv);
25511         return tag_ptr(ret_conv, true);
25512 }
25513
25514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1err(JNIEnv *env, jclass clz) {
25515         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
25516         *ret_conv = CResult_CoinSelectionNoneZ_err();
25517         return tag_ptr(ret_conv, true);
25518 }
25519
25520 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25521         LDKCResult_CoinSelectionNoneZ* o_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(o);
25522         jboolean ret_conv = CResult_CoinSelectionNoneZ_is_ok(o_conv);
25523         return ret_conv;
25524 }
25525
25526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25527         if (!ptr_is_owned(_res)) return;
25528         void* _res_ptr = untag_ptr(_res);
25529         CHECK_ACCESS(_res_ptr);
25530         LDKCResult_CoinSelectionNoneZ _res_conv = *(LDKCResult_CoinSelectionNoneZ*)(_res_ptr);
25531         FREE(untag_ptr(_res));
25532         CResult_CoinSelectionNoneZ_free(_res_conv);
25533 }
25534
25535 static inline uint64_t CResult_CoinSelectionNoneZ_clone_ptr(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR arg) {
25536         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
25537         *ret_conv = CResult_CoinSelectionNoneZ_clone(arg);
25538         return tag_ptr(ret_conv, true);
25539 }
25540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25541         LDKCResult_CoinSelectionNoneZ* arg_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(arg);
25542         int64_t ret_conv = CResult_CoinSelectionNoneZ_clone_ptr(arg_conv);
25543         return ret_conv;
25544 }
25545
25546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25547         LDKCResult_CoinSelectionNoneZ* orig_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(orig);
25548         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
25549         *ret_conv = CResult_CoinSelectionNoneZ_clone(orig_conv);
25550         return tag_ptr(ret_conv, true);
25551 }
25552
25553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
25554         LDKCVec_UtxoZ o_constr;
25555         o_constr.datalen = (*env)->GetArrayLength(env, o);
25556         if (o_constr.datalen > 0)
25557                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
25558         else
25559                 o_constr.data = NULL;
25560         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
25561         for (size_t g = 0; g < o_constr.datalen; g++) {
25562                 int64_t o_conv_6 = o_vals[g];
25563                 LDKUtxo o_conv_6_conv;
25564                 o_conv_6_conv.inner = untag_ptr(o_conv_6);
25565                 o_conv_6_conv.is_owned = ptr_is_owned(o_conv_6);
25566                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_6_conv);
25567                 o_conv_6_conv = Utxo_clone(&o_conv_6_conv);
25568                 o_constr.data[g] = o_conv_6_conv;
25569         }
25570         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
25571         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
25572         *ret_conv = CResult_CVec_UtxoZNoneZ_ok(o_constr);
25573         return tag_ptr(ret_conv, true);
25574 }
25575
25576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1err(JNIEnv *env, jclass clz) {
25577         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
25578         *ret_conv = CResult_CVec_UtxoZNoneZ_err();
25579         return tag_ptr(ret_conv, true);
25580 }
25581
25582 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25583         LDKCResult_CVec_UtxoZNoneZ* o_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(o);
25584         jboolean ret_conv = CResult_CVec_UtxoZNoneZ_is_ok(o_conv);
25585         return ret_conv;
25586 }
25587
25588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25589         if (!ptr_is_owned(_res)) return;
25590         void* _res_ptr = untag_ptr(_res);
25591         CHECK_ACCESS(_res_ptr);
25592         LDKCResult_CVec_UtxoZNoneZ _res_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(_res_ptr);
25593         FREE(untag_ptr(_res));
25594         CResult_CVec_UtxoZNoneZ_free(_res_conv);
25595 }
25596
25597 static inline uint64_t CResult_CVec_UtxoZNoneZ_clone_ptr(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR arg) {
25598         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
25599         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(arg);
25600         return tag_ptr(ret_conv, true);
25601 }
25602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25603         LDKCResult_CVec_UtxoZNoneZ* arg_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(arg);
25604         int64_t ret_conv = CResult_CVec_UtxoZNoneZ_clone_ptr(arg_conv);
25605         return ret_conv;
25606 }
25607
25608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25609         LDKCResult_CVec_UtxoZNoneZ* orig_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(orig);
25610         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
25611         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(orig_conv);
25612         return tag_ptr(ret_conv, true);
25613 }
25614
25615 static inline uint64_t C2Tuple_u64u16Z_clone_ptr(LDKC2Tuple_u64u16Z *NONNULL_PTR arg) {
25616         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
25617         *ret_conv = C2Tuple_u64u16Z_clone(arg);
25618         return tag_ptr(ret_conv, true);
25619 }
25620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25621         LDKC2Tuple_u64u16Z* arg_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(arg);
25622         int64_t ret_conv = C2Tuple_u64u16Z_clone_ptr(arg_conv);
25623         return ret_conv;
25624 }
25625
25626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25627         LDKC2Tuple_u64u16Z* orig_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(orig);
25628         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
25629         *ret_conv = C2Tuple_u64u16Z_clone(orig_conv);
25630         return tag_ptr(ret_conv, true);
25631 }
25632
25633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1new(JNIEnv *env, jclass clz, int64_t a, int16_t b) {
25634         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
25635         *ret_conv = C2Tuple_u64u16Z_new(a, b);
25636         return tag_ptr(ret_conv, true);
25637 }
25638
25639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
25640         if (!ptr_is_owned(_res)) return;
25641         void* _res_ptr = untag_ptr(_res);
25642         CHECK_ACCESS(_res_ptr);
25643         LDKC2Tuple_u64u16Z _res_conv = *(LDKC2Tuple_u64u16Z*)(_res_ptr);
25644         FREE(untag_ptr(_res));
25645         C2Tuple_u64u16Z_free(_res_conv);
25646 }
25647
25648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
25649         void* o_ptr = untag_ptr(o);
25650         CHECK_ACCESS(o_ptr);
25651         LDKC2Tuple_u64u16Z o_conv = *(LDKC2Tuple_u64u16Z*)(o_ptr);
25652         o_conv = C2Tuple_u64u16Z_clone((LDKC2Tuple_u64u16Z*)untag_ptr(o));
25653         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
25654         *ret_copy = COption_C2Tuple_u64u16ZZ_some(o_conv);
25655         int64_t ret_ref = tag_ptr(ret_copy, true);
25656         return ret_ref;
25657 }
25658
25659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1none(JNIEnv *env, jclass clz) {
25660         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
25661         *ret_copy = COption_C2Tuple_u64u16ZZ_none();
25662         int64_t ret_ref = tag_ptr(ret_copy, true);
25663         return ret_ref;
25664 }
25665
25666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25667         if (!ptr_is_owned(_res)) return;
25668         void* _res_ptr = untag_ptr(_res);
25669         CHECK_ACCESS(_res_ptr);
25670         LDKCOption_C2Tuple_u64u16ZZ _res_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(_res_ptr);
25671         FREE(untag_ptr(_res));
25672         COption_C2Tuple_u64u16ZZ_free(_res_conv);
25673 }
25674
25675 static inline uint64_t COption_C2Tuple_u64u16ZZ_clone_ptr(LDKCOption_C2Tuple_u64u16ZZ *NONNULL_PTR arg) {
25676         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
25677         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(arg);
25678         int64_t ret_ref = tag_ptr(ret_copy, true);
25679         return ret_ref;
25680 }
25681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25682         LDKCOption_C2Tuple_u64u16ZZ* arg_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(arg);
25683         int64_t ret_conv = COption_C2Tuple_u64u16ZZ_clone_ptr(arg_conv);
25684         return ret_conv;
25685 }
25686
25687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25688         LDKCOption_C2Tuple_u64u16ZZ* orig_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(orig);
25689         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
25690         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(orig_conv);
25691         int64_t ret_ref = tag_ptr(ret_copy, true);
25692         return ret_ref;
25693 }
25694
25695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1some(JNIEnv *env, jclass clz, jclass o) {
25696         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_java(env, o);
25697         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
25698         *ret_copy = COption_ChannelShutdownStateZ_some(o_conv);
25699         int64_t ret_ref = tag_ptr(ret_copy, true);
25700         return ret_ref;
25701 }
25702
25703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1none(JNIEnv *env, jclass clz) {
25704         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
25705         *ret_copy = COption_ChannelShutdownStateZ_none();
25706         int64_t ret_ref = tag_ptr(ret_copy, true);
25707         return ret_ref;
25708 }
25709
25710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25711         if (!ptr_is_owned(_res)) return;
25712         void* _res_ptr = untag_ptr(_res);
25713         CHECK_ACCESS(_res_ptr);
25714         LDKCOption_ChannelShutdownStateZ _res_conv = *(LDKCOption_ChannelShutdownStateZ*)(_res_ptr);
25715         FREE(untag_ptr(_res));
25716         COption_ChannelShutdownStateZ_free(_res_conv);
25717 }
25718
25719 static inline uint64_t COption_ChannelShutdownStateZ_clone_ptr(LDKCOption_ChannelShutdownStateZ *NONNULL_PTR arg) {
25720         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
25721         *ret_copy = COption_ChannelShutdownStateZ_clone(arg);
25722         int64_t ret_ref = tag_ptr(ret_copy, true);
25723         return ret_ref;
25724 }
25725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25726         LDKCOption_ChannelShutdownStateZ* arg_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(arg);
25727         int64_t ret_conv = COption_ChannelShutdownStateZ_clone_ptr(arg_conv);
25728         return ret_conv;
25729 }
25730
25731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25732         LDKCOption_ChannelShutdownStateZ* orig_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(orig);
25733         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
25734         *ret_copy = COption_ChannelShutdownStateZ_clone(orig_conv);
25735         int64_t ret_ref = tag_ptr(ret_copy, true);
25736         return ret_ref;
25737 }
25738
25739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25740         LDKThirtyTwoBytes o_ref;
25741         CHECK((*env)->GetArrayLength(env, o) == 32);
25742         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
25743         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
25744         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_ok(o_ref);
25745         return tag_ptr(ret_conv, true);
25746 }
25747
25748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25749         void* e_ptr = untag_ptr(e);
25750         CHECK_ACCESS(e_ptr);
25751         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
25752         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
25753         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
25754         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_err(e_conv);
25755         return tag_ptr(ret_conv, true);
25756 }
25757
25758 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25759         LDKCResult_ThirtyTwoBytesAPIErrorZ* o_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(o);
25760         jboolean ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o_conv);
25761         return ret_conv;
25762 }
25763
25764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25765         if (!ptr_is_owned(_res)) return;
25766         void* _res_ptr = untag_ptr(_res);
25767         CHECK_ACCESS(_res_ptr);
25768         LDKCResult_ThirtyTwoBytesAPIErrorZ _res_conv = *(LDKCResult_ThirtyTwoBytesAPIErrorZ*)(_res_ptr);
25769         FREE(untag_ptr(_res));
25770         CResult_ThirtyTwoBytesAPIErrorZ_free(_res_conv);
25771 }
25772
25773 static inline uint64_t CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR arg) {
25774         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
25775         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(arg);
25776         return tag_ptr(ret_conv, true);
25777 }
25778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25779         LDKCResult_ThirtyTwoBytesAPIErrorZ* arg_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(arg);
25780         int64_t ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(arg_conv);
25781         return ret_conv;
25782 }
25783
25784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25785         LDKCResult_ThirtyTwoBytesAPIErrorZ* orig_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(orig);
25786         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
25787         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(orig_conv);
25788         return tag_ptr(ret_conv, true);
25789 }
25790
25791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RecentPaymentDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25792         LDKCVec_RecentPaymentDetailsZ _res_constr;
25793         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25794         if (_res_constr.datalen > 0)
25795                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
25796         else
25797                 _res_constr.data = NULL;
25798         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25799         for (size_t w = 0; w < _res_constr.datalen; w++) {
25800                 int64_t _res_conv_22 = _res_vals[w];
25801                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
25802                 CHECK_ACCESS(_res_conv_22_ptr);
25803                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
25804                 FREE(untag_ptr(_res_conv_22));
25805                 _res_constr.data[w] = _res_conv_22_conv;
25806         }
25807         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25808         CVec_RecentPaymentDetailsZ_free(_res_constr);
25809 }
25810
25811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
25812         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
25813         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
25814         return tag_ptr(ret_conv, true);
25815 }
25816
25817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25818         void* e_ptr = untag_ptr(e);
25819         CHECK_ACCESS(e_ptr);
25820         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
25821         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
25822         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
25823         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
25824         return tag_ptr(ret_conv, true);
25825 }
25826
25827 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25828         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
25829         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
25830         return ret_conv;
25831 }
25832
25833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25834         if (!ptr_is_owned(_res)) return;
25835         void* _res_ptr = untag_ptr(_res);
25836         CHECK_ACCESS(_res_ptr);
25837         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
25838         FREE(untag_ptr(_res));
25839         CResult_NonePaymentSendFailureZ_free(_res_conv);
25840 }
25841
25842 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
25843         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
25844         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
25845         return tag_ptr(ret_conv, true);
25846 }
25847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25848         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
25849         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
25850         return ret_conv;
25851 }
25852
25853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25854         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
25855         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
25856         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
25857         return tag_ptr(ret_conv, true);
25858 }
25859
25860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1ok(JNIEnv *env, jclass clz) {
25861         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
25862         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
25863         return tag_ptr(ret_conv, true);
25864 }
25865
25866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1err(JNIEnv *env, jclass clz, jclass e) {
25867         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_java(env, e);
25868         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
25869         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
25870         return tag_ptr(ret_conv, true);
25871 }
25872
25873 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25874         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
25875         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
25876         return ret_conv;
25877 }
25878
25879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25880         if (!ptr_is_owned(_res)) return;
25881         void* _res_ptr = untag_ptr(_res);
25882         CHECK_ACCESS(_res_ptr);
25883         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
25884         FREE(untag_ptr(_res));
25885         CResult_NoneRetryableSendFailureZ_free(_res_conv);
25886 }
25887
25888 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
25889         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
25890         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
25891         return tag_ptr(ret_conv, true);
25892 }
25893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25894         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
25895         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
25896         return ret_conv;
25897 }
25898
25899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25900         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
25901         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
25902         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
25903         return tag_ptr(ret_conv, true);
25904 }
25905
25906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25907         LDKThirtyTwoBytes o_ref;
25908         CHECK((*env)->GetArrayLength(env, o) == 32);
25909         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
25910         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
25911         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o_ref);
25912         return tag_ptr(ret_conv, true);
25913 }
25914
25915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25916         void* e_ptr = untag_ptr(e);
25917         CHECK_ACCESS(e_ptr);
25918         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
25919         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
25920         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
25921         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e_conv);
25922         return tag_ptr(ret_conv, true);
25923 }
25924
25925 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25926         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(o);
25927         jboolean ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o_conv);
25928         return ret_conv;
25929 }
25930
25931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25932         if (!ptr_is_owned(_res)) return;
25933         void* _res_ptr = untag_ptr(_res);
25934         CHECK_ACCESS(_res_ptr);
25935         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)(_res_ptr);
25936         FREE(untag_ptr(_res));
25937         CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res_conv);
25938 }
25939
25940 static inline uint64_t CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR arg) {
25941         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
25942         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(arg);
25943         return tag_ptr(ret_conv, true);
25944 }
25945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25946         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(arg);
25947         int64_t ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(arg_conv);
25948         return ret_conv;
25949 }
25950
25951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25952         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(orig);
25953         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
25954         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig_conv);
25955         return tag_ptr(ret_conv, true);
25956 }
25957
25958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25959         LDKThirtyTwoBytes o_ref;
25960         CHECK((*env)->GetArrayLength(env, o) == 32);
25961         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
25962         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
25963         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o_ref);
25964         return tag_ptr(ret_conv, true);
25965 }
25966
25967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1err(JNIEnv *env, jclass clz, jclass e) {
25968         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_java(env, e);
25969         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
25970         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e_conv);
25971         return tag_ptr(ret_conv, true);
25972 }
25973
25974 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25975         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(o);
25976         jboolean ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o_conv);
25977         return ret_conv;
25978 }
25979
25980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25981         if (!ptr_is_owned(_res)) return;
25982         void* _res_ptr = untag_ptr(_res);
25983         CHECK_ACCESS(_res_ptr);
25984         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)(_res_ptr);
25985         FREE(untag_ptr(_res));
25986         CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res_conv);
25987 }
25988
25989 static inline uint64_t CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR arg) {
25990         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
25991         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(arg);
25992         return tag_ptr(ret_conv, true);
25993 }
25994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25995         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(arg);
25996         int64_t ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(arg_conv);
25997         return ret_conv;
25998 }
25999
26000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26001         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(orig);
26002         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
26003         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig_conv);
26004         return tag_ptr(ret_conv, true);
26005 }
26006
26007 static inline uint64_t C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR arg) {
26008         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
26009         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(arg);
26010         return tag_ptr(ret_conv, true);
26011 }
26012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26013         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(arg);
26014         int64_t ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(arg_conv);
26015         return ret_conv;
26016 }
26017
26018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26019         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(orig);
26020         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
26021         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig_conv);
26022         return tag_ptr(ret_conv, true);
26023 }
26024
26025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
26026         LDKThirtyTwoBytes a_ref;
26027         CHECK((*env)->GetArrayLength(env, a) == 32);
26028         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
26029         LDKThirtyTwoBytes b_ref;
26030         CHECK((*env)->GetArrayLength(env, b) == 32);
26031         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
26032         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
26033         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a_ref, b_ref);
26034         return tag_ptr(ret_conv, true);
26035 }
26036
26037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26038         if (!ptr_is_owned(_res)) return;
26039         void* _res_ptr = untag_ptr(_res);
26040         CHECK_ACCESS(_res_ptr);
26041         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_ptr);
26042         FREE(untag_ptr(_res));
26043         C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res_conv);
26044 }
26045
26046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26047         void* o_ptr = untag_ptr(o);
26048         CHECK_ACCESS(o_ptr);
26049         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
26050         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
26051         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
26052         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o_conv);
26053         return tag_ptr(ret_conv, true);
26054 }
26055
26056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26057         void* e_ptr = untag_ptr(e);
26058         CHECK_ACCESS(e_ptr);
26059         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
26060         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
26061         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
26062         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e_conv);
26063         return tag_ptr(ret_conv, true);
26064 }
26065
26066 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26067         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(o);
26068         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o_conv);
26069         return ret_conv;
26070 }
26071
26072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26073         if (!ptr_is_owned(_res)) return;
26074         void* _res_ptr = untag_ptr(_res);
26075         CHECK_ACCESS(_res_ptr);
26076         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)(_res_ptr);
26077         FREE(untag_ptr(_res));
26078         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res_conv);
26079 }
26080
26081 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR arg) {
26082         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
26083         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(arg);
26084         return tag_ptr(ret_conv, true);
26085 }
26086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26087         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(arg);
26088         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(arg_conv);
26089         return ret_conv;
26090 }
26091
26092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26093         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(orig);
26094         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
26095         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig_conv);
26096         return tag_ptr(ret_conv, true);
26097 }
26098
26099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26100         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res_constr;
26101         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26102         if (_res_constr.datalen > 0)
26103                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
26104         else
26105                 _res_constr.data = NULL;
26106         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26107         for (size_t o = 0; o < _res_constr.datalen; o++) {
26108                 int64_t _res_conv_40 = _res_vals[o];
26109                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
26110                 CHECK_ACCESS(_res_conv_40_ptr);
26111                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_conv_40_ptr);
26112                 FREE(untag_ptr(_res_conv_40));
26113                 _res_constr.data[o] = _res_conv_40_conv;
26114         }
26115         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26116         CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res_constr);
26117 }
26118
26119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
26120         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o_constr;
26121         o_constr.datalen = (*env)->GetArrayLength(env, o);
26122         if (o_constr.datalen > 0)
26123                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
26124         else
26125                 o_constr.data = NULL;
26126         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
26127         for (size_t o = 0; o < o_constr.datalen; o++) {
26128                 int64_t o_conv_40 = o_vals[o];
26129                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
26130                 CHECK_ACCESS(o_conv_40_ptr);
26131                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_conv_40_ptr);
26132                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o_conv_40));
26133                 o_constr.data[o] = o_conv_40_conv;
26134         }
26135         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
26136         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
26137         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o_constr);
26138         return tag_ptr(ret_conv, true);
26139 }
26140
26141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26142         void* e_ptr = untag_ptr(e);
26143         CHECK_ACCESS(e_ptr);
26144         LDKProbeSendFailure e_conv = *(LDKProbeSendFailure*)(e_ptr);
26145         e_conv = ProbeSendFailure_clone((LDKProbeSendFailure*)untag_ptr(e));
26146         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
26147         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e_conv);
26148         return tag_ptr(ret_conv, true);
26149 }
26150
26151 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26152         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(o);
26153         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o_conv);
26154         return ret_conv;
26155 }
26156
26157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26158         if (!ptr_is_owned(_res)) return;
26159         void* _res_ptr = untag_ptr(_res);
26160         CHECK_ACCESS(_res_ptr);
26161         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)(_res_ptr);
26162         FREE(untag_ptr(_res));
26163         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res_conv);
26164 }
26165
26166 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR arg) {
26167         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
26168         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(arg);
26169         return tag_ptr(ret_conv, true);
26170 }
26171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26172         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(arg);
26173         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(arg_conv);
26174         return ret_conv;
26175 }
26176
26177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26178         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(orig);
26179         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
26180         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig_conv);
26181         return tag_ptr(ret_conv, true);
26182 }
26183
26184 static inline uint64_t C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR arg) {
26185         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
26186         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(arg);
26187         return tag_ptr(ret_conv, true);
26188 }
26189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26190         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(arg);
26191         int64_t ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(arg_conv);
26192         return ret_conv;
26193 }
26194
26195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26196         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(orig);
26197         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
26198         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(orig_conv);
26199         return tag_ptr(ret_conv, true);
26200 }
26201
26202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
26203         LDKThirtyTwoBytes a_ref;
26204         CHECK((*env)->GetArrayLength(env, a) == 32);
26205         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
26206         LDKPublicKey b_ref;
26207         CHECK((*env)->GetArrayLength(env, b) == 33);
26208         (*env)->GetByteArrayRegion(env, b, 0, 33, b_ref.compressed_form);
26209         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
26210         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_new(a_ref, b_ref);
26211         return tag_ptr(ret_conv, true);
26212 }
26213
26214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26215         if (!ptr_is_owned(_res)) return;
26216         void* _res_ptr = untag_ptr(_res);
26217         CHECK_ACCESS(_res_ptr);
26218         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(_res_ptr);
26219         FREE(untag_ptr(_res));
26220         C2Tuple_ThirtyTwoBytesPublicKeyZ_free(_res_conv);
26221 }
26222
26223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesPublicKeyZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26224         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ _res_constr;
26225         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26226         if (_res_constr.datalen > 0)
26227                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ Elements");
26228         else
26229                 _res_constr.data = NULL;
26230         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26231         for (size_t j = 0; j < _res_constr.datalen; j++) {
26232                 int64_t _res_conv_35 = _res_vals[j];
26233                 void* _res_conv_35_ptr = untag_ptr(_res_conv_35);
26234                 CHECK_ACCESS(_res_conv_35_ptr);
26235                 LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res_conv_35_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(_res_conv_35_ptr);
26236                 FREE(untag_ptr(_res_conv_35));
26237                 _res_constr.data[j] = _res_conv_35_conv;
26238         }
26239         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26240         CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(_res_constr);
26241 }
26242
26243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1some(JNIEnv *env, jclass clz, jstring o) {
26244         LDKStr o_conv = java_to_owned_str(env, o);
26245         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
26246         *ret_copy = COption_StrZ_some(o_conv);
26247         int64_t ret_ref = tag_ptr(ret_copy, true);
26248         return ret_ref;
26249 }
26250
26251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1none(JNIEnv *env, jclass clz) {
26252         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
26253         *ret_copy = COption_StrZ_none();
26254         int64_t ret_ref = tag_ptr(ret_copy, true);
26255         return ret_ref;
26256 }
26257
26258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26259         if (!ptr_is_owned(_res)) return;
26260         void* _res_ptr = untag_ptr(_res);
26261         CHECK_ACCESS(_res_ptr);
26262         LDKCOption_StrZ _res_conv = *(LDKCOption_StrZ*)(_res_ptr);
26263         FREE(untag_ptr(_res));
26264         COption_StrZ_free(_res_conv);
26265 }
26266
26267 static inline uint64_t COption_StrZ_clone_ptr(LDKCOption_StrZ *NONNULL_PTR arg) {
26268         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
26269         *ret_copy = COption_StrZ_clone(arg);
26270         int64_t ret_ref = tag_ptr(ret_copy, true);
26271         return ret_ref;
26272 }
26273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26274         LDKCOption_StrZ* arg_conv = (LDKCOption_StrZ*)untag_ptr(arg);
26275         int64_t ret_conv = COption_StrZ_clone_ptr(arg_conv);
26276         return ret_conv;
26277 }
26278
26279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26280         LDKCOption_StrZ* orig_conv = (LDKCOption_StrZ*)untag_ptr(orig);
26281         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
26282         *ret_copy = COption_StrZ_clone(orig_conv);
26283         int64_t ret_ref = tag_ptr(ret_copy, true);
26284         return ret_ref;
26285 }
26286
26287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
26288         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
26289         *ret_conv = CResult_NoneBolt12SemanticErrorZ_ok();
26290         return tag_ptr(ret_conv, true);
26291 }
26292
26293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
26294         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
26295         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
26296         *ret_conv = CResult_NoneBolt12SemanticErrorZ_err(e_conv);
26297         return tag_ptr(ret_conv, true);
26298 }
26299
26300 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26301         LDKCResult_NoneBolt12SemanticErrorZ* o_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(o);
26302         jboolean ret_conv = CResult_NoneBolt12SemanticErrorZ_is_ok(o_conv);
26303         return ret_conv;
26304 }
26305
26306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26307         if (!ptr_is_owned(_res)) return;
26308         void* _res_ptr = untag_ptr(_res);
26309         CHECK_ACCESS(_res_ptr);
26310         LDKCResult_NoneBolt12SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt12SemanticErrorZ*)(_res_ptr);
26311         FREE(untag_ptr(_res));
26312         CResult_NoneBolt12SemanticErrorZ_free(_res_conv);
26313 }
26314
26315 static inline uint64_t CResult_NoneBolt12SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR arg) {
26316         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
26317         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(arg);
26318         return tag_ptr(ret_conv, true);
26319 }
26320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26321         LDKCResult_NoneBolt12SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(arg);
26322         int64_t ret_conv = CResult_NoneBolt12SemanticErrorZ_clone_ptr(arg_conv);
26323         return ret_conv;
26324 }
26325
26326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26327         LDKCResult_NoneBolt12SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(orig);
26328         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
26329         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(orig_conv);
26330         return tag_ptr(ret_conv, true);
26331 }
26332
26333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26334         void* o_ptr = untag_ptr(o);
26335         CHECK_ACCESS(o_ptr);
26336         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
26337         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
26338         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
26339         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o_conv);
26340         return tag_ptr(ret_conv, true);
26341 }
26342
26343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1err(JNIEnv *env, jclass clz) {
26344         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
26345         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err();
26346         return tag_ptr(ret_conv, true);
26347 }
26348
26349 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26350         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(o);
26351         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o_conv);
26352         return ret_conv;
26353 }
26354
26355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26356         if (!ptr_is_owned(_res)) return;
26357         void* _res_ptr = untag_ptr(_res);
26358         CHECK_ACCESS(_res_ptr);
26359         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)(_res_ptr);
26360         FREE(untag_ptr(_res));
26361         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res_conv);
26362 }
26363
26364 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR arg) {
26365         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
26366         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(arg);
26367         return tag_ptr(ret_conv, true);
26368 }
26369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26370         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(arg);
26371         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(arg_conv);
26372         return ret_conv;
26373 }
26374
26375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26376         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(orig);
26377         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
26378         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig_conv);
26379         return tag_ptr(ret_conv, true);
26380 }
26381
26382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26383         void* o_ptr = untag_ptr(o);
26384         CHECK_ACCESS(o_ptr);
26385         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
26386         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
26387         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
26388         *ret_copy = COption_OffersMessageZ_some(o_conv);
26389         int64_t ret_ref = tag_ptr(ret_copy, true);
26390         return ret_ref;
26391 }
26392
26393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1none(JNIEnv *env, jclass clz) {
26394         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
26395         *ret_copy = COption_OffersMessageZ_none();
26396         int64_t ret_ref = tag_ptr(ret_copy, true);
26397         return ret_ref;
26398 }
26399
26400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26401         if (!ptr_is_owned(_res)) return;
26402         void* _res_ptr = untag_ptr(_res);
26403         CHECK_ACCESS(_res_ptr);
26404         LDKCOption_OffersMessageZ _res_conv = *(LDKCOption_OffersMessageZ*)(_res_ptr);
26405         FREE(untag_ptr(_res));
26406         COption_OffersMessageZ_free(_res_conv);
26407 }
26408
26409 static inline uint64_t COption_OffersMessageZ_clone_ptr(LDKCOption_OffersMessageZ *NONNULL_PTR arg) {
26410         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
26411         *ret_copy = COption_OffersMessageZ_clone(arg);
26412         int64_t ret_ref = tag_ptr(ret_copy, true);
26413         return ret_ref;
26414 }
26415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26416         LDKCOption_OffersMessageZ* arg_conv = (LDKCOption_OffersMessageZ*)untag_ptr(arg);
26417         int64_t ret_conv = COption_OffersMessageZ_clone_ptr(arg_conv);
26418         return ret_conv;
26419 }
26420
26421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26422         LDKCOption_OffersMessageZ* orig_conv = (LDKCOption_OffersMessageZ*)untag_ptr(orig);
26423         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
26424         *ret_copy = COption_OffersMessageZ_clone(orig_conv);
26425         int64_t ret_ref = tag_ptr(ret_copy, true);
26426         return ret_ref;
26427 }
26428
26429 static inline uint64_t C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR arg) {
26430         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
26431         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(arg);
26432         return tag_ptr(ret_conv, true);
26433 }
26434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26435         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(arg);
26436         int64_t ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(arg_conv);
26437         return ret_conv;
26438 }
26439
26440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26441         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(orig);
26442         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
26443         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(orig_conv);
26444         return tag_ptr(ret_conv, true);
26445 }
26446
26447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b, int64_t c) {
26448         void* a_ptr = untag_ptr(a);
26449         CHECK_ACCESS(a_ptr);
26450         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
26451         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
26452         void* b_ptr = untag_ptr(b);
26453         CHECK_ACCESS(b_ptr);
26454         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
26455         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
26456         LDKBlindedPath c_conv;
26457         c_conv.inner = untag_ptr(c);
26458         c_conv.is_owned = ptr_is_owned(c);
26459         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
26460         c_conv = BlindedPath_clone(&c_conv);
26461         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
26462         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
26463         return tag_ptr(ret_conv, true);
26464 }
26465
26466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26467         if (!ptr_is_owned(_res)) return;
26468         void* _res_ptr = untag_ptr(_res);
26469         CHECK_ACCESS(_res_ptr);
26470         LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_ptr);
26471         FREE(untag_ptr(_res));
26472         C3Tuple_OffersMessageDestinationBlindedPathZ_free(_res_conv);
26473 }
26474
26475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OffersMessageDestinationBlindedPathZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26476         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ _res_constr;
26477         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26478         if (_res_constr.datalen > 0)
26479                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
26480         else
26481                 _res_constr.data = NULL;
26482         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26483         for (size_t x = 0; x < _res_constr.datalen; x++) {
26484                 int64_t _res_conv_49 = _res_vals[x];
26485                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
26486                 CHECK_ACCESS(_res_conv_49_ptr);
26487                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_conv_49_ptr);
26488                 FREE(untag_ptr(_res_conv_49));
26489                 _res_constr.data[x] = _res_conv_49_conv;
26490         }
26491         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26492         CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(_res_constr);
26493 }
26494
26495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26496         LDKCounterpartyForwardingInfo o_conv;
26497         o_conv.inner = untag_ptr(o);
26498         o_conv.is_owned = ptr_is_owned(o);
26499         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26500         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
26501         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
26502         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
26503         return tag_ptr(ret_conv, true);
26504 }
26505
26506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26507         void* e_ptr = untag_ptr(e);
26508         CHECK_ACCESS(e_ptr);
26509         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26510         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26511         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
26512         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
26513         return tag_ptr(ret_conv, true);
26514 }
26515
26516 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26517         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
26518         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
26519         return ret_conv;
26520 }
26521
26522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26523         if (!ptr_is_owned(_res)) return;
26524         void* _res_ptr = untag_ptr(_res);
26525         CHECK_ACCESS(_res_ptr);
26526         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
26527         FREE(untag_ptr(_res));
26528         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
26529 }
26530
26531 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
26532         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
26533         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
26534         return tag_ptr(ret_conv, true);
26535 }
26536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26537         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
26538         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
26539         return ret_conv;
26540 }
26541
26542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26543         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
26544         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
26545         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
26546         return tag_ptr(ret_conv, true);
26547 }
26548
26549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26550         LDKChannelCounterparty o_conv;
26551         o_conv.inner = untag_ptr(o);
26552         o_conv.is_owned = ptr_is_owned(o);
26553         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26554         o_conv = ChannelCounterparty_clone(&o_conv);
26555         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
26556         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
26557         return tag_ptr(ret_conv, true);
26558 }
26559
26560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26561         void* e_ptr = untag_ptr(e);
26562         CHECK_ACCESS(e_ptr);
26563         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26564         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26565         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
26566         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
26567         return tag_ptr(ret_conv, true);
26568 }
26569
26570 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26571         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
26572         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
26573         return ret_conv;
26574 }
26575
26576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26577         if (!ptr_is_owned(_res)) return;
26578         void* _res_ptr = untag_ptr(_res);
26579         CHECK_ACCESS(_res_ptr);
26580         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
26581         FREE(untag_ptr(_res));
26582         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
26583 }
26584
26585 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
26586         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
26587         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
26588         return tag_ptr(ret_conv, true);
26589 }
26590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26591         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
26592         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
26593         return ret_conv;
26594 }
26595
26596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26597         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
26598         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
26599         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
26600         return tag_ptr(ret_conv, true);
26601 }
26602
26603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26604         LDKChannelDetails o_conv;
26605         o_conv.inner = untag_ptr(o);
26606         o_conv.is_owned = ptr_is_owned(o);
26607         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26608         o_conv = ChannelDetails_clone(&o_conv);
26609         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
26610         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
26611         return tag_ptr(ret_conv, true);
26612 }
26613
26614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26615         void* e_ptr = untag_ptr(e);
26616         CHECK_ACCESS(e_ptr);
26617         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26618         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26619         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
26620         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
26621         return tag_ptr(ret_conv, true);
26622 }
26623
26624 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26625         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
26626         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
26627         return ret_conv;
26628 }
26629
26630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26631         if (!ptr_is_owned(_res)) return;
26632         void* _res_ptr = untag_ptr(_res);
26633         CHECK_ACCESS(_res_ptr);
26634         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
26635         FREE(untag_ptr(_res));
26636         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
26637 }
26638
26639 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
26640         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
26641         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
26642         return tag_ptr(ret_conv, true);
26643 }
26644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26645         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
26646         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
26647         return ret_conv;
26648 }
26649
26650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26651         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
26652         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
26653         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
26654         return tag_ptr(ret_conv, true);
26655 }
26656
26657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26658         LDKPhantomRouteHints o_conv;
26659         o_conv.inner = untag_ptr(o);
26660         o_conv.is_owned = ptr_is_owned(o);
26661         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26662         o_conv = PhantomRouteHints_clone(&o_conv);
26663         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
26664         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
26665         return tag_ptr(ret_conv, true);
26666 }
26667
26668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26669         void* e_ptr = untag_ptr(e);
26670         CHECK_ACCESS(e_ptr);
26671         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26672         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26673         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
26674         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
26675         return tag_ptr(ret_conv, true);
26676 }
26677
26678 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26679         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
26680         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
26681         return ret_conv;
26682 }
26683
26684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26685         if (!ptr_is_owned(_res)) return;
26686         void* _res_ptr = untag_ptr(_res);
26687         CHECK_ACCESS(_res_ptr);
26688         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
26689         FREE(untag_ptr(_res));
26690         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
26691 }
26692
26693 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
26694         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
26695         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
26696         return tag_ptr(ret_conv, true);
26697 }
26698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26699         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
26700         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
26701         return ret_conv;
26702 }
26703
26704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26705         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
26706         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
26707         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
26708         return tag_ptr(ret_conv, true);
26709 }
26710
26711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
26712         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_java(env, o);
26713         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
26714         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_ok(o_conv);
26715         return tag_ptr(ret_conv, true);
26716 }
26717
26718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26719         void* e_ptr = untag_ptr(e);
26720         CHECK_ACCESS(e_ptr);
26721         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26722         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26723         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
26724         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_err(e_conv);
26725         return tag_ptr(ret_conv, true);
26726 }
26727
26728 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26729         LDKCResult_ChannelShutdownStateDecodeErrorZ* o_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(o);
26730         jboolean ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o_conv);
26731         return ret_conv;
26732 }
26733
26734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26735         if (!ptr_is_owned(_res)) return;
26736         void* _res_ptr = untag_ptr(_res);
26737         CHECK_ACCESS(_res_ptr);
26738         LDKCResult_ChannelShutdownStateDecodeErrorZ _res_conv = *(LDKCResult_ChannelShutdownStateDecodeErrorZ*)(_res_ptr);
26739         FREE(untag_ptr(_res));
26740         CResult_ChannelShutdownStateDecodeErrorZ_free(_res_conv);
26741 }
26742
26743 static inline uint64_t CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR arg) {
26744         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
26745         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(arg);
26746         return tag_ptr(ret_conv, true);
26747 }
26748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26749         LDKCResult_ChannelShutdownStateDecodeErrorZ* arg_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(arg);
26750         int64_t ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(arg_conv);
26751         return ret_conv;
26752 }
26753
26754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26755         LDKCResult_ChannelShutdownStateDecodeErrorZ* orig_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(orig);
26756         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
26757         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(orig_conv);
26758         return tag_ptr(ret_conv, true);
26759 }
26760
26761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26762         LDKCVec_ChannelMonitorZ _res_constr;
26763         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26764         if (_res_constr.datalen > 0)
26765                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
26766         else
26767                 _res_constr.data = NULL;
26768         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26769         for (size_t q = 0; q < _res_constr.datalen; q++) {
26770                 int64_t _res_conv_16 = _res_vals[q];
26771                 LDKChannelMonitor _res_conv_16_conv;
26772                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
26773                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
26774                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
26775                 _res_constr.data[q] = _res_conv_16_conv;
26776         }
26777         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26778         CVec_ChannelMonitorZ_free(_res_constr);
26779 }
26780
26781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
26782         LDKThirtyTwoBytes a_ref;
26783         CHECK((*env)->GetArrayLength(env, a) == 32);
26784         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
26785         LDKChannelManager b_conv;
26786         b_conv.inner = untag_ptr(b);
26787         b_conv.is_owned = ptr_is_owned(b);
26788         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26789         // WARNING: we need a move here but no clone is available for LDKChannelManager
26790         
26791         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ), "LDKC2Tuple_ThirtyTwoBytesChannelManagerZ");
26792         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a_ref, b_conv);
26793         return tag_ptr(ret_conv, true);
26794 }
26795
26796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26797         if (!ptr_is_owned(_res)) return;
26798         void* _res_ptr = untag_ptr(_res);
26799         CHECK_ACCESS(_res_ptr);
26800         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(_res_ptr);
26801         FREE(untag_ptr(_res));
26802         C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res_conv);
26803 }
26804
26805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26806         void* o_ptr = untag_ptr(o);
26807         CHECK_ACCESS(o_ptr);
26808         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(o_ptr);
26809         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_ThirtyTwoBytesChannelManagerZ
26810         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
26811         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o_conv);
26812         return tag_ptr(ret_conv, true);
26813 }
26814
26815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26816         void* e_ptr = untag_ptr(e);
26817         CHECK_ACCESS(e_ptr);
26818         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26819         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26820         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
26821         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e_conv);
26822         return tag_ptr(ret_conv, true);
26823 }
26824
26825 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26826         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(o);
26827         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o_conv);
26828         return ret_conv;
26829 }
26830
26831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26832         if (!ptr_is_owned(_res)) return;
26833         void* _res_ptr = untag_ptr(_res);
26834         CHECK_ACCESS(_res_ptr);
26835         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)(_res_ptr);
26836         FREE(untag_ptr(_res));
26837         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res_conv);
26838 }
26839
26840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26841         void* o_ptr = untag_ptr(o);
26842         CHECK_ACCESS(o_ptr);
26843         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
26844         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
26845         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
26846         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o_conv);
26847         return tag_ptr(ret_conv, true);
26848 }
26849
26850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26851         void* e_ptr = untag_ptr(e);
26852         CHECK_ACCESS(e_ptr);
26853         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26854         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26855         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
26856         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_err(e_conv);
26857         return tag_ptr(ret_conv, true);
26858 }
26859
26860 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26861         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* o_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(o);
26862         jboolean ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o_conv);
26863         return ret_conv;
26864 }
26865
26866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26867         if (!ptr_is_owned(_res)) return;
26868         void* _res_ptr = untag_ptr(_res);
26869         CHECK_ACCESS(_res_ptr);
26870         LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res_conv = *(LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)(_res_ptr);
26871         FREE(untag_ptr(_res));
26872         CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res_conv);
26873 }
26874
26875 static inline uint64_t CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR arg) {
26876         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
26877         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(arg);
26878         return tag_ptr(ret_conv, true);
26879 }
26880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26881         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* arg_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(arg);
26882         int64_t ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(arg_conv);
26883         return ret_conv;
26884 }
26885
26886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26887         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* orig_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(orig);
26888         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
26889         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig_conv);
26890         return tag_ptr(ret_conv, true);
26891 }
26892
26893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26894         LDKChannelConfig o_conv;
26895         o_conv.inner = untag_ptr(o);
26896         o_conv.is_owned = ptr_is_owned(o);
26897         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26898         o_conv = ChannelConfig_clone(&o_conv);
26899         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
26900         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
26901         return tag_ptr(ret_conv, true);
26902 }
26903
26904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26905         void* e_ptr = untag_ptr(e);
26906         CHECK_ACCESS(e_ptr);
26907         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26908         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26909         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
26910         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
26911         return tag_ptr(ret_conv, true);
26912 }
26913
26914 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26915         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
26916         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
26917         return ret_conv;
26918 }
26919
26920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26921         if (!ptr_is_owned(_res)) return;
26922         void* _res_ptr = untag_ptr(_res);
26923         CHECK_ACCESS(_res_ptr);
26924         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
26925         FREE(untag_ptr(_res));
26926         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
26927 }
26928
26929 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
26930         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
26931         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
26932         return tag_ptr(ret_conv, true);
26933 }
26934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26935         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
26936         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
26937         return ret_conv;
26938 }
26939
26940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26941         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
26942         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
26943         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
26944         return tag_ptr(ret_conv, true);
26945 }
26946
26947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26948         void* o_ptr = untag_ptr(o);
26949         CHECK_ACCESS(o_ptr);
26950         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
26951         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
26952         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
26953         *ret_copy = COption_MaxDustHTLCExposureZ_some(o_conv);
26954         int64_t ret_ref = tag_ptr(ret_copy, true);
26955         return ret_ref;
26956 }
26957
26958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1none(JNIEnv *env, jclass clz) {
26959         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
26960         *ret_copy = COption_MaxDustHTLCExposureZ_none();
26961         int64_t ret_ref = tag_ptr(ret_copy, true);
26962         return ret_ref;
26963 }
26964
26965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26966         if (!ptr_is_owned(_res)) return;
26967         void* _res_ptr = untag_ptr(_res);
26968         CHECK_ACCESS(_res_ptr);
26969         LDKCOption_MaxDustHTLCExposureZ _res_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(_res_ptr);
26970         FREE(untag_ptr(_res));
26971         COption_MaxDustHTLCExposureZ_free(_res_conv);
26972 }
26973
26974 static inline uint64_t COption_MaxDustHTLCExposureZ_clone_ptr(LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR arg) {
26975         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
26976         *ret_copy = COption_MaxDustHTLCExposureZ_clone(arg);
26977         int64_t ret_ref = tag_ptr(ret_copy, true);
26978         return ret_ref;
26979 }
26980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26981         LDKCOption_MaxDustHTLCExposureZ* arg_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(arg);
26982         int64_t ret_conv = COption_MaxDustHTLCExposureZ_clone_ptr(arg_conv);
26983         return ret_conv;
26984 }
26985
26986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26987         LDKCOption_MaxDustHTLCExposureZ* orig_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(orig);
26988         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
26989         *ret_copy = COption_MaxDustHTLCExposureZ_clone(orig_conv);
26990         int64_t ret_ref = tag_ptr(ret_copy, true);
26991         return ret_ref;
26992 }
26993
26994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26995         void* o_ptr = untag_ptr(o);
26996         CHECK_ACCESS(o_ptr);
26997         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
26998         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
26999         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
27000         *ret_copy = COption_APIErrorZ_some(o_conv);
27001         int64_t ret_ref = tag_ptr(ret_copy, true);
27002         return ret_ref;
27003 }
27004
27005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1none(JNIEnv *env, jclass clz) {
27006         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
27007         *ret_copy = COption_APIErrorZ_none();
27008         int64_t ret_ref = tag_ptr(ret_copy, true);
27009         return ret_ref;
27010 }
27011
27012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27013         if (!ptr_is_owned(_res)) return;
27014         void* _res_ptr = untag_ptr(_res);
27015         CHECK_ACCESS(_res_ptr);
27016         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
27017         FREE(untag_ptr(_res));
27018         COption_APIErrorZ_free(_res_conv);
27019 }
27020
27021 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
27022         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
27023         *ret_copy = COption_APIErrorZ_clone(arg);
27024         int64_t ret_ref = tag_ptr(ret_copy, true);
27025         return ret_ref;
27026 }
27027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27028         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
27029         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
27030         return ret_conv;
27031 }
27032
27033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27034         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
27035         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
27036         *ret_copy = COption_APIErrorZ_clone(orig_conv);
27037         int64_t ret_ref = tag_ptr(ret_copy, true);
27038         return ret_ref;
27039 }
27040
27041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27042         void* o_ptr = untag_ptr(o);
27043         CHECK_ACCESS(o_ptr);
27044         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
27045         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
27046         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
27047         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
27048         return tag_ptr(ret_conv, true);
27049 }
27050
27051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27052         void* e_ptr = untag_ptr(e);
27053         CHECK_ACCESS(e_ptr);
27054         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27055         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27056         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
27057         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
27058         return tag_ptr(ret_conv, true);
27059 }
27060
27061 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27062         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
27063         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
27064         return ret_conv;
27065 }
27066
27067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27068         if (!ptr_is_owned(_res)) return;
27069         void* _res_ptr = untag_ptr(_res);
27070         CHECK_ACCESS(_res_ptr);
27071         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
27072         FREE(untag_ptr(_res));
27073         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
27074 }
27075
27076 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
27077         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
27078         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
27079         return tag_ptr(ret_conv, true);
27080 }
27081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27082         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
27083         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
27084         return ret_conv;
27085 }
27086
27087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27088         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
27089         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
27090         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
27091         return tag_ptr(ret_conv, true);
27092 }
27093
27094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27095         LDKChannelMonitorUpdate o_conv;
27096         o_conv.inner = untag_ptr(o);
27097         o_conv.is_owned = ptr_is_owned(o);
27098         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27099         o_conv = ChannelMonitorUpdate_clone(&o_conv);
27100         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
27101         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
27102         return tag_ptr(ret_conv, true);
27103 }
27104
27105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27106         void* e_ptr = untag_ptr(e);
27107         CHECK_ACCESS(e_ptr);
27108         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27109         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27110         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
27111         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
27112         return tag_ptr(ret_conv, true);
27113 }
27114
27115 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27116         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
27117         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
27118         return ret_conv;
27119 }
27120
27121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27122         if (!ptr_is_owned(_res)) return;
27123         void* _res_ptr = untag_ptr(_res);
27124         CHECK_ACCESS(_res_ptr);
27125         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
27126         FREE(untag_ptr(_res));
27127         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
27128 }
27129
27130 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
27131         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
27132         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
27133         return tag_ptr(ret_conv, true);
27134 }
27135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27136         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
27137         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
27138         return ret_conv;
27139 }
27140
27141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27142         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
27143         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
27144         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
27145         return tag_ptr(ret_conv, true);
27146 }
27147
27148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
27149         void* o_ptr = untag_ptr(o);
27150         CHECK_ACCESS(o_ptr);
27151         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
27152         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
27153         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
27154         *ret_copy = COption_MonitorEventZ_some(o_conv);
27155         int64_t ret_ref = tag_ptr(ret_copy, true);
27156         return ret_ref;
27157 }
27158
27159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1none(JNIEnv *env, jclass clz) {
27160         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
27161         *ret_copy = COption_MonitorEventZ_none();
27162         int64_t ret_ref = tag_ptr(ret_copy, true);
27163         return ret_ref;
27164 }
27165
27166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27167         if (!ptr_is_owned(_res)) return;
27168         void* _res_ptr = untag_ptr(_res);
27169         CHECK_ACCESS(_res_ptr);
27170         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
27171         FREE(untag_ptr(_res));
27172         COption_MonitorEventZ_free(_res_conv);
27173 }
27174
27175 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
27176         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
27177         *ret_copy = COption_MonitorEventZ_clone(arg);
27178         int64_t ret_ref = tag_ptr(ret_copy, true);
27179         return ret_ref;
27180 }
27181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27182         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
27183         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
27184         return ret_conv;
27185 }
27186
27187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27188         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
27189         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
27190         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
27191         int64_t ret_ref = tag_ptr(ret_copy, true);
27192         return ret_ref;
27193 }
27194
27195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27196         void* o_ptr = untag_ptr(o);
27197         CHECK_ACCESS(o_ptr);
27198         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
27199         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
27200         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
27201         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
27202         return tag_ptr(ret_conv, true);
27203 }
27204
27205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27206         void* e_ptr = untag_ptr(e);
27207         CHECK_ACCESS(e_ptr);
27208         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27209         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27210         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
27211         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
27212         return tag_ptr(ret_conv, true);
27213 }
27214
27215 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27216         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
27217         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
27218         return ret_conv;
27219 }
27220
27221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27222         if (!ptr_is_owned(_res)) return;
27223         void* _res_ptr = untag_ptr(_res);
27224         CHECK_ACCESS(_res_ptr);
27225         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
27226         FREE(untag_ptr(_res));
27227         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
27228 }
27229
27230 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
27231         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
27232         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
27233         return tag_ptr(ret_conv, true);
27234 }
27235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27236         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
27237         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
27238         return ret_conv;
27239 }
27240
27241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27242         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
27243         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
27244         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
27245         return tag_ptr(ret_conv, true);
27246 }
27247
27248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27249         LDKHTLCUpdate o_conv;
27250         o_conv.inner = untag_ptr(o);
27251         o_conv.is_owned = ptr_is_owned(o);
27252         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27253         o_conv = HTLCUpdate_clone(&o_conv);
27254         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
27255         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
27256         return tag_ptr(ret_conv, true);
27257 }
27258
27259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27260         void* e_ptr = untag_ptr(e);
27261         CHECK_ACCESS(e_ptr);
27262         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27263         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27264         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
27265         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
27266         return tag_ptr(ret_conv, true);
27267 }
27268
27269 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27270         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
27271         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
27272         return ret_conv;
27273 }
27274
27275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27276         if (!ptr_is_owned(_res)) return;
27277         void* _res_ptr = untag_ptr(_res);
27278         CHECK_ACCESS(_res_ptr);
27279         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
27280         FREE(untag_ptr(_res));
27281         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
27282 }
27283
27284 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
27285         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
27286         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
27287         return tag_ptr(ret_conv, true);
27288 }
27289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27290         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
27291         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
27292         return ret_conv;
27293 }
27294
27295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27296         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
27297         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
27298         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
27299         return tag_ptr(ret_conv, true);
27300 }
27301
27302 static inline uint64_t C2Tuple_OutPointCVec_u8ZZ_clone_ptr(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR arg) {
27303         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
27304         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(arg);
27305         return tag_ptr(ret_conv, true);
27306 }
27307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27308         LDKC2Tuple_OutPointCVec_u8ZZ* arg_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(arg);
27309         int64_t ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone_ptr(arg_conv);
27310         return ret_conv;
27311 }
27312
27313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27314         LDKC2Tuple_OutPointCVec_u8ZZ* orig_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(orig);
27315         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
27316         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(orig_conv);
27317         return tag_ptr(ret_conv, true);
27318 }
27319
27320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
27321         LDKOutPoint a_conv;
27322         a_conv.inner = untag_ptr(a);
27323         a_conv.is_owned = ptr_is_owned(a);
27324         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27325         a_conv = OutPoint_clone(&a_conv);
27326         LDKCVec_u8Z b_ref;
27327         b_ref.datalen = (*env)->GetArrayLength(env, b);
27328         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
27329         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
27330         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
27331         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_new(a_conv, b_ref);
27332         return tag_ptr(ret_conv, true);
27333 }
27334
27335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27336         if (!ptr_is_owned(_res)) return;
27337         void* _res_ptr = untag_ptr(_res);
27338         CHECK_ACCESS(_res_ptr);
27339         LDKC2Tuple_OutPointCVec_u8ZZ _res_conv = *(LDKC2Tuple_OutPointCVec_u8ZZ*)(_res_ptr);
27340         FREE(untag_ptr(_res));
27341         C2Tuple_OutPointCVec_u8ZZ_free(_res_conv);
27342 }
27343
27344 static inline uint64_t C2Tuple_u32CVec_u8ZZ_clone_ptr(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR arg) {
27345         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
27346         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(arg);
27347         return tag_ptr(ret_conv, true);
27348 }
27349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27350         LDKC2Tuple_u32CVec_u8ZZ* arg_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(arg);
27351         int64_t ret_conv = C2Tuple_u32CVec_u8ZZ_clone_ptr(arg_conv);
27352         return ret_conv;
27353 }
27354
27355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27356         LDKC2Tuple_u32CVec_u8ZZ* orig_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(orig);
27357         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
27358         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(orig_conv);
27359         return tag_ptr(ret_conv, true);
27360 }
27361
27362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
27363         LDKCVec_u8Z b_ref;
27364         b_ref.datalen = (*env)->GetArrayLength(env, b);
27365         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
27366         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
27367         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
27368         *ret_conv = C2Tuple_u32CVec_u8ZZ_new(a, b_ref);
27369         return tag_ptr(ret_conv, true);
27370 }
27371
27372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27373         if (!ptr_is_owned(_res)) return;
27374         void* _res_ptr = untag_ptr(_res);
27375         CHECK_ACCESS(_res_ptr);
27376         LDKC2Tuple_u32CVec_u8ZZ _res_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_ptr);
27377         FREE(untag_ptr(_res));
27378         C2Tuple_u32CVec_u8ZZ_free(_res_conv);
27379 }
27380
27381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32CVec_1u8ZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27382         LDKCVec_C2Tuple_u32CVec_u8ZZZ _res_constr;
27383         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27384         if (_res_constr.datalen > 0)
27385                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
27386         else
27387                 _res_constr.data = NULL;
27388         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27389         for (size_t x = 0; x < _res_constr.datalen; x++) {
27390                 int64_t _res_conv_23 = _res_vals[x];
27391                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
27392                 CHECK_ACCESS(_res_conv_23_ptr);
27393                 LDKC2Tuple_u32CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_conv_23_ptr);
27394                 FREE(untag_ptr(_res_conv_23));
27395                 _res_constr.data[x] = _res_conv_23_conv;
27396         }
27397         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27398         CVec_C2Tuple_u32CVec_u8ZZZ_free(_res_constr);
27399 }
27400
27401 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR arg) {
27402         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
27403         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(arg);
27404         return tag_ptr(ret_conv, true);
27405 }
27406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27407         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(arg);
27408         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(arg_conv);
27409         return ret_conv;
27410 }
27411
27412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27413         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(orig);
27414         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
27415         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig_conv);
27416         return tag_ptr(ret_conv, true);
27417 }
27418
27419 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) {
27420         LDKThirtyTwoBytes a_ref;
27421         CHECK((*env)->GetArrayLength(env, a) == 32);
27422         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
27423         LDKCVec_C2Tuple_u32CVec_u8ZZZ b_constr;
27424         b_constr.datalen = (*env)->GetArrayLength(env, b);
27425         if (b_constr.datalen > 0)
27426                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
27427         else
27428                 b_constr.data = NULL;
27429         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
27430         for (size_t x = 0; x < b_constr.datalen; x++) {
27431                 int64_t b_conv_23 = b_vals[x];
27432                 void* b_conv_23_ptr = untag_ptr(b_conv_23);
27433                 CHECK_ACCESS(b_conv_23_ptr);
27434                 LDKC2Tuple_u32CVec_u8ZZ b_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(b_conv_23_ptr);
27435                 b_conv_23_conv = C2Tuple_u32CVec_u8ZZ_clone((LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(b_conv_23));
27436                 b_constr.data[x] = b_conv_23_conv;
27437         }
27438         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
27439         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
27440         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(a_ref, b_constr);
27441         return tag_ptr(ret_conv, true);
27442 }
27443
27444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27445         if (!ptr_is_owned(_res)) return;
27446         void* _res_ptr = untag_ptr(_res);
27447         CHECK_ACCESS(_res_ptr);
27448         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_ptr);
27449         FREE(untag_ptr(_res));
27450         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res_conv);
27451 }
27452
27453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27454         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ _res_constr;
27455         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27456         if (_res_constr.datalen > 0)
27457                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ Elements");
27458         else
27459                 _res_constr.data = NULL;
27460         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27461         for (size_t a = 0; a < _res_constr.datalen; a++) {
27462                 int64_t _res_conv_52 = _res_vals[a];
27463                 void* _res_conv_52_ptr = untag_ptr(_res_conv_52);
27464                 CHECK_ACCESS(_res_conv_52_ptr);
27465                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv_52_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_conv_52_ptr);
27466                 FREE(untag_ptr(_res_conv_52));
27467                 _res_constr.data[a] = _res_conv_52_conv;
27468         }
27469         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27470         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res_constr);
27471 }
27472
27473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CommitmentTransactionZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27474         LDKCVec_CommitmentTransactionZ _res_constr;
27475         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27476         if (_res_constr.datalen > 0)
27477                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCommitmentTransaction), "LDKCVec_CommitmentTransactionZ Elements");
27478         else
27479                 _res_constr.data = NULL;
27480         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27481         for (size_t x = 0; x < _res_constr.datalen; x++) {
27482                 int64_t _res_conv_23 = _res_vals[x];
27483                 LDKCommitmentTransaction _res_conv_23_conv;
27484                 _res_conv_23_conv.inner = untag_ptr(_res_conv_23);
27485                 _res_conv_23_conv.is_owned = ptr_is_owned(_res_conv_23);
27486                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_23_conv);
27487                 _res_constr.data[x] = _res_conv_23_conv;
27488         }
27489         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27490         CVec_CommitmentTransactionZ_free(_res_constr);
27491 }
27492
27493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
27494         LDKCVec_TransactionZ _res_constr;
27495         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27496         if (_res_constr.datalen > 0)
27497                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
27498         else
27499                 _res_constr.data = NULL;
27500         for (size_t i = 0; i < _res_constr.datalen; i++) {
27501                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
27502                 LDKTransaction _res_conv_8_ref;
27503                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
27504                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
27505                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
27506                 _res_conv_8_ref.data_is_owned = true;
27507                 _res_constr.data[i] = _res_conv_8_ref;
27508         }
27509         CVec_TransactionZ_free(_res_constr);
27510 }
27511
27512 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
27513         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
27514         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
27515         return tag_ptr(ret_conv, true);
27516 }
27517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27518         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
27519         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
27520         return ret_conv;
27521 }
27522
27523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27524         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
27525         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
27526         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
27527         return tag_ptr(ret_conv, true);
27528 }
27529
27530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
27531         void* b_ptr = untag_ptr(b);
27532         CHECK_ACCESS(b_ptr);
27533         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
27534         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
27535         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
27536         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
27537         return tag_ptr(ret_conv, true);
27538 }
27539
27540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27541         if (!ptr_is_owned(_res)) return;
27542         void* _res_ptr = untag_ptr(_res);
27543         CHECK_ACCESS(_res_ptr);
27544         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
27545         FREE(untag_ptr(_res));
27546         C2Tuple_u32TxOutZ_free(_res_conv);
27547 }
27548
27549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27550         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
27551         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27552         if (_res_constr.datalen > 0)
27553                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
27554         else
27555                 _res_constr.data = NULL;
27556         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27557         for (size_t u = 0; u < _res_constr.datalen; u++) {
27558                 int64_t _res_conv_20 = _res_vals[u];
27559                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
27560                 CHECK_ACCESS(_res_conv_20_ptr);
27561                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
27562                 FREE(untag_ptr(_res_conv_20));
27563                 _res_constr.data[u] = _res_conv_20_conv;
27564         }
27565         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27566         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
27567 }
27568
27569 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
27570         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
27571         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(arg);
27572         return tag_ptr(ret_conv, true);
27573 }
27574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27575         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
27576         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
27577         return ret_conv;
27578 }
27579
27580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27581         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
27582         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
27583         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
27584         return tag_ptr(ret_conv, true);
27585 }
27586
27587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
27588         LDKThirtyTwoBytes a_ref;
27589         CHECK((*env)->GetArrayLength(env, a) == 32);
27590         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
27591         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
27592         b_constr.datalen = (*env)->GetArrayLength(env, b);
27593         if (b_constr.datalen > 0)
27594                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
27595         else
27596                 b_constr.data = NULL;
27597         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
27598         for (size_t u = 0; u < b_constr.datalen; u++) {
27599                 int64_t b_conv_20 = b_vals[u];
27600                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
27601                 CHECK_ACCESS(b_conv_20_ptr);
27602                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
27603                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
27604                 b_constr.data[u] = b_conv_20_conv;
27605         }
27606         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
27607         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
27608         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
27609         return tag_ptr(ret_conv, true);
27610 }
27611
27612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27613         if (!ptr_is_owned(_res)) return;
27614         void* _res_ptr = untag_ptr(_res);
27615         CHECK_ACCESS(_res_ptr);
27616         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
27617         FREE(untag_ptr(_res));
27618         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
27619 }
27620
27621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27622         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ _res_constr;
27623         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27624         if (_res_constr.datalen > 0)
27625                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ Elements");
27626         else
27627                 _res_constr.data = NULL;
27628         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27629         for (size_t x = 0; x < _res_constr.datalen; x++) {
27630                 int64_t _res_conv_49 = _res_vals[x];
27631                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
27632                 CHECK_ACCESS(_res_conv_49_ptr);
27633                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_49_ptr);
27634                 FREE(untag_ptr(_res_conv_49));
27635                 _res_constr.data[x] = _res_conv_49_conv;
27636         }
27637         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27638         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
27639 }
27640
27641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27642         LDKCVec_BalanceZ _res_constr;
27643         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27644         if (_res_constr.datalen > 0)
27645                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
27646         else
27647                 _res_constr.data = NULL;
27648         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27649         for (size_t j = 0; j < _res_constr.datalen; j++) {
27650                 int64_t _res_conv_9 = _res_vals[j];
27651                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
27652                 CHECK_ACCESS(_res_conv_9_ptr);
27653                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
27654                 FREE(untag_ptr(_res_conv_9));
27655                 _res_constr.data[j] = _res_conv_9_conv;
27656         }
27657         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27658         CVec_BalanceZ_free(_res_constr);
27659 }
27660
27661 static inline uint64_t C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR arg) {
27662         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
27663         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(arg);
27664         return tag_ptr(ret_conv, true);
27665 }
27666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27667         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(arg);
27668         int64_t ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(arg_conv);
27669         return ret_conv;
27670 }
27671
27672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27673         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(orig);
27674         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
27675         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig_conv);
27676         return tag_ptr(ret_conv, true);
27677 }
27678
27679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
27680         LDKThirtyTwoBytes a_ref;
27681         CHECK((*env)->GetArrayLength(env, a) == 32);
27682         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
27683         LDKChannelMonitor b_conv;
27684         b_conv.inner = untag_ptr(b);
27685         b_conv.is_owned = ptr_is_owned(b);
27686         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
27687         b_conv = ChannelMonitor_clone(&b_conv);
27688         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
27689         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a_ref, b_conv);
27690         return tag_ptr(ret_conv, true);
27691 }
27692
27693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27694         if (!ptr_is_owned(_res)) return;
27695         void* _res_ptr = untag_ptr(_res);
27696         CHECK_ACCESS(_res_ptr);
27697         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_ptr);
27698         FREE(untag_ptr(_res));
27699         C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res_conv);
27700 }
27701
27702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27703         void* o_ptr = untag_ptr(o);
27704         CHECK_ACCESS(o_ptr);
27705         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
27706         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
27707         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
27708         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o_conv);
27709         return tag_ptr(ret_conv, true);
27710 }
27711
27712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27713         void* e_ptr = untag_ptr(e);
27714         CHECK_ACCESS(e_ptr);
27715         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27716         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27717         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
27718         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e_conv);
27719         return tag_ptr(ret_conv, true);
27720 }
27721
27722 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27723         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(o);
27724         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o_conv);
27725         return ret_conv;
27726 }
27727
27728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27729         if (!ptr_is_owned(_res)) return;
27730         void* _res_ptr = untag_ptr(_res);
27731         CHECK_ACCESS(_res_ptr);
27732         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)(_res_ptr);
27733         FREE(untag_ptr(_res));
27734         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res_conv);
27735 }
27736
27737 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
27738         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
27739         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(arg);
27740         return tag_ptr(ret_conv, true);
27741 }
27742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27743         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
27744         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
27745         return ret_conv;
27746 }
27747
27748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27749         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
27750         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
27751         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig_conv);
27752         return tag_ptr(ret_conv, true);
27753 }
27754
27755 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
27756         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
27757         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
27758         return tag_ptr(ret_conv, true);
27759 }
27760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27761         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
27762         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
27763         return ret_conv;
27764 }
27765
27766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27767         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
27768         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
27769         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
27770         return tag_ptr(ret_conv, true);
27771 }
27772
27773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
27774         LDKPublicKey a_ref;
27775         CHECK((*env)->GetArrayLength(env, a) == 33);
27776         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
27777         void* b_ptr = untag_ptr(b);
27778         CHECK_ACCESS(b_ptr);
27779         LDKType b_conv = *(LDKType*)(b_ptr);
27780         if (b_conv.free == LDKType_JCalls_free) {
27781                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27782                 LDKType_JCalls_cloned(&b_conv);
27783         }
27784         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
27785         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
27786         return tag_ptr(ret_conv, true);
27787 }
27788
27789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27790         if (!ptr_is_owned(_res)) return;
27791         void* _res_ptr = untag_ptr(_res);
27792         CHECK_ACCESS(_res_ptr);
27793         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
27794         FREE(untag_ptr(_res));
27795         C2Tuple_PublicKeyTypeZ_free(_res_conv);
27796 }
27797
27798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27799         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
27800         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27801         if (_res_constr.datalen > 0)
27802                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
27803         else
27804                 _res_constr.data = NULL;
27805         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27806         for (size_t z = 0; z < _res_constr.datalen; z++) {
27807                 int64_t _res_conv_25 = _res_vals[z];
27808                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
27809                 CHECK_ACCESS(_res_conv_25_ptr);
27810                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
27811                 FREE(untag_ptr(_res_conv_25));
27812                 _res_constr.data[z] = _res_conv_25_conv;
27813         }
27814         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27815         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
27816 }
27817
27818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1some(JNIEnv *env, jclass clz, int64_t o) {
27819         void* o_ptr = untag_ptr(o);
27820         CHECK_ACCESS(o_ptr);
27821         LDKOnionMessageContents o_conv = *(LDKOnionMessageContents*)(o_ptr);
27822         if (o_conv.free == LDKOnionMessageContents_JCalls_free) {
27823                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27824                 LDKOnionMessageContents_JCalls_cloned(&o_conv);
27825         }
27826         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
27827         *ret_copy = COption_OnionMessageContentsZ_some(o_conv);
27828         int64_t ret_ref = tag_ptr(ret_copy, true);
27829         return ret_ref;
27830 }
27831
27832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1none(JNIEnv *env, jclass clz) {
27833         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
27834         *ret_copy = COption_OnionMessageContentsZ_none();
27835         int64_t ret_ref = tag_ptr(ret_copy, true);
27836         return ret_ref;
27837 }
27838
27839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27840         if (!ptr_is_owned(_res)) return;
27841         void* _res_ptr = untag_ptr(_res);
27842         CHECK_ACCESS(_res_ptr);
27843         LDKCOption_OnionMessageContentsZ _res_conv = *(LDKCOption_OnionMessageContentsZ*)(_res_ptr);
27844         FREE(untag_ptr(_res));
27845         COption_OnionMessageContentsZ_free(_res_conv);
27846 }
27847
27848 static inline uint64_t COption_OnionMessageContentsZ_clone_ptr(LDKCOption_OnionMessageContentsZ *NONNULL_PTR arg) {
27849         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
27850         *ret_copy = COption_OnionMessageContentsZ_clone(arg);
27851         int64_t ret_ref = tag_ptr(ret_copy, true);
27852         return ret_ref;
27853 }
27854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27855         LDKCOption_OnionMessageContentsZ* arg_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(arg);
27856         int64_t ret_conv = COption_OnionMessageContentsZ_clone_ptr(arg_conv);
27857         return ret_conv;
27858 }
27859
27860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27861         LDKCOption_OnionMessageContentsZ* orig_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(orig);
27862         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
27863         *ret_copy = COption_OnionMessageContentsZ_clone(orig_conv);
27864         int64_t ret_ref = tag_ptr(ret_copy, true);
27865         return ret_ref;
27866 }
27867
27868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27869         void* o_ptr = untag_ptr(o);
27870         CHECK_ACCESS(o_ptr);
27871         LDKCOption_OnionMessageContentsZ o_conv = *(LDKCOption_OnionMessageContentsZ*)(o_ptr);
27872         o_conv = COption_OnionMessageContentsZ_clone((LDKCOption_OnionMessageContentsZ*)untag_ptr(o));
27873         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
27874         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o_conv);
27875         return tag_ptr(ret_conv, true);
27876 }
27877
27878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27879         void* e_ptr = untag_ptr(e);
27880         CHECK_ACCESS(e_ptr);
27881         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27882         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27883         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
27884         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e_conv);
27885         return tag_ptr(ret_conv, true);
27886 }
27887
27888 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27889         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
27890         jboolean ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
27891         return ret_conv;
27892 }
27893
27894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27895         if (!ptr_is_owned(_res)) return;
27896         void* _res_ptr = untag_ptr(_res);
27897         CHECK_ACCESS(_res_ptr);
27898         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(_res_ptr);
27899         FREE(untag_ptr(_res));
27900         CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res_conv);
27901 }
27902
27903 static inline uint64_t CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
27904         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
27905         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(arg);
27906         return tag_ptr(ret_conv, true);
27907 }
27908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27909         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
27910         int64_t ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
27911         return ret_conv;
27912 }
27913
27914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27915         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
27916         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
27917         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig_conv);
27918         return tag_ptr(ret_conv, true);
27919 }
27920
27921 static inline uint64_t C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR arg) {
27922         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
27923         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(arg);
27924         return tag_ptr(ret_conv, true);
27925 }
27926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27927         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(arg);
27928         int64_t ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(arg_conv);
27929         return ret_conv;
27930 }
27931
27932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27933         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(orig);
27934         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
27935         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig_conv);
27936         return tag_ptr(ret_conv, true);
27937 }
27938
27939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b, int64_t c) {
27940         void* a_ptr = untag_ptr(a);
27941         CHECK_ACCESS(a_ptr);
27942         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
27943         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
27944                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27945                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
27946         }
27947         void* b_ptr = untag_ptr(b);
27948         CHECK_ACCESS(b_ptr);
27949         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
27950         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
27951         LDKBlindedPath c_conv;
27952         c_conv.inner = untag_ptr(c);
27953         c_conv.is_owned = ptr_is_owned(c);
27954         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
27955         c_conv = BlindedPath_clone(&c_conv);
27956         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
27957         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
27958         return tag_ptr(ret_conv, true);
27959 }
27960
27961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27962         if (!ptr_is_owned(_res)) return;
27963         void* _res_ptr = untag_ptr(_res);
27964         CHECK_ACCESS(_res_ptr);
27965         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_ptr);
27966         FREE(untag_ptr(_res));
27967         C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res_conv);
27968 }
27969
27970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OnionMessageContentsDestinationBlindedPathZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27971         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ _res_constr;
27972         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27973         if (_res_constr.datalen > 0)
27974                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
27975         else
27976                 _res_constr.data = NULL;
27977         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27978         for (size_t e = 0; e < _res_constr.datalen; e++) {
27979                 int64_t _res_conv_56 = _res_vals[e];
27980                 void* _res_conv_56_ptr = untag_ptr(_res_conv_56);
27981                 CHECK_ACCESS(_res_conv_56_ptr);
27982                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_conv_56_ptr);
27983                 FREE(untag_ptr(_res_conv_56));
27984                 _res_constr.data[e] = _res_conv_56_conv;
27985         }
27986         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27987         CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res_constr);
27988 }
27989
27990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
27991         void* o_ptr = untag_ptr(o);
27992         CHECK_ACCESS(o_ptr);
27993         LDKType o_conv = *(LDKType*)(o_ptr);
27994         if (o_conv.free == LDKType_JCalls_free) {
27995                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27996                 LDKType_JCalls_cloned(&o_conv);
27997         }
27998         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
27999         *ret_copy = COption_TypeZ_some(o_conv);
28000         int64_t ret_ref = tag_ptr(ret_copy, true);
28001         return ret_ref;
28002 }
28003
28004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
28005         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
28006         *ret_copy = COption_TypeZ_none();
28007         int64_t ret_ref = tag_ptr(ret_copy, true);
28008         return ret_ref;
28009 }
28010
28011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28012         if (!ptr_is_owned(_res)) return;
28013         void* _res_ptr = untag_ptr(_res);
28014         CHECK_ACCESS(_res_ptr);
28015         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
28016         FREE(untag_ptr(_res));
28017         COption_TypeZ_free(_res_conv);
28018 }
28019
28020 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
28021         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
28022         *ret_copy = COption_TypeZ_clone(arg);
28023         int64_t ret_ref = tag_ptr(ret_copy, true);
28024         return ret_ref;
28025 }
28026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28027         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
28028         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
28029         return ret_conv;
28030 }
28031
28032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28033         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
28034         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
28035         *ret_copy = COption_TypeZ_clone(orig_conv);
28036         int64_t ret_ref = tag_ptr(ret_copy, true);
28037         return ret_ref;
28038 }
28039
28040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28041         void* o_ptr = untag_ptr(o);
28042         CHECK_ACCESS(o_ptr);
28043         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
28044         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
28045         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
28046         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
28047         return tag_ptr(ret_conv, true);
28048 }
28049
28050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28051         void* e_ptr = untag_ptr(e);
28052         CHECK_ACCESS(e_ptr);
28053         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28054         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28055         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
28056         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
28057         return tag_ptr(ret_conv, true);
28058 }
28059
28060 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28061         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
28062         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
28063         return ret_conv;
28064 }
28065
28066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28067         if (!ptr_is_owned(_res)) return;
28068         void* _res_ptr = untag_ptr(_res);
28069         CHECK_ACCESS(_res_ptr);
28070         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
28071         FREE(untag_ptr(_res));
28072         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
28073 }
28074
28075 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
28076         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
28077         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
28078         return tag_ptr(ret_conv, true);
28079 }
28080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28081         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
28082         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
28083         return ret_conv;
28084 }
28085
28086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28087         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
28088         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
28089         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
28090         return tag_ptr(ret_conv, true);
28091 }
28092
28093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1some(JNIEnv *env, jclass clz, int64_t o) {
28094         void* o_ptr = untag_ptr(o);
28095         CHECK_ACCESS(o_ptr);
28096         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
28097         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
28098         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
28099         *ret_copy = COption_SocketAddressZ_some(o_conv);
28100         int64_t ret_ref = tag_ptr(ret_copy, true);
28101         return ret_ref;
28102 }
28103
28104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1none(JNIEnv *env, jclass clz) {
28105         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
28106         *ret_copy = COption_SocketAddressZ_none();
28107         int64_t ret_ref = tag_ptr(ret_copy, true);
28108         return ret_ref;
28109 }
28110
28111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28112         if (!ptr_is_owned(_res)) return;
28113         void* _res_ptr = untag_ptr(_res);
28114         CHECK_ACCESS(_res_ptr);
28115         LDKCOption_SocketAddressZ _res_conv = *(LDKCOption_SocketAddressZ*)(_res_ptr);
28116         FREE(untag_ptr(_res));
28117         COption_SocketAddressZ_free(_res_conv);
28118 }
28119
28120 static inline uint64_t COption_SocketAddressZ_clone_ptr(LDKCOption_SocketAddressZ *NONNULL_PTR arg) {
28121         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
28122         *ret_copy = COption_SocketAddressZ_clone(arg);
28123         int64_t ret_ref = tag_ptr(ret_copy, true);
28124         return ret_ref;
28125 }
28126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28127         LDKCOption_SocketAddressZ* arg_conv = (LDKCOption_SocketAddressZ*)untag_ptr(arg);
28128         int64_t ret_conv = COption_SocketAddressZ_clone_ptr(arg_conv);
28129         return ret_conv;
28130 }
28131
28132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28133         LDKCOption_SocketAddressZ* orig_conv = (LDKCOption_SocketAddressZ*)untag_ptr(orig);
28134         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
28135         *ret_copy = COption_SocketAddressZ_clone(orig_conv);
28136         int64_t ret_ref = tag_ptr(ret_copy, true);
28137         return ret_ref;
28138 }
28139
28140 static inline uint64_t C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR arg) {
28141         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
28142         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(arg);
28143         return tag_ptr(ret_conv, true);
28144 }
28145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28146         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(arg);
28147         int64_t ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(arg_conv);
28148         return ret_conv;
28149 }
28150
28151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28152         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(orig);
28153         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
28154         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(orig_conv);
28155         return tag_ptr(ret_conv, true);
28156 }
28157
28158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
28159         LDKPublicKey a_ref;
28160         CHECK((*env)->GetArrayLength(env, a) == 33);
28161         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
28162         void* b_ptr = untag_ptr(b);
28163         CHECK_ACCESS(b_ptr);
28164         LDKCOption_SocketAddressZ b_conv = *(LDKCOption_SocketAddressZ*)(b_ptr);
28165         b_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(b));
28166         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
28167         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_new(a_ref, b_conv);
28168         return tag_ptr(ret_conv, true);
28169 }
28170
28171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28172         if (!ptr_is_owned(_res)) return;
28173         void* _res_ptr = untag_ptr(_res);
28174         CHECK_ACCESS(_res_ptr);
28175         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)(_res_ptr);
28176         FREE(untag_ptr(_res));
28177         C2Tuple_PublicKeyCOption_SocketAddressZZ_free(_res_conv);
28178 }
28179
28180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyCOption_1SocketAddressZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
28181         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ _res_constr;
28182         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28183         if (_res_constr.datalen > 0)
28184                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ Elements");
28185         else
28186                 _res_constr.data = NULL;
28187         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
28188         for (size_t r = 0; r < _res_constr.datalen; r++) {
28189                 int64_t _res_conv_43 = _res_vals[r];
28190                 void* _res_conv_43_ptr = untag_ptr(_res_conv_43);
28191                 CHECK_ACCESS(_res_conv_43_ptr);
28192                 LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res_conv_43_conv = *(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)(_res_conv_43_ptr);
28193                 FREE(untag_ptr(_res_conv_43));
28194                 _res_constr.data[r] = _res_conv_43_conv;
28195         }
28196         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
28197         CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(_res_constr);
28198 }
28199
28200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
28201         LDKCVec_u8Z o_ref;
28202         o_ref.datalen = (*env)->GetArrayLength(env, o);
28203         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
28204         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
28205         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
28206         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
28207         return tag_ptr(ret_conv, true);
28208 }
28209
28210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28211         LDKPeerHandleError e_conv;
28212         e_conv.inner = untag_ptr(e);
28213         e_conv.is_owned = ptr_is_owned(e);
28214         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
28215         e_conv = PeerHandleError_clone(&e_conv);
28216         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
28217         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
28218         return tag_ptr(ret_conv, true);
28219 }
28220
28221 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28222         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
28223         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
28224         return ret_conv;
28225 }
28226
28227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28228         if (!ptr_is_owned(_res)) return;
28229         void* _res_ptr = untag_ptr(_res);
28230         CHECK_ACCESS(_res_ptr);
28231         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
28232         FREE(untag_ptr(_res));
28233         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
28234 }
28235
28236 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
28237         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
28238         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
28239         return tag_ptr(ret_conv, true);
28240 }
28241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28242         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
28243         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
28244         return ret_conv;
28245 }
28246
28247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28248         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
28249         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
28250         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
28251         return tag_ptr(ret_conv, true);
28252 }
28253
28254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
28255         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
28256         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
28257         return tag_ptr(ret_conv, true);
28258 }
28259
28260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28261         LDKPeerHandleError e_conv;
28262         e_conv.inner = untag_ptr(e);
28263         e_conv.is_owned = ptr_is_owned(e);
28264         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
28265         e_conv = PeerHandleError_clone(&e_conv);
28266         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
28267         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
28268         return tag_ptr(ret_conv, true);
28269 }
28270
28271 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28272         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
28273         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
28274         return ret_conv;
28275 }
28276
28277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28278         if (!ptr_is_owned(_res)) return;
28279         void* _res_ptr = untag_ptr(_res);
28280         CHECK_ACCESS(_res_ptr);
28281         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
28282         FREE(untag_ptr(_res));
28283         CResult_NonePeerHandleErrorZ_free(_res_conv);
28284 }
28285
28286 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
28287         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
28288         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
28289         return tag_ptr(ret_conv, true);
28290 }
28291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28292         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
28293         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
28294         return ret_conv;
28295 }
28296
28297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28298         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
28299         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
28300         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
28301         return tag_ptr(ret_conv, true);
28302 }
28303
28304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
28305         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
28306         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
28307         return tag_ptr(ret_conv, true);
28308 }
28309
28310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28311         LDKPeerHandleError e_conv;
28312         e_conv.inner = untag_ptr(e);
28313         e_conv.is_owned = ptr_is_owned(e);
28314         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
28315         e_conv = PeerHandleError_clone(&e_conv);
28316         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
28317         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
28318         return tag_ptr(ret_conv, true);
28319 }
28320
28321 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28322         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
28323         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
28324         return ret_conv;
28325 }
28326
28327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28328         if (!ptr_is_owned(_res)) return;
28329         void* _res_ptr = untag_ptr(_res);
28330         CHECK_ACCESS(_res_ptr);
28331         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
28332         FREE(untag_ptr(_res));
28333         CResult_boolPeerHandleErrorZ_free(_res_conv);
28334 }
28335
28336 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
28337         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
28338         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
28339         return tag_ptr(ret_conv, true);
28340 }
28341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28342         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
28343         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
28344         return ret_conv;
28345 }
28346
28347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28348         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
28349         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
28350         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
28351         return tag_ptr(ret_conv, true);
28352 }
28353
28354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1ok(JNIEnv *env, jclass clz, int32_t o) {
28355         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
28356         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
28357         return tag_ptr(ret_conv, true);
28358 }
28359
28360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28361         void* e_ptr = untag_ptr(e);
28362         CHECK_ACCESS(e_ptr);
28363         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
28364         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
28365         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
28366         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
28367         return tag_ptr(ret_conv, true);
28368 }
28369
28370 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28371         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
28372         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
28373         return ret_conv;
28374 }
28375
28376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28377         if (!ptr_is_owned(_res)) return;
28378         void* _res_ptr = untag_ptr(_res);
28379         CHECK_ACCESS(_res_ptr);
28380         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
28381         FREE(untag_ptr(_res));
28382         CResult_u32GraphSyncErrorZ_free(_res_conv);
28383 }
28384
28385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
28386         LDKCVec_u8Z o_ref;
28387         o_ref.datalen = (*env)->GetArrayLength(env, o);
28388         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
28389         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
28390         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
28391         *ret_conv = CResult_CVec_u8ZIOErrorZ_ok(o_ref);
28392         return tag_ptr(ret_conv, true);
28393 }
28394
28395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28396         LDKIOError e_conv = LDKIOError_from_java(env, e);
28397         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
28398         *ret_conv = CResult_CVec_u8ZIOErrorZ_err(e_conv);
28399         return tag_ptr(ret_conv, true);
28400 }
28401
28402 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28403         LDKCResult_CVec_u8ZIOErrorZ* o_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(o);
28404         jboolean ret_conv = CResult_CVec_u8ZIOErrorZ_is_ok(o_conv);
28405         return ret_conv;
28406 }
28407
28408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28409         if (!ptr_is_owned(_res)) return;
28410         void* _res_ptr = untag_ptr(_res);
28411         CHECK_ACCESS(_res_ptr);
28412         LDKCResult_CVec_u8ZIOErrorZ _res_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(_res_ptr);
28413         FREE(untag_ptr(_res));
28414         CResult_CVec_u8ZIOErrorZ_free(_res_conv);
28415 }
28416
28417 static inline uint64_t CResult_CVec_u8ZIOErrorZ_clone_ptr(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR arg) {
28418         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
28419         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(arg);
28420         return tag_ptr(ret_conv, true);
28421 }
28422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28423         LDKCResult_CVec_u8ZIOErrorZ* arg_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(arg);
28424         int64_t ret_conv = CResult_CVec_u8ZIOErrorZ_clone_ptr(arg_conv);
28425         return ret_conv;
28426 }
28427
28428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28429         LDKCResult_CVec_u8ZIOErrorZ* orig_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(orig);
28430         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
28431         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(orig_conv);
28432         return tag_ptr(ret_conv, true);
28433 }
28434
28435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1StrZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
28436         LDKCVec_StrZ _res_constr;
28437         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28438         if (_res_constr.datalen > 0)
28439                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
28440         else
28441                 _res_constr.data = NULL;
28442         for (size_t i = 0; i < _res_constr.datalen; i++) {
28443                 jstring _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
28444                 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
28445                 _res_constr.data[i] = dummy;
28446         }
28447         CVec_StrZ_free(_res_constr);
28448 }
28449
28450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
28451         LDKCVec_StrZ o_constr;
28452         o_constr.datalen = (*env)->GetArrayLength(env, o);
28453         if (o_constr.datalen > 0)
28454                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
28455         else
28456                 o_constr.data = NULL;
28457         for (size_t i = 0; i < o_constr.datalen; i++) {
28458                 jstring o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
28459                 LDKStr o_conv_8_conv = java_to_owned_str(env, o_conv_8);
28460                 o_constr.data[i] = o_conv_8_conv;
28461         }
28462         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
28463         *ret_conv = CResult_CVec_StrZIOErrorZ_ok(o_constr);
28464         return tag_ptr(ret_conv, true);
28465 }
28466
28467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28468         LDKIOError e_conv = LDKIOError_from_java(env, e);
28469         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
28470         *ret_conv = CResult_CVec_StrZIOErrorZ_err(e_conv);
28471         return tag_ptr(ret_conv, true);
28472 }
28473
28474 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28475         LDKCResult_CVec_StrZIOErrorZ* o_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(o);
28476         jboolean ret_conv = CResult_CVec_StrZIOErrorZ_is_ok(o_conv);
28477         return ret_conv;
28478 }
28479
28480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28481         if (!ptr_is_owned(_res)) return;
28482         void* _res_ptr = untag_ptr(_res);
28483         CHECK_ACCESS(_res_ptr);
28484         LDKCResult_CVec_StrZIOErrorZ _res_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(_res_ptr);
28485         FREE(untag_ptr(_res));
28486         CResult_CVec_StrZIOErrorZ_free(_res_conv);
28487 }
28488
28489 static inline uint64_t CResult_CVec_StrZIOErrorZ_clone_ptr(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR arg) {
28490         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
28491         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(arg);
28492         return tag_ptr(ret_conv, true);
28493 }
28494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28495         LDKCResult_CVec_StrZIOErrorZ* arg_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(arg);
28496         int64_t ret_conv = CResult_CVec_StrZIOErrorZ_clone_ptr(arg_conv);
28497         return ret_conv;
28498 }
28499
28500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28501         LDKCResult_CVec_StrZIOErrorZ* orig_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(orig);
28502         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
28503         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(orig_conv);
28504         return tag_ptr(ret_conv, true);
28505 }
28506
28507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
28508         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ _res_constr;
28509         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28510         if (_res_constr.datalen > 0)
28511                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
28512         else
28513                 _res_constr.data = NULL;
28514         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
28515         for (size_t o = 0; o < _res_constr.datalen; o++) {
28516                 int64_t _res_conv_40 = _res_vals[o];
28517                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
28518                 CHECK_ACCESS(_res_conv_40_ptr);
28519                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_conv_40_ptr);
28520                 FREE(untag_ptr(_res_conv_40));
28521                 _res_constr.data[o] = _res_conv_40_conv;
28522         }
28523         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
28524         CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res_constr);
28525 }
28526
28527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
28528         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ o_constr;
28529         o_constr.datalen = (*env)->GetArrayLength(env, o);
28530         if (o_constr.datalen > 0)
28531                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
28532         else
28533                 o_constr.data = NULL;
28534         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
28535         for (size_t o = 0; o < o_constr.datalen; o++) {
28536                 int64_t o_conv_40 = o_vals[o];
28537                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
28538                 CHECK_ACCESS(o_conv_40_ptr);
28539                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_conv_40_ptr);
28540                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o_conv_40));
28541                 o_constr.data[o] = o_conv_40_conv;
28542         }
28543         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
28544         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
28545         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o_constr);
28546         return tag_ptr(ret_conv, true);
28547 }
28548
28549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28550         LDKIOError e_conv = LDKIOError_from_java(env, e);
28551         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
28552         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e_conv);
28553         return tag_ptr(ret_conv, true);
28554 }
28555
28556 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28557         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(o);
28558         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o_conv);
28559         return ret_conv;
28560 }
28561
28562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28563         if (!ptr_is_owned(_res)) return;
28564         void* _res_ptr = untag_ptr(_res);
28565         CHECK_ACCESS(_res_ptr);
28566         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)(_res_ptr);
28567         FREE(untag_ptr(_res));
28568         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res_conv);
28569 }
28570
28571 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR arg) {
28572         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
28573         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(arg);
28574         return tag_ptr(ret_conv, true);
28575 }
28576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28577         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(arg);
28578         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(arg_conv);
28579         return ret_conv;
28580 }
28581
28582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28583         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(orig);
28584         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
28585         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig_conv);
28586         return tag_ptr(ret_conv, true);
28587 }
28588
28589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28590         void* o_ptr = untag_ptr(o);
28591         CHECK_ACCESS(o_ptr);
28592         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
28593         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
28594         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
28595         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o_conv);
28596         return tag_ptr(ret_conv, true);
28597 }
28598
28599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28600         LDKIOError e_conv = LDKIOError_from_java(env, e);
28601         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
28602         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e_conv);
28603         return tag_ptr(ret_conv, true);
28604 }
28605
28606 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28607         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(o);
28608         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o_conv);
28609         return ret_conv;
28610 }
28611
28612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28613         if (!ptr_is_owned(_res)) return;
28614         void* _res_ptr = untag_ptr(_res);
28615         CHECK_ACCESS(_res_ptr);
28616         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)(_res_ptr);
28617         FREE(untag_ptr(_res));
28618         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res_conv);
28619 }
28620
28621 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR arg) {
28622         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
28623         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(arg);
28624         return tag_ptr(ret_conv, true);
28625 }
28626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28627         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(arg);
28628         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(arg_conv);
28629         return ret_conv;
28630 }
28631
28632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28633         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(orig);
28634         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
28635         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig_conv);
28636         return tag_ptr(ret_conv, true);
28637 }
28638
28639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
28640         LDKSecretKey o_ref;
28641         CHECK((*env)->GetArrayLength(env, o) == 32);
28642         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
28643         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
28644         *ret_copy = COption_SecretKeyZ_some(o_ref);
28645         int64_t ret_ref = tag_ptr(ret_copy, true);
28646         return ret_ref;
28647 }
28648
28649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1none(JNIEnv *env, jclass clz) {
28650         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
28651         *ret_copy = COption_SecretKeyZ_none();
28652         int64_t ret_ref = tag_ptr(ret_copy, true);
28653         return ret_ref;
28654 }
28655
28656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28657         if (!ptr_is_owned(_res)) return;
28658         void* _res_ptr = untag_ptr(_res);
28659         CHECK_ACCESS(_res_ptr);
28660         LDKCOption_SecretKeyZ _res_conv = *(LDKCOption_SecretKeyZ*)(_res_ptr);
28661         FREE(untag_ptr(_res));
28662         COption_SecretKeyZ_free(_res_conv);
28663 }
28664
28665 static inline uint64_t COption_SecretKeyZ_clone_ptr(LDKCOption_SecretKeyZ *NONNULL_PTR arg) {
28666         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
28667         *ret_copy = COption_SecretKeyZ_clone(arg);
28668         int64_t ret_ref = tag_ptr(ret_copy, true);
28669         return ret_ref;
28670 }
28671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28672         LDKCOption_SecretKeyZ* arg_conv = (LDKCOption_SecretKeyZ*)untag_ptr(arg);
28673         int64_t ret_conv = COption_SecretKeyZ_clone_ptr(arg_conv);
28674         return ret_conv;
28675 }
28676
28677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28678         LDKCOption_SecretKeyZ* orig_conv = (LDKCOption_SecretKeyZ*)untag_ptr(orig);
28679         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
28680         *ret_copy = COption_SecretKeyZ_clone(orig_conv);
28681         int64_t ret_ref = tag_ptr(ret_copy, true);
28682         return ret_ref;
28683 }
28684
28685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28686         LDKVerifiedInvoiceRequest o_conv;
28687         o_conv.inner = untag_ptr(o);
28688         o_conv.is_owned = ptr_is_owned(o);
28689         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28690         o_conv = VerifiedInvoiceRequest_clone(&o_conv);
28691         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
28692         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_ok(o_conv);
28693         return tag_ptr(ret_conv, true);
28694 }
28695
28696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1err(JNIEnv *env, jclass clz) {
28697         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
28698         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_err();
28699         return tag_ptr(ret_conv, true);
28700 }
28701
28702 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28703         LDKCResult_VerifiedInvoiceRequestNoneZ* o_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(o);
28704         jboolean ret_conv = CResult_VerifiedInvoiceRequestNoneZ_is_ok(o_conv);
28705         return ret_conv;
28706 }
28707
28708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28709         if (!ptr_is_owned(_res)) return;
28710         void* _res_ptr = untag_ptr(_res);
28711         CHECK_ACCESS(_res_ptr);
28712         LDKCResult_VerifiedInvoiceRequestNoneZ _res_conv = *(LDKCResult_VerifiedInvoiceRequestNoneZ*)(_res_ptr);
28713         FREE(untag_ptr(_res));
28714         CResult_VerifiedInvoiceRequestNoneZ_free(_res_conv);
28715 }
28716
28717 static inline uint64_t CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR arg) {
28718         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
28719         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(arg);
28720         return tag_ptr(ret_conv, true);
28721 }
28722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28723         LDKCResult_VerifiedInvoiceRequestNoneZ* arg_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(arg);
28724         int64_t ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(arg_conv);
28725         return ret_conv;
28726 }
28727
28728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28729         LDKCResult_VerifiedInvoiceRequestNoneZ* orig_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(orig);
28730         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
28731         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(orig_conv);
28732         return tag_ptr(ret_conv, true);
28733 }
28734
28735 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1some(JNIEnv *env, jclass clz) {
28736         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_some());
28737         return ret_conv;
28738 }
28739
28740 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1none(JNIEnv *env, jclass clz) {
28741         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_none());
28742         return ret_conv;
28743 }
28744
28745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1free(JNIEnv *env, jclass clz, jclass _res) {
28746         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_java(env, _res);
28747         COption_NoneZ_free(_res_conv);
28748 }
28749
28750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1WitnessZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
28751         LDKCVec_WitnessZ _res_constr;
28752         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28753         if (_res_constr.datalen > 0)
28754                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
28755         else
28756                 _res_constr.data = NULL;
28757         for (size_t i = 0; i < _res_constr.datalen; i++) {
28758                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
28759                 LDKWitness _res_conv_8_ref;
28760                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
28761                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKWitness Bytes");
28762                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
28763                 _res_conv_8_ref.data_is_owned = true;
28764                 _res_constr.data[i] = _res_conv_8_ref;
28765         }
28766         CVec_WitnessZ_free(_res_constr);
28767 }
28768
28769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
28770         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
28771         *ret_copy = COption_i64Z_some(o);
28772         int64_t ret_ref = tag_ptr(ret_copy, true);
28773         return ret_ref;
28774 }
28775
28776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1none(JNIEnv *env, jclass clz) {
28777         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
28778         *ret_copy = COption_i64Z_none();
28779         int64_t ret_ref = tag_ptr(ret_copy, true);
28780         return ret_ref;
28781 }
28782
28783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
28784         if (!ptr_is_owned(_res)) return;
28785         void* _res_ptr = untag_ptr(_res);
28786         CHECK_ACCESS(_res_ptr);
28787         LDKCOption_i64Z _res_conv = *(LDKCOption_i64Z*)(_res_ptr);
28788         FREE(untag_ptr(_res));
28789         COption_i64Z_free(_res_conv);
28790 }
28791
28792 static inline uint64_t COption_i64Z_clone_ptr(LDKCOption_i64Z *NONNULL_PTR arg) {
28793         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
28794         *ret_copy = COption_i64Z_clone(arg);
28795         int64_t ret_ref = tag_ptr(ret_copy, true);
28796         return ret_ref;
28797 }
28798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28799         LDKCOption_i64Z* arg_conv = (LDKCOption_i64Z*)untag_ptr(arg);
28800         int64_t ret_conv = COption_i64Z_clone_ptr(arg_conv);
28801         return ret_conv;
28802 }
28803
28804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28805         LDKCOption_i64Z* orig_conv = (LDKCOption_i64Z*)untag_ptr(orig);
28806         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
28807         *ret_copy = COption_i64Z_clone(orig_conv);
28808         int64_t ret_ref = tag_ptr(ret_copy, true);
28809         return ret_ref;
28810 }
28811
28812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28813         void* o_ptr = untag_ptr(o);
28814         CHECK_ACCESS(o_ptr);
28815         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
28816         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
28817         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
28818         *ret_conv = CResult_SocketAddressDecodeErrorZ_ok(o_conv);
28819         return tag_ptr(ret_conv, true);
28820 }
28821
28822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28823         void* e_ptr = untag_ptr(e);
28824         CHECK_ACCESS(e_ptr);
28825         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28826         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28827         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
28828         *ret_conv = CResult_SocketAddressDecodeErrorZ_err(e_conv);
28829         return tag_ptr(ret_conv, true);
28830 }
28831
28832 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28833         LDKCResult_SocketAddressDecodeErrorZ* o_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(o);
28834         jboolean ret_conv = CResult_SocketAddressDecodeErrorZ_is_ok(o_conv);
28835         return ret_conv;
28836 }
28837
28838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28839         if (!ptr_is_owned(_res)) return;
28840         void* _res_ptr = untag_ptr(_res);
28841         CHECK_ACCESS(_res_ptr);
28842         LDKCResult_SocketAddressDecodeErrorZ _res_conv = *(LDKCResult_SocketAddressDecodeErrorZ*)(_res_ptr);
28843         FREE(untag_ptr(_res));
28844         CResult_SocketAddressDecodeErrorZ_free(_res_conv);
28845 }
28846
28847 static inline uint64_t CResult_SocketAddressDecodeErrorZ_clone_ptr(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR arg) {
28848         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
28849         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(arg);
28850         return tag_ptr(ret_conv, true);
28851 }
28852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28853         LDKCResult_SocketAddressDecodeErrorZ* arg_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(arg);
28854         int64_t ret_conv = CResult_SocketAddressDecodeErrorZ_clone_ptr(arg_conv);
28855         return ret_conv;
28856 }
28857
28858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28859         LDKCResult_SocketAddressDecodeErrorZ* orig_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(orig);
28860         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
28861         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(orig_conv);
28862         return tag_ptr(ret_conv, true);
28863 }
28864
28865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28866         void* o_ptr = untag_ptr(o);
28867         CHECK_ACCESS(o_ptr);
28868         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
28869         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
28870         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
28871         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_ok(o_conv);
28872         return tag_ptr(ret_conv, true);
28873 }
28874
28875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28876         LDKSocketAddressParseError e_conv = LDKSocketAddressParseError_from_java(env, e);
28877         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
28878         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_err(e_conv);
28879         return tag_ptr(ret_conv, true);
28880 }
28881
28882 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28883         LDKCResult_SocketAddressSocketAddressParseErrorZ* o_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(o);
28884         jboolean ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o_conv);
28885         return ret_conv;
28886 }
28887
28888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28889         if (!ptr_is_owned(_res)) return;
28890         void* _res_ptr = untag_ptr(_res);
28891         CHECK_ACCESS(_res_ptr);
28892         LDKCResult_SocketAddressSocketAddressParseErrorZ _res_conv = *(LDKCResult_SocketAddressSocketAddressParseErrorZ*)(_res_ptr);
28893         FREE(untag_ptr(_res));
28894         CResult_SocketAddressSocketAddressParseErrorZ_free(_res_conv);
28895 }
28896
28897 static inline uint64_t CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR arg) {
28898         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
28899         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(arg);
28900         return tag_ptr(ret_conv, true);
28901 }
28902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28903         LDKCResult_SocketAddressSocketAddressParseErrorZ* arg_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(arg);
28904         int64_t ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(arg_conv);
28905         return ret_conv;
28906 }
28907
28908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28909         LDKCResult_SocketAddressSocketAddressParseErrorZ* orig_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(orig);
28910         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
28911         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(orig_conv);
28912         return tag_ptr(ret_conv, true);
28913 }
28914
28915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
28916         LDKCVec_UpdateAddHTLCZ _res_constr;
28917         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28918         if (_res_constr.datalen > 0)
28919                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
28920         else
28921                 _res_constr.data = NULL;
28922         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
28923         for (size_t p = 0; p < _res_constr.datalen; p++) {
28924                 int64_t _res_conv_15 = _res_vals[p];
28925                 LDKUpdateAddHTLC _res_conv_15_conv;
28926                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
28927                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
28928                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
28929                 _res_constr.data[p] = _res_conv_15_conv;
28930         }
28931         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
28932         CVec_UpdateAddHTLCZ_free(_res_constr);
28933 }
28934
28935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
28936         LDKCVec_UpdateFulfillHTLCZ _res_constr;
28937         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28938         if (_res_constr.datalen > 0)
28939                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
28940         else
28941                 _res_constr.data = NULL;
28942         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
28943         for (size_t t = 0; t < _res_constr.datalen; t++) {
28944                 int64_t _res_conv_19 = _res_vals[t];
28945                 LDKUpdateFulfillHTLC _res_conv_19_conv;
28946                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
28947                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
28948                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
28949                 _res_constr.data[t] = _res_conv_19_conv;
28950         }
28951         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
28952         CVec_UpdateFulfillHTLCZ_free(_res_constr);
28953 }
28954
28955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
28956         LDKCVec_UpdateFailHTLCZ _res_constr;
28957         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28958         if (_res_constr.datalen > 0)
28959                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
28960         else
28961                 _res_constr.data = NULL;
28962         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
28963         for (size_t q = 0; q < _res_constr.datalen; q++) {
28964                 int64_t _res_conv_16 = _res_vals[q];
28965                 LDKUpdateFailHTLC _res_conv_16_conv;
28966                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
28967                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
28968                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
28969                 _res_constr.data[q] = _res_conv_16_conv;
28970         }
28971         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
28972         CVec_UpdateFailHTLCZ_free(_res_constr);
28973 }
28974
28975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
28976         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
28977         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28978         if (_res_constr.datalen > 0)
28979                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
28980         else
28981                 _res_constr.data = NULL;
28982         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
28983         for (size_t z = 0; z < _res_constr.datalen; z++) {
28984                 int64_t _res_conv_25 = _res_vals[z];
28985                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
28986                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
28987                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
28988                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
28989                 _res_constr.data[z] = _res_conv_25_conv;
28990         }
28991         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
28992         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
28993 }
28994
28995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28996         LDKAcceptChannel o_conv;
28997         o_conv.inner = untag_ptr(o);
28998         o_conv.is_owned = ptr_is_owned(o);
28999         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29000         o_conv = AcceptChannel_clone(&o_conv);
29001         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
29002         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
29003         return tag_ptr(ret_conv, true);
29004 }
29005
29006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29007         void* e_ptr = untag_ptr(e);
29008         CHECK_ACCESS(e_ptr);
29009         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29010         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29011         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
29012         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
29013         return tag_ptr(ret_conv, true);
29014 }
29015
29016 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29017         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
29018         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
29019         return ret_conv;
29020 }
29021
29022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29023         if (!ptr_is_owned(_res)) return;
29024         void* _res_ptr = untag_ptr(_res);
29025         CHECK_ACCESS(_res_ptr);
29026         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
29027         FREE(untag_ptr(_res));
29028         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
29029 }
29030
29031 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
29032         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
29033         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
29034         return tag_ptr(ret_conv, true);
29035 }
29036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29037         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
29038         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
29039         return ret_conv;
29040 }
29041
29042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29043         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
29044         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
29045         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
29046         return tag_ptr(ret_conv, true);
29047 }
29048
29049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29050         LDKAcceptChannelV2 o_conv;
29051         o_conv.inner = untag_ptr(o);
29052         o_conv.is_owned = ptr_is_owned(o);
29053         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29054         o_conv = AcceptChannelV2_clone(&o_conv);
29055         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
29056         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_ok(o_conv);
29057         return tag_ptr(ret_conv, true);
29058 }
29059
29060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29061         void* e_ptr = untag_ptr(e);
29062         CHECK_ACCESS(e_ptr);
29063         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29064         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29065         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
29066         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_err(e_conv);
29067         return tag_ptr(ret_conv, true);
29068 }
29069
29070 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29071         LDKCResult_AcceptChannelV2DecodeErrorZ* o_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(o);
29072         jboolean ret_conv = CResult_AcceptChannelV2DecodeErrorZ_is_ok(o_conv);
29073         return ret_conv;
29074 }
29075
29076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29077         if (!ptr_is_owned(_res)) return;
29078         void* _res_ptr = untag_ptr(_res);
29079         CHECK_ACCESS(_res_ptr);
29080         LDKCResult_AcceptChannelV2DecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelV2DecodeErrorZ*)(_res_ptr);
29081         FREE(untag_ptr(_res));
29082         CResult_AcceptChannelV2DecodeErrorZ_free(_res_conv);
29083 }
29084
29085 static inline uint64_t CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR arg) {
29086         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
29087         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(arg);
29088         return tag_ptr(ret_conv, true);
29089 }
29090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29091         LDKCResult_AcceptChannelV2DecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(arg);
29092         int64_t ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(arg_conv);
29093         return ret_conv;
29094 }
29095
29096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29097         LDKCResult_AcceptChannelV2DecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(orig);
29098         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
29099         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(orig_conv);
29100         return tag_ptr(ret_conv, true);
29101 }
29102
29103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29104         LDKTxAddInput o_conv;
29105         o_conv.inner = untag_ptr(o);
29106         o_conv.is_owned = ptr_is_owned(o);
29107         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29108         o_conv = TxAddInput_clone(&o_conv);
29109         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
29110         *ret_conv = CResult_TxAddInputDecodeErrorZ_ok(o_conv);
29111         return tag_ptr(ret_conv, true);
29112 }
29113
29114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29115         void* e_ptr = untag_ptr(e);
29116         CHECK_ACCESS(e_ptr);
29117         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29118         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29119         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
29120         *ret_conv = CResult_TxAddInputDecodeErrorZ_err(e_conv);
29121         return tag_ptr(ret_conv, true);
29122 }
29123
29124 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29125         LDKCResult_TxAddInputDecodeErrorZ* o_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(o);
29126         jboolean ret_conv = CResult_TxAddInputDecodeErrorZ_is_ok(o_conv);
29127         return ret_conv;
29128 }
29129
29130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29131         if (!ptr_is_owned(_res)) return;
29132         void* _res_ptr = untag_ptr(_res);
29133         CHECK_ACCESS(_res_ptr);
29134         LDKCResult_TxAddInputDecodeErrorZ _res_conv = *(LDKCResult_TxAddInputDecodeErrorZ*)(_res_ptr);
29135         FREE(untag_ptr(_res));
29136         CResult_TxAddInputDecodeErrorZ_free(_res_conv);
29137 }
29138
29139 static inline uint64_t CResult_TxAddInputDecodeErrorZ_clone_ptr(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR arg) {
29140         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
29141         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(arg);
29142         return tag_ptr(ret_conv, true);
29143 }
29144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29145         LDKCResult_TxAddInputDecodeErrorZ* arg_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(arg);
29146         int64_t ret_conv = CResult_TxAddInputDecodeErrorZ_clone_ptr(arg_conv);
29147         return ret_conv;
29148 }
29149
29150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29151         LDKCResult_TxAddInputDecodeErrorZ* orig_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(orig);
29152         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
29153         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(orig_conv);
29154         return tag_ptr(ret_conv, true);
29155 }
29156
29157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29158         LDKTxAddOutput o_conv;
29159         o_conv.inner = untag_ptr(o);
29160         o_conv.is_owned = ptr_is_owned(o);
29161         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29162         o_conv = TxAddOutput_clone(&o_conv);
29163         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
29164         *ret_conv = CResult_TxAddOutputDecodeErrorZ_ok(o_conv);
29165         return tag_ptr(ret_conv, true);
29166 }
29167
29168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29169         void* e_ptr = untag_ptr(e);
29170         CHECK_ACCESS(e_ptr);
29171         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29172         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29173         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
29174         *ret_conv = CResult_TxAddOutputDecodeErrorZ_err(e_conv);
29175         return tag_ptr(ret_conv, true);
29176 }
29177
29178 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29179         LDKCResult_TxAddOutputDecodeErrorZ* o_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(o);
29180         jboolean ret_conv = CResult_TxAddOutputDecodeErrorZ_is_ok(o_conv);
29181         return ret_conv;
29182 }
29183
29184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29185         if (!ptr_is_owned(_res)) return;
29186         void* _res_ptr = untag_ptr(_res);
29187         CHECK_ACCESS(_res_ptr);
29188         LDKCResult_TxAddOutputDecodeErrorZ _res_conv = *(LDKCResult_TxAddOutputDecodeErrorZ*)(_res_ptr);
29189         FREE(untag_ptr(_res));
29190         CResult_TxAddOutputDecodeErrorZ_free(_res_conv);
29191 }
29192
29193 static inline uint64_t CResult_TxAddOutputDecodeErrorZ_clone_ptr(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR arg) {
29194         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
29195         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(arg);
29196         return tag_ptr(ret_conv, true);
29197 }
29198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29199         LDKCResult_TxAddOutputDecodeErrorZ* arg_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(arg);
29200         int64_t ret_conv = CResult_TxAddOutputDecodeErrorZ_clone_ptr(arg_conv);
29201         return ret_conv;
29202 }
29203
29204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29205         LDKCResult_TxAddOutputDecodeErrorZ* orig_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(orig);
29206         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
29207         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(orig_conv);
29208         return tag_ptr(ret_conv, true);
29209 }
29210
29211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29212         LDKTxRemoveInput o_conv;
29213         o_conv.inner = untag_ptr(o);
29214         o_conv.is_owned = ptr_is_owned(o);
29215         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29216         o_conv = TxRemoveInput_clone(&o_conv);
29217         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
29218         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_ok(o_conv);
29219         return tag_ptr(ret_conv, true);
29220 }
29221
29222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29223         void* e_ptr = untag_ptr(e);
29224         CHECK_ACCESS(e_ptr);
29225         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29226         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29227         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
29228         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_err(e_conv);
29229         return tag_ptr(ret_conv, true);
29230 }
29231
29232 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29233         LDKCResult_TxRemoveInputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(o);
29234         jboolean ret_conv = CResult_TxRemoveInputDecodeErrorZ_is_ok(o_conv);
29235         return ret_conv;
29236 }
29237
29238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29239         if (!ptr_is_owned(_res)) return;
29240         void* _res_ptr = untag_ptr(_res);
29241         CHECK_ACCESS(_res_ptr);
29242         LDKCResult_TxRemoveInputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveInputDecodeErrorZ*)(_res_ptr);
29243         FREE(untag_ptr(_res));
29244         CResult_TxRemoveInputDecodeErrorZ_free(_res_conv);
29245 }
29246
29247 static inline uint64_t CResult_TxRemoveInputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR arg) {
29248         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
29249         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(arg);
29250         return tag_ptr(ret_conv, true);
29251 }
29252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29253         LDKCResult_TxRemoveInputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(arg);
29254         int64_t ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone_ptr(arg_conv);
29255         return ret_conv;
29256 }
29257
29258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29259         LDKCResult_TxRemoveInputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(orig);
29260         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
29261         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(orig_conv);
29262         return tag_ptr(ret_conv, true);
29263 }
29264
29265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29266         LDKTxRemoveOutput o_conv;
29267         o_conv.inner = untag_ptr(o);
29268         o_conv.is_owned = ptr_is_owned(o);
29269         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29270         o_conv = TxRemoveOutput_clone(&o_conv);
29271         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
29272         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_ok(o_conv);
29273         return tag_ptr(ret_conv, true);
29274 }
29275
29276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29277         void* e_ptr = untag_ptr(e);
29278         CHECK_ACCESS(e_ptr);
29279         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29280         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29281         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
29282         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_err(e_conv);
29283         return tag_ptr(ret_conv, true);
29284 }
29285
29286 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29287         LDKCResult_TxRemoveOutputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(o);
29288         jboolean ret_conv = CResult_TxRemoveOutputDecodeErrorZ_is_ok(o_conv);
29289         return ret_conv;
29290 }
29291
29292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29293         if (!ptr_is_owned(_res)) return;
29294         void* _res_ptr = untag_ptr(_res);
29295         CHECK_ACCESS(_res_ptr);
29296         LDKCResult_TxRemoveOutputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveOutputDecodeErrorZ*)(_res_ptr);
29297         FREE(untag_ptr(_res));
29298         CResult_TxRemoveOutputDecodeErrorZ_free(_res_conv);
29299 }
29300
29301 static inline uint64_t CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR arg) {
29302         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
29303         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(arg);
29304         return tag_ptr(ret_conv, true);
29305 }
29306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29307         LDKCResult_TxRemoveOutputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(arg);
29308         int64_t ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(arg_conv);
29309         return ret_conv;
29310 }
29311
29312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29313         LDKCResult_TxRemoveOutputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(orig);
29314         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
29315         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(orig_conv);
29316         return tag_ptr(ret_conv, true);
29317 }
29318
29319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29320         LDKTxComplete o_conv;
29321         o_conv.inner = untag_ptr(o);
29322         o_conv.is_owned = ptr_is_owned(o);
29323         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29324         o_conv = TxComplete_clone(&o_conv);
29325         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
29326         *ret_conv = CResult_TxCompleteDecodeErrorZ_ok(o_conv);
29327         return tag_ptr(ret_conv, true);
29328 }
29329
29330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29331         void* e_ptr = untag_ptr(e);
29332         CHECK_ACCESS(e_ptr);
29333         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29334         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29335         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
29336         *ret_conv = CResult_TxCompleteDecodeErrorZ_err(e_conv);
29337         return tag_ptr(ret_conv, true);
29338 }
29339
29340 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29341         LDKCResult_TxCompleteDecodeErrorZ* o_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(o);
29342         jboolean ret_conv = CResult_TxCompleteDecodeErrorZ_is_ok(o_conv);
29343         return ret_conv;
29344 }
29345
29346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29347         if (!ptr_is_owned(_res)) return;
29348         void* _res_ptr = untag_ptr(_res);
29349         CHECK_ACCESS(_res_ptr);
29350         LDKCResult_TxCompleteDecodeErrorZ _res_conv = *(LDKCResult_TxCompleteDecodeErrorZ*)(_res_ptr);
29351         FREE(untag_ptr(_res));
29352         CResult_TxCompleteDecodeErrorZ_free(_res_conv);
29353 }
29354
29355 static inline uint64_t CResult_TxCompleteDecodeErrorZ_clone_ptr(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR arg) {
29356         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
29357         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(arg);
29358         return tag_ptr(ret_conv, true);
29359 }
29360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29361         LDKCResult_TxCompleteDecodeErrorZ* arg_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(arg);
29362         int64_t ret_conv = CResult_TxCompleteDecodeErrorZ_clone_ptr(arg_conv);
29363         return ret_conv;
29364 }
29365
29366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29367         LDKCResult_TxCompleteDecodeErrorZ* orig_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(orig);
29368         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
29369         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(orig_conv);
29370         return tag_ptr(ret_conv, true);
29371 }
29372
29373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29374         LDKTxSignatures o_conv;
29375         o_conv.inner = untag_ptr(o);
29376         o_conv.is_owned = ptr_is_owned(o);
29377         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29378         o_conv = TxSignatures_clone(&o_conv);
29379         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
29380         *ret_conv = CResult_TxSignaturesDecodeErrorZ_ok(o_conv);
29381         return tag_ptr(ret_conv, true);
29382 }
29383
29384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29385         void* e_ptr = untag_ptr(e);
29386         CHECK_ACCESS(e_ptr);
29387         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29388         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29389         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
29390         *ret_conv = CResult_TxSignaturesDecodeErrorZ_err(e_conv);
29391         return tag_ptr(ret_conv, true);
29392 }
29393
29394 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29395         LDKCResult_TxSignaturesDecodeErrorZ* o_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(o);
29396         jboolean ret_conv = CResult_TxSignaturesDecodeErrorZ_is_ok(o_conv);
29397         return ret_conv;
29398 }
29399
29400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29401         if (!ptr_is_owned(_res)) return;
29402         void* _res_ptr = untag_ptr(_res);
29403         CHECK_ACCESS(_res_ptr);
29404         LDKCResult_TxSignaturesDecodeErrorZ _res_conv = *(LDKCResult_TxSignaturesDecodeErrorZ*)(_res_ptr);
29405         FREE(untag_ptr(_res));
29406         CResult_TxSignaturesDecodeErrorZ_free(_res_conv);
29407 }
29408
29409 static inline uint64_t CResult_TxSignaturesDecodeErrorZ_clone_ptr(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR arg) {
29410         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
29411         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(arg);
29412         return tag_ptr(ret_conv, true);
29413 }
29414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29415         LDKCResult_TxSignaturesDecodeErrorZ* arg_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(arg);
29416         int64_t ret_conv = CResult_TxSignaturesDecodeErrorZ_clone_ptr(arg_conv);
29417         return ret_conv;
29418 }
29419
29420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29421         LDKCResult_TxSignaturesDecodeErrorZ* orig_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(orig);
29422         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
29423         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(orig_conv);
29424         return tag_ptr(ret_conv, true);
29425 }
29426
29427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29428         LDKTxInitRbf o_conv;
29429         o_conv.inner = untag_ptr(o);
29430         o_conv.is_owned = ptr_is_owned(o);
29431         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29432         o_conv = TxInitRbf_clone(&o_conv);
29433         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
29434         *ret_conv = CResult_TxInitRbfDecodeErrorZ_ok(o_conv);
29435         return tag_ptr(ret_conv, true);
29436 }
29437
29438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29439         void* e_ptr = untag_ptr(e);
29440         CHECK_ACCESS(e_ptr);
29441         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29442         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29443         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
29444         *ret_conv = CResult_TxInitRbfDecodeErrorZ_err(e_conv);
29445         return tag_ptr(ret_conv, true);
29446 }
29447
29448 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29449         LDKCResult_TxInitRbfDecodeErrorZ* o_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(o);
29450         jboolean ret_conv = CResult_TxInitRbfDecodeErrorZ_is_ok(o_conv);
29451         return ret_conv;
29452 }
29453
29454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29455         if (!ptr_is_owned(_res)) return;
29456         void* _res_ptr = untag_ptr(_res);
29457         CHECK_ACCESS(_res_ptr);
29458         LDKCResult_TxInitRbfDecodeErrorZ _res_conv = *(LDKCResult_TxInitRbfDecodeErrorZ*)(_res_ptr);
29459         FREE(untag_ptr(_res));
29460         CResult_TxInitRbfDecodeErrorZ_free(_res_conv);
29461 }
29462
29463 static inline uint64_t CResult_TxInitRbfDecodeErrorZ_clone_ptr(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR arg) {
29464         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
29465         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(arg);
29466         return tag_ptr(ret_conv, true);
29467 }
29468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29469         LDKCResult_TxInitRbfDecodeErrorZ* arg_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(arg);
29470         int64_t ret_conv = CResult_TxInitRbfDecodeErrorZ_clone_ptr(arg_conv);
29471         return ret_conv;
29472 }
29473
29474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29475         LDKCResult_TxInitRbfDecodeErrorZ* orig_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(orig);
29476         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
29477         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(orig_conv);
29478         return tag_ptr(ret_conv, true);
29479 }
29480
29481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29482         LDKTxAckRbf o_conv;
29483         o_conv.inner = untag_ptr(o);
29484         o_conv.is_owned = ptr_is_owned(o);
29485         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29486         o_conv = TxAckRbf_clone(&o_conv);
29487         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
29488         *ret_conv = CResult_TxAckRbfDecodeErrorZ_ok(o_conv);
29489         return tag_ptr(ret_conv, true);
29490 }
29491
29492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29493         void* e_ptr = untag_ptr(e);
29494         CHECK_ACCESS(e_ptr);
29495         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29496         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29497         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
29498         *ret_conv = CResult_TxAckRbfDecodeErrorZ_err(e_conv);
29499         return tag_ptr(ret_conv, true);
29500 }
29501
29502 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29503         LDKCResult_TxAckRbfDecodeErrorZ* o_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(o);
29504         jboolean ret_conv = CResult_TxAckRbfDecodeErrorZ_is_ok(o_conv);
29505         return ret_conv;
29506 }
29507
29508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29509         if (!ptr_is_owned(_res)) return;
29510         void* _res_ptr = untag_ptr(_res);
29511         CHECK_ACCESS(_res_ptr);
29512         LDKCResult_TxAckRbfDecodeErrorZ _res_conv = *(LDKCResult_TxAckRbfDecodeErrorZ*)(_res_ptr);
29513         FREE(untag_ptr(_res));
29514         CResult_TxAckRbfDecodeErrorZ_free(_res_conv);
29515 }
29516
29517 static inline uint64_t CResult_TxAckRbfDecodeErrorZ_clone_ptr(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR arg) {
29518         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
29519         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(arg);
29520         return tag_ptr(ret_conv, true);
29521 }
29522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29523         LDKCResult_TxAckRbfDecodeErrorZ* arg_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(arg);
29524         int64_t ret_conv = CResult_TxAckRbfDecodeErrorZ_clone_ptr(arg_conv);
29525         return ret_conv;
29526 }
29527
29528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29529         LDKCResult_TxAckRbfDecodeErrorZ* orig_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(orig);
29530         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
29531         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(orig_conv);
29532         return tag_ptr(ret_conv, true);
29533 }
29534
29535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29536         LDKTxAbort o_conv;
29537         o_conv.inner = untag_ptr(o);
29538         o_conv.is_owned = ptr_is_owned(o);
29539         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29540         o_conv = TxAbort_clone(&o_conv);
29541         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
29542         *ret_conv = CResult_TxAbortDecodeErrorZ_ok(o_conv);
29543         return tag_ptr(ret_conv, true);
29544 }
29545
29546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29547         void* e_ptr = untag_ptr(e);
29548         CHECK_ACCESS(e_ptr);
29549         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29550         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29551         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
29552         *ret_conv = CResult_TxAbortDecodeErrorZ_err(e_conv);
29553         return tag_ptr(ret_conv, true);
29554 }
29555
29556 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29557         LDKCResult_TxAbortDecodeErrorZ* o_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(o);
29558         jboolean ret_conv = CResult_TxAbortDecodeErrorZ_is_ok(o_conv);
29559         return ret_conv;
29560 }
29561
29562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29563         if (!ptr_is_owned(_res)) return;
29564         void* _res_ptr = untag_ptr(_res);
29565         CHECK_ACCESS(_res_ptr);
29566         LDKCResult_TxAbortDecodeErrorZ _res_conv = *(LDKCResult_TxAbortDecodeErrorZ*)(_res_ptr);
29567         FREE(untag_ptr(_res));
29568         CResult_TxAbortDecodeErrorZ_free(_res_conv);
29569 }
29570
29571 static inline uint64_t CResult_TxAbortDecodeErrorZ_clone_ptr(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR arg) {
29572         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
29573         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(arg);
29574         return tag_ptr(ret_conv, true);
29575 }
29576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29577         LDKCResult_TxAbortDecodeErrorZ* arg_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(arg);
29578         int64_t ret_conv = CResult_TxAbortDecodeErrorZ_clone_ptr(arg_conv);
29579         return ret_conv;
29580 }
29581
29582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29583         LDKCResult_TxAbortDecodeErrorZ* orig_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(orig);
29584         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
29585         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(orig_conv);
29586         return tag_ptr(ret_conv, true);
29587 }
29588
29589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29590         LDKAnnouncementSignatures o_conv;
29591         o_conv.inner = untag_ptr(o);
29592         o_conv.is_owned = ptr_is_owned(o);
29593         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29594         o_conv = AnnouncementSignatures_clone(&o_conv);
29595         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
29596         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
29597         return tag_ptr(ret_conv, true);
29598 }
29599
29600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29601         void* e_ptr = untag_ptr(e);
29602         CHECK_ACCESS(e_ptr);
29603         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29604         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29605         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
29606         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
29607         return tag_ptr(ret_conv, true);
29608 }
29609
29610 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29611         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
29612         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
29613         return ret_conv;
29614 }
29615
29616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29617         if (!ptr_is_owned(_res)) return;
29618         void* _res_ptr = untag_ptr(_res);
29619         CHECK_ACCESS(_res_ptr);
29620         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
29621         FREE(untag_ptr(_res));
29622         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
29623 }
29624
29625 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
29626         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
29627         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
29628         return tag_ptr(ret_conv, true);
29629 }
29630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29631         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
29632         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
29633         return ret_conv;
29634 }
29635
29636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29637         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
29638         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
29639         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
29640         return tag_ptr(ret_conv, true);
29641 }
29642
29643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29644         LDKChannelReestablish o_conv;
29645         o_conv.inner = untag_ptr(o);
29646         o_conv.is_owned = ptr_is_owned(o);
29647         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29648         o_conv = ChannelReestablish_clone(&o_conv);
29649         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
29650         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
29651         return tag_ptr(ret_conv, true);
29652 }
29653
29654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29655         void* e_ptr = untag_ptr(e);
29656         CHECK_ACCESS(e_ptr);
29657         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29658         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29659         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
29660         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
29661         return tag_ptr(ret_conv, true);
29662 }
29663
29664 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29665         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
29666         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
29667         return ret_conv;
29668 }
29669
29670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29671         if (!ptr_is_owned(_res)) return;
29672         void* _res_ptr = untag_ptr(_res);
29673         CHECK_ACCESS(_res_ptr);
29674         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
29675         FREE(untag_ptr(_res));
29676         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
29677 }
29678
29679 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
29680         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
29681         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
29682         return tag_ptr(ret_conv, true);
29683 }
29684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29685         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
29686         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
29687         return ret_conv;
29688 }
29689
29690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29691         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
29692         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
29693         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
29694         return tag_ptr(ret_conv, true);
29695 }
29696
29697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29698         LDKClosingSigned o_conv;
29699         o_conv.inner = untag_ptr(o);
29700         o_conv.is_owned = ptr_is_owned(o);
29701         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29702         o_conv = ClosingSigned_clone(&o_conv);
29703         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
29704         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
29705         return tag_ptr(ret_conv, true);
29706 }
29707
29708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29709         void* e_ptr = untag_ptr(e);
29710         CHECK_ACCESS(e_ptr);
29711         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29712         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29713         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
29714         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
29715         return tag_ptr(ret_conv, true);
29716 }
29717
29718 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29719         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
29720         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
29721         return ret_conv;
29722 }
29723
29724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29725         if (!ptr_is_owned(_res)) return;
29726         void* _res_ptr = untag_ptr(_res);
29727         CHECK_ACCESS(_res_ptr);
29728         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
29729         FREE(untag_ptr(_res));
29730         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
29731 }
29732
29733 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
29734         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
29735         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
29736         return tag_ptr(ret_conv, true);
29737 }
29738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29739         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
29740         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
29741         return ret_conv;
29742 }
29743
29744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29745         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
29746         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
29747         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
29748         return tag_ptr(ret_conv, true);
29749 }
29750
29751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29752         LDKClosingSignedFeeRange o_conv;
29753         o_conv.inner = untag_ptr(o);
29754         o_conv.is_owned = ptr_is_owned(o);
29755         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29756         o_conv = ClosingSignedFeeRange_clone(&o_conv);
29757         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
29758         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
29759         return tag_ptr(ret_conv, true);
29760 }
29761
29762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29763         void* e_ptr = untag_ptr(e);
29764         CHECK_ACCESS(e_ptr);
29765         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29766         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29767         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
29768         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
29769         return tag_ptr(ret_conv, true);
29770 }
29771
29772 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29773         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
29774         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
29775         return ret_conv;
29776 }
29777
29778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29779         if (!ptr_is_owned(_res)) return;
29780         void* _res_ptr = untag_ptr(_res);
29781         CHECK_ACCESS(_res_ptr);
29782         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
29783         FREE(untag_ptr(_res));
29784         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
29785 }
29786
29787 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
29788         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
29789         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
29790         return tag_ptr(ret_conv, true);
29791 }
29792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29793         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
29794         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
29795         return ret_conv;
29796 }
29797
29798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29799         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
29800         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
29801         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
29802         return tag_ptr(ret_conv, true);
29803 }
29804
29805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29806         LDKCommitmentSigned o_conv;
29807         o_conv.inner = untag_ptr(o);
29808         o_conv.is_owned = ptr_is_owned(o);
29809         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29810         o_conv = CommitmentSigned_clone(&o_conv);
29811         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
29812         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
29813         return tag_ptr(ret_conv, true);
29814 }
29815
29816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29817         void* e_ptr = untag_ptr(e);
29818         CHECK_ACCESS(e_ptr);
29819         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29820         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29821         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
29822         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
29823         return tag_ptr(ret_conv, true);
29824 }
29825
29826 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29827         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
29828         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
29829         return ret_conv;
29830 }
29831
29832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29833         if (!ptr_is_owned(_res)) return;
29834         void* _res_ptr = untag_ptr(_res);
29835         CHECK_ACCESS(_res_ptr);
29836         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
29837         FREE(untag_ptr(_res));
29838         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
29839 }
29840
29841 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
29842         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
29843         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
29844         return tag_ptr(ret_conv, true);
29845 }
29846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29847         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
29848         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
29849         return ret_conv;
29850 }
29851
29852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29853         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
29854         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
29855         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
29856         return tag_ptr(ret_conv, true);
29857 }
29858
29859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29860         LDKFundingCreated o_conv;
29861         o_conv.inner = untag_ptr(o);
29862         o_conv.is_owned = ptr_is_owned(o);
29863         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29864         o_conv = FundingCreated_clone(&o_conv);
29865         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
29866         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
29867         return tag_ptr(ret_conv, true);
29868 }
29869
29870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29871         void* e_ptr = untag_ptr(e);
29872         CHECK_ACCESS(e_ptr);
29873         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29874         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29875         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
29876         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
29877         return tag_ptr(ret_conv, true);
29878 }
29879
29880 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29881         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
29882         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
29883         return ret_conv;
29884 }
29885
29886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29887         if (!ptr_is_owned(_res)) return;
29888         void* _res_ptr = untag_ptr(_res);
29889         CHECK_ACCESS(_res_ptr);
29890         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
29891         FREE(untag_ptr(_res));
29892         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
29893 }
29894
29895 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
29896         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
29897         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
29898         return tag_ptr(ret_conv, true);
29899 }
29900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29901         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
29902         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
29903         return ret_conv;
29904 }
29905
29906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29907         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
29908         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
29909         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
29910         return tag_ptr(ret_conv, true);
29911 }
29912
29913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29914         LDKFundingSigned o_conv;
29915         o_conv.inner = untag_ptr(o);
29916         o_conv.is_owned = ptr_is_owned(o);
29917         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29918         o_conv = FundingSigned_clone(&o_conv);
29919         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
29920         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
29921         return tag_ptr(ret_conv, true);
29922 }
29923
29924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29925         void* e_ptr = untag_ptr(e);
29926         CHECK_ACCESS(e_ptr);
29927         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29928         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29929         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
29930         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
29931         return tag_ptr(ret_conv, true);
29932 }
29933
29934 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29935         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
29936         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
29937         return ret_conv;
29938 }
29939
29940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29941         if (!ptr_is_owned(_res)) return;
29942         void* _res_ptr = untag_ptr(_res);
29943         CHECK_ACCESS(_res_ptr);
29944         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
29945         FREE(untag_ptr(_res));
29946         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
29947 }
29948
29949 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
29950         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
29951         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
29952         return tag_ptr(ret_conv, true);
29953 }
29954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29955         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
29956         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
29957         return ret_conv;
29958 }
29959
29960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29961         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
29962         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
29963         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
29964         return tag_ptr(ret_conv, true);
29965 }
29966
29967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29968         LDKChannelReady o_conv;
29969         o_conv.inner = untag_ptr(o);
29970         o_conv.is_owned = ptr_is_owned(o);
29971         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29972         o_conv = ChannelReady_clone(&o_conv);
29973         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
29974         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
29975         return tag_ptr(ret_conv, true);
29976 }
29977
29978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29979         void* e_ptr = untag_ptr(e);
29980         CHECK_ACCESS(e_ptr);
29981         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29982         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29983         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
29984         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
29985         return tag_ptr(ret_conv, true);
29986 }
29987
29988 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29989         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
29990         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
29991         return ret_conv;
29992 }
29993
29994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29995         if (!ptr_is_owned(_res)) return;
29996         void* _res_ptr = untag_ptr(_res);
29997         CHECK_ACCESS(_res_ptr);
29998         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
29999         FREE(untag_ptr(_res));
30000         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
30001 }
30002
30003 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
30004         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
30005         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
30006         return tag_ptr(ret_conv, true);
30007 }
30008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30009         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
30010         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
30011         return ret_conv;
30012 }
30013
30014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30015         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
30016         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
30017         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
30018         return tag_ptr(ret_conv, true);
30019 }
30020
30021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30022         LDKInit o_conv;
30023         o_conv.inner = untag_ptr(o);
30024         o_conv.is_owned = ptr_is_owned(o);
30025         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30026         o_conv = Init_clone(&o_conv);
30027         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
30028         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
30029         return tag_ptr(ret_conv, true);
30030 }
30031
30032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30033         void* e_ptr = untag_ptr(e);
30034         CHECK_ACCESS(e_ptr);
30035         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30036         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30037         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
30038         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
30039         return tag_ptr(ret_conv, true);
30040 }
30041
30042 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30043         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
30044         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
30045         return ret_conv;
30046 }
30047
30048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30049         if (!ptr_is_owned(_res)) return;
30050         void* _res_ptr = untag_ptr(_res);
30051         CHECK_ACCESS(_res_ptr);
30052         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
30053         FREE(untag_ptr(_res));
30054         CResult_InitDecodeErrorZ_free(_res_conv);
30055 }
30056
30057 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
30058         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
30059         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
30060         return tag_ptr(ret_conv, true);
30061 }
30062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30063         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
30064         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
30065         return ret_conv;
30066 }
30067
30068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30069         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
30070         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
30071         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
30072         return tag_ptr(ret_conv, true);
30073 }
30074
30075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30076         LDKOpenChannel o_conv;
30077         o_conv.inner = untag_ptr(o);
30078         o_conv.is_owned = ptr_is_owned(o);
30079         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30080         o_conv = OpenChannel_clone(&o_conv);
30081         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
30082         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
30083         return tag_ptr(ret_conv, true);
30084 }
30085
30086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30087         void* e_ptr = untag_ptr(e);
30088         CHECK_ACCESS(e_ptr);
30089         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30090         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30091         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
30092         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
30093         return tag_ptr(ret_conv, true);
30094 }
30095
30096 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30097         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
30098         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
30099         return ret_conv;
30100 }
30101
30102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30103         if (!ptr_is_owned(_res)) return;
30104         void* _res_ptr = untag_ptr(_res);
30105         CHECK_ACCESS(_res_ptr);
30106         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
30107         FREE(untag_ptr(_res));
30108         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
30109 }
30110
30111 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
30112         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
30113         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
30114         return tag_ptr(ret_conv, true);
30115 }
30116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30117         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
30118         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
30119         return ret_conv;
30120 }
30121
30122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30123         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
30124         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
30125         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
30126         return tag_ptr(ret_conv, true);
30127 }
30128
30129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30130         LDKOpenChannelV2 o_conv;
30131         o_conv.inner = untag_ptr(o);
30132         o_conv.is_owned = ptr_is_owned(o);
30133         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30134         o_conv = OpenChannelV2_clone(&o_conv);
30135         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
30136         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_ok(o_conv);
30137         return tag_ptr(ret_conv, true);
30138 }
30139
30140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30141         void* e_ptr = untag_ptr(e);
30142         CHECK_ACCESS(e_ptr);
30143         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30144         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30145         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
30146         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_err(e_conv);
30147         return tag_ptr(ret_conv, true);
30148 }
30149
30150 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30151         LDKCResult_OpenChannelV2DecodeErrorZ* o_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(o);
30152         jboolean ret_conv = CResult_OpenChannelV2DecodeErrorZ_is_ok(o_conv);
30153         return ret_conv;
30154 }
30155
30156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30157         if (!ptr_is_owned(_res)) return;
30158         void* _res_ptr = untag_ptr(_res);
30159         CHECK_ACCESS(_res_ptr);
30160         LDKCResult_OpenChannelV2DecodeErrorZ _res_conv = *(LDKCResult_OpenChannelV2DecodeErrorZ*)(_res_ptr);
30161         FREE(untag_ptr(_res));
30162         CResult_OpenChannelV2DecodeErrorZ_free(_res_conv);
30163 }
30164
30165 static inline uint64_t CResult_OpenChannelV2DecodeErrorZ_clone_ptr(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR arg) {
30166         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
30167         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(arg);
30168         return tag_ptr(ret_conv, true);
30169 }
30170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30171         LDKCResult_OpenChannelV2DecodeErrorZ* arg_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(arg);
30172         int64_t ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone_ptr(arg_conv);
30173         return ret_conv;
30174 }
30175
30176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30177         LDKCResult_OpenChannelV2DecodeErrorZ* orig_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(orig);
30178         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
30179         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(orig_conv);
30180         return tag_ptr(ret_conv, true);
30181 }
30182
30183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30184         LDKRevokeAndACK o_conv;
30185         o_conv.inner = untag_ptr(o);
30186         o_conv.is_owned = ptr_is_owned(o);
30187         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30188         o_conv = RevokeAndACK_clone(&o_conv);
30189         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
30190         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
30191         return tag_ptr(ret_conv, true);
30192 }
30193
30194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30195         void* e_ptr = untag_ptr(e);
30196         CHECK_ACCESS(e_ptr);
30197         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30198         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30199         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
30200         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
30201         return tag_ptr(ret_conv, true);
30202 }
30203
30204 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30205         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
30206         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
30207         return ret_conv;
30208 }
30209
30210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30211         if (!ptr_is_owned(_res)) return;
30212         void* _res_ptr = untag_ptr(_res);
30213         CHECK_ACCESS(_res_ptr);
30214         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
30215         FREE(untag_ptr(_res));
30216         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
30217 }
30218
30219 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
30220         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
30221         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
30222         return tag_ptr(ret_conv, true);
30223 }
30224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30225         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
30226         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
30227         return ret_conv;
30228 }
30229
30230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30231         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
30232         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
30233         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
30234         return tag_ptr(ret_conv, true);
30235 }
30236
30237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30238         LDKShutdown o_conv;
30239         o_conv.inner = untag_ptr(o);
30240         o_conv.is_owned = ptr_is_owned(o);
30241         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30242         o_conv = Shutdown_clone(&o_conv);
30243         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
30244         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
30245         return tag_ptr(ret_conv, true);
30246 }
30247
30248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30249         void* e_ptr = untag_ptr(e);
30250         CHECK_ACCESS(e_ptr);
30251         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30252         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30253         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
30254         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
30255         return tag_ptr(ret_conv, true);
30256 }
30257
30258 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30259         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
30260         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
30261         return ret_conv;
30262 }
30263
30264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30265         if (!ptr_is_owned(_res)) return;
30266         void* _res_ptr = untag_ptr(_res);
30267         CHECK_ACCESS(_res_ptr);
30268         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
30269         FREE(untag_ptr(_res));
30270         CResult_ShutdownDecodeErrorZ_free(_res_conv);
30271 }
30272
30273 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
30274         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
30275         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
30276         return tag_ptr(ret_conv, true);
30277 }
30278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30279         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
30280         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
30281         return ret_conv;
30282 }
30283
30284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30285         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
30286         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
30287         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
30288         return tag_ptr(ret_conv, true);
30289 }
30290
30291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30292         LDKUpdateFailHTLC o_conv;
30293         o_conv.inner = untag_ptr(o);
30294         o_conv.is_owned = ptr_is_owned(o);
30295         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30296         o_conv = UpdateFailHTLC_clone(&o_conv);
30297         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
30298         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
30299         return tag_ptr(ret_conv, true);
30300 }
30301
30302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30303         void* e_ptr = untag_ptr(e);
30304         CHECK_ACCESS(e_ptr);
30305         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30306         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30307         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
30308         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
30309         return tag_ptr(ret_conv, true);
30310 }
30311
30312 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30313         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
30314         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
30315         return ret_conv;
30316 }
30317
30318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30319         if (!ptr_is_owned(_res)) return;
30320         void* _res_ptr = untag_ptr(_res);
30321         CHECK_ACCESS(_res_ptr);
30322         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
30323         FREE(untag_ptr(_res));
30324         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
30325 }
30326
30327 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
30328         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
30329         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
30330         return tag_ptr(ret_conv, true);
30331 }
30332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30333         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
30334         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
30335         return ret_conv;
30336 }
30337
30338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30339         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
30340         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
30341         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
30342         return tag_ptr(ret_conv, true);
30343 }
30344
30345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30346         LDKUpdateFailMalformedHTLC o_conv;
30347         o_conv.inner = untag_ptr(o);
30348         o_conv.is_owned = ptr_is_owned(o);
30349         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30350         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
30351         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
30352         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
30353         return tag_ptr(ret_conv, true);
30354 }
30355
30356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30357         void* e_ptr = untag_ptr(e);
30358         CHECK_ACCESS(e_ptr);
30359         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30360         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30361         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
30362         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
30363         return tag_ptr(ret_conv, true);
30364 }
30365
30366 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30367         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
30368         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
30369         return ret_conv;
30370 }
30371
30372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30373         if (!ptr_is_owned(_res)) return;
30374         void* _res_ptr = untag_ptr(_res);
30375         CHECK_ACCESS(_res_ptr);
30376         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
30377         FREE(untag_ptr(_res));
30378         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
30379 }
30380
30381 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
30382         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
30383         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
30384         return tag_ptr(ret_conv, true);
30385 }
30386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30387         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
30388         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
30389         return ret_conv;
30390 }
30391
30392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30393         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
30394         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
30395         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
30396         return tag_ptr(ret_conv, true);
30397 }
30398
30399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30400         LDKUpdateFee o_conv;
30401         o_conv.inner = untag_ptr(o);
30402         o_conv.is_owned = ptr_is_owned(o);
30403         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30404         o_conv = UpdateFee_clone(&o_conv);
30405         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
30406         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
30407         return tag_ptr(ret_conv, true);
30408 }
30409
30410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30411         void* e_ptr = untag_ptr(e);
30412         CHECK_ACCESS(e_ptr);
30413         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30414         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30415         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
30416         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
30417         return tag_ptr(ret_conv, true);
30418 }
30419
30420 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30421         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
30422         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
30423         return ret_conv;
30424 }
30425
30426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30427         if (!ptr_is_owned(_res)) return;
30428         void* _res_ptr = untag_ptr(_res);
30429         CHECK_ACCESS(_res_ptr);
30430         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
30431         FREE(untag_ptr(_res));
30432         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
30433 }
30434
30435 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
30436         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
30437         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
30438         return tag_ptr(ret_conv, true);
30439 }
30440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30441         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
30442         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
30443         return ret_conv;
30444 }
30445
30446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30447         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
30448         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
30449         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
30450         return tag_ptr(ret_conv, true);
30451 }
30452
30453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30454         LDKUpdateFulfillHTLC o_conv;
30455         o_conv.inner = untag_ptr(o);
30456         o_conv.is_owned = ptr_is_owned(o);
30457         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30458         o_conv = UpdateFulfillHTLC_clone(&o_conv);
30459         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
30460         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
30461         return tag_ptr(ret_conv, true);
30462 }
30463
30464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30465         void* e_ptr = untag_ptr(e);
30466         CHECK_ACCESS(e_ptr);
30467         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30468         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30469         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
30470         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
30471         return tag_ptr(ret_conv, true);
30472 }
30473
30474 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30475         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
30476         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
30477         return ret_conv;
30478 }
30479
30480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30481         if (!ptr_is_owned(_res)) return;
30482         void* _res_ptr = untag_ptr(_res);
30483         CHECK_ACCESS(_res_ptr);
30484         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
30485         FREE(untag_ptr(_res));
30486         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
30487 }
30488
30489 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
30490         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
30491         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
30492         return tag_ptr(ret_conv, true);
30493 }
30494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30495         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
30496         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
30497         return ret_conv;
30498 }
30499
30500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30501         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
30502         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
30503         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
30504         return tag_ptr(ret_conv, true);
30505 }
30506
30507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30508         LDKUpdateAddHTLC o_conv;
30509         o_conv.inner = untag_ptr(o);
30510         o_conv.is_owned = ptr_is_owned(o);
30511         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30512         o_conv = UpdateAddHTLC_clone(&o_conv);
30513         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
30514         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
30515         return tag_ptr(ret_conv, true);
30516 }
30517
30518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30519         void* e_ptr = untag_ptr(e);
30520         CHECK_ACCESS(e_ptr);
30521         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30522         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30523         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
30524         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
30525         return tag_ptr(ret_conv, true);
30526 }
30527
30528 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30529         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
30530         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
30531         return ret_conv;
30532 }
30533
30534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30535         if (!ptr_is_owned(_res)) return;
30536         void* _res_ptr = untag_ptr(_res);
30537         CHECK_ACCESS(_res_ptr);
30538         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
30539         FREE(untag_ptr(_res));
30540         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
30541 }
30542
30543 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
30544         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
30545         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
30546         return tag_ptr(ret_conv, true);
30547 }
30548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30549         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
30550         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
30551         return ret_conv;
30552 }
30553
30554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30555         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
30556         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
30557         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
30558         return tag_ptr(ret_conv, true);
30559 }
30560
30561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30562         LDKOnionMessage o_conv;
30563         o_conv.inner = untag_ptr(o);
30564         o_conv.is_owned = ptr_is_owned(o);
30565         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30566         o_conv = OnionMessage_clone(&o_conv);
30567         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
30568         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
30569         return tag_ptr(ret_conv, true);
30570 }
30571
30572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30573         void* e_ptr = untag_ptr(e);
30574         CHECK_ACCESS(e_ptr);
30575         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30576         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30577         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
30578         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
30579         return tag_ptr(ret_conv, true);
30580 }
30581
30582 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30583         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
30584         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
30585         return ret_conv;
30586 }
30587
30588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30589         if (!ptr_is_owned(_res)) return;
30590         void* _res_ptr = untag_ptr(_res);
30591         CHECK_ACCESS(_res_ptr);
30592         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
30593         FREE(untag_ptr(_res));
30594         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
30595 }
30596
30597 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
30598         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
30599         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
30600         return tag_ptr(ret_conv, true);
30601 }
30602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30603         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
30604         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
30605         return ret_conv;
30606 }
30607
30608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30609         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
30610         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
30611         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
30612         return tag_ptr(ret_conv, true);
30613 }
30614
30615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30616         LDKPing o_conv;
30617         o_conv.inner = untag_ptr(o);
30618         o_conv.is_owned = ptr_is_owned(o);
30619         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30620         o_conv = Ping_clone(&o_conv);
30621         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
30622         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
30623         return tag_ptr(ret_conv, true);
30624 }
30625
30626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30627         void* e_ptr = untag_ptr(e);
30628         CHECK_ACCESS(e_ptr);
30629         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30630         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30631         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
30632         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
30633         return tag_ptr(ret_conv, true);
30634 }
30635
30636 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30637         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
30638         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
30639         return ret_conv;
30640 }
30641
30642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30643         if (!ptr_is_owned(_res)) return;
30644         void* _res_ptr = untag_ptr(_res);
30645         CHECK_ACCESS(_res_ptr);
30646         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
30647         FREE(untag_ptr(_res));
30648         CResult_PingDecodeErrorZ_free(_res_conv);
30649 }
30650
30651 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
30652         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
30653         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
30654         return tag_ptr(ret_conv, true);
30655 }
30656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30657         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
30658         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
30659         return ret_conv;
30660 }
30661
30662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30663         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
30664         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
30665         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
30666         return tag_ptr(ret_conv, true);
30667 }
30668
30669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30670         LDKPong o_conv;
30671         o_conv.inner = untag_ptr(o);
30672         o_conv.is_owned = ptr_is_owned(o);
30673         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30674         o_conv = Pong_clone(&o_conv);
30675         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
30676         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
30677         return tag_ptr(ret_conv, true);
30678 }
30679
30680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30681         void* e_ptr = untag_ptr(e);
30682         CHECK_ACCESS(e_ptr);
30683         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30684         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30685         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
30686         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
30687         return tag_ptr(ret_conv, true);
30688 }
30689
30690 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30691         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
30692         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
30693         return ret_conv;
30694 }
30695
30696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30697         if (!ptr_is_owned(_res)) return;
30698         void* _res_ptr = untag_ptr(_res);
30699         CHECK_ACCESS(_res_ptr);
30700         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
30701         FREE(untag_ptr(_res));
30702         CResult_PongDecodeErrorZ_free(_res_conv);
30703 }
30704
30705 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
30706         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
30707         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
30708         return tag_ptr(ret_conv, true);
30709 }
30710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30711         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
30712         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
30713         return ret_conv;
30714 }
30715
30716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30717         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
30718         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
30719         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
30720         return tag_ptr(ret_conv, true);
30721 }
30722
30723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30724         LDKUnsignedChannelAnnouncement o_conv;
30725         o_conv.inner = untag_ptr(o);
30726         o_conv.is_owned = ptr_is_owned(o);
30727         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30728         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
30729         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
30730         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
30731         return tag_ptr(ret_conv, true);
30732 }
30733
30734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30735         void* e_ptr = untag_ptr(e);
30736         CHECK_ACCESS(e_ptr);
30737         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30738         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30739         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
30740         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
30741         return tag_ptr(ret_conv, true);
30742 }
30743
30744 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30745         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
30746         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
30747         return ret_conv;
30748 }
30749
30750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30751         if (!ptr_is_owned(_res)) return;
30752         void* _res_ptr = untag_ptr(_res);
30753         CHECK_ACCESS(_res_ptr);
30754         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
30755         FREE(untag_ptr(_res));
30756         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
30757 }
30758
30759 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
30760         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
30761         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
30762         return tag_ptr(ret_conv, true);
30763 }
30764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30765         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
30766         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
30767         return ret_conv;
30768 }
30769
30770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30771         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
30772         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
30773         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
30774         return tag_ptr(ret_conv, true);
30775 }
30776
30777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30778         LDKChannelAnnouncement o_conv;
30779         o_conv.inner = untag_ptr(o);
30780         o_conv.is_owned = ptr_is_owned(o);
30781         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30782         o_conv = ChannelAnnouncement_clone(&o_conv);
30783         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
30784         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
30785         return tag_ptr(ret_conv, true);
30786 }
30787
30788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30789         void* e_ptr = untag_ptr(e);
30790         CHECK_ACCESS(e_ptr);
30791         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30792         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30793         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
30794         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
30795         return tag_ptr(ret_conv, true);
30796 }
30797
30798 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30799         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
30800         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
30801         return ret_conv;
30802 }
30803
30804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30805         if (!ptr_is_owned(_res)) return;
30806         void* _res_ptr = untag_ptr(_res);
30807         CHECK_ACCESS(_res_ptr);
30808         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
30809         FREE(untag_ptr(_res));
30810         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
30811 }
30812
30813 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
30814         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
30815         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
30816         return tag_ptr(ret_conv, true);
30817 }
30818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30819         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
30820         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
30821         return ret_conv;
30822 }
30823
30824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30825         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
30826         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
30827         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
30828         return tag_ptr(ret_conv, true);
30829 }
30830
30831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30832         LDKUnsignedChannelUpdate o_conv;
30833         o_conv.inner = untag_ptr(o);
30834         o_conv.is_owned = ptr_is_owned(o);
30835         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30836         o_conv = UnsignedChannelUpdate_clone(&o_conv);
30837         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
30838         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
30839         return tag_ptr(ret_conv, true);
30840 }
30841
30842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30843         void* e_ptr = untag_ptr(e);
30844         CHECK_ACCESS(e_ptr);
30845         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30846         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30847         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
30848         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
30849         return tag_ptr(ret_conv, true);
30850 }
30851
30852 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30853         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
30854         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
30855         return ret_conv;
30856 }
30857
30858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30859         if (!ptr_is_owned(_res)) return;
30860         void* _res_ptr = untag_ptr(_res);
30861         CHECK_ACCESS(_res_ptr);
30862         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
30863         FREE(untag_ptr(_res));
30864         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
30865 }
30866
30867 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
30868         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
30869         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
30870         return tag_ptr(ret_conv, true);
30871 }
30872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30873         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
30874         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
30875         return ret_conv;
30876 }
30877
30878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30879         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
30880         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
30881         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
30882         return tag_ptr(ret_conv, true);
30883 }
30884
30885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30886         LDKChannelUpdate o_conv;
30887         o_conv.inner = untag_ptr(o);
30888         o_conv.is_owned = ptr_is_owned(o);
30889         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30890         o_conv = ChannelUpdate_clone(&o_conv);
30891         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
30892         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
30893         return tag_ptr(ret_conv, true);
30894 }
30895
30896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30897         void* e_ptr = untag_ptr(e);
30898         CHECK_ACCESS(e_ptr);
30899         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30900         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30901         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
30902         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
30903         return tag_ptr(ret_conv, true);
30904 }
30905
30906 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30907         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
30908         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
30909         return ret_conv;
30910 }
30911
30912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30913         if (!ptr_is_owned(_res)) return;
30914         void* _res_ptr = untag_ptr(_res);
30915         CHECK_ACCESS(_res_ptr);
30916         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
30917         FREE(untag_ptr(_res));
30918         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
30919 }
30920
30921 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
30922         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
30923         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
30924         return tag_ptr(ret_conv, true);
30925 }
30926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30927         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
30928         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
30929         return ret_conv;
30930 }
30931
30932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30933         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
30934         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
30935         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
30936         return tag_ptr(ret_conv, true);
30937 }
30938
30939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30940         LDKErrorMessage o_conv;
30941         o_conv.inner = untag_ptr(o);
30942         o_conv.is_owned = ptr_is_owned(o);
30943         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30944         o_conv = ErrorMessage_clone(&o_conv);
30945         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30946         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
30947         return tag_ptr(ret_conv, true);
30948 }
30949
30950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30951         void* e_ptr = untag_ptr(e);
30952         CHECK_ACCESS(e_ptr);
30953         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30954         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30955         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30956         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
30957         return tag_ptr(ret_conv, true);
30958 }
30959
30960 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30961         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
30962         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
30963         return ret_conv;
30964 }
30965
30966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30967         if (!ptr_is_owned(_res)) return;
30968         void* _res_ptr = untag_ptr(_res);
30969         CHECK_ACCESS(_res_ptr);
30970         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
30971         FREE(untag_ptr(_res));
30972         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
30973 }
30974
30975 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
30976         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30977         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
30978         return tag_ptr(ret_conv, true);
30979 }
30980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30981         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
30982         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
30983         return ret_conv;
30984 }
30985
30986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30987         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
30988         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30989         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
30990         return tag_ptr(ret_conv, true);
30991 }
30992
30993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30994         LDKWarningMessage o_conv;
30995         o_conv.inner = untag_ptr(o);
30996         o_conv.is_owned = ptr_is_owned(o);
30997         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30998         o_conv = WarningMessage_clone(&o_conv);
30999         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
31000         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
31001         return tag_ptr(ret_conv, true);
31002 }
31003
31004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31005         void* e_ptr = untag_ptr(e);
31006         CHECK_ACCESS(e_ptr);
31007         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31008         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31009         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
31010         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
31011         return tag_ptr(ret_conv, true);
31012 }
31013
31014 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31015         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
31016         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
31017         return ret_conv;
31018 }
31019
31020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31021         if (!ptr_is_owned(_res)) return;
31022         void* _res_ptr = untag_ptr(_res);
31023         CHECK_ACCESS(_res_ptr);
31024         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
31025         FREE(untag_ptr(_res));
31026         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
31027 }
31028
31029 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
31030         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
31031         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
31032         return tag_ptr(ret_conv, true);
31033 }
31034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31035         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
31036         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
31037         return ret_conv;
31038 }
31039
31040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31041         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
31042         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
31043         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
31044         return tag_ptr(ret_conv, true);
31045 }
31046
31047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31048         LDKUnsignedNodeAnnouncement o_conv;
31049         o_conv.inner = untag_ptr(o);
31050         o_conv.is_owned = ptr_is_owned(o);
31051         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31052         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
31053         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
31054         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
31055         return tag_ptr(ret_conv, true);
31056 }
31057
31058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31059         void* e_ptr = untag_ptr(e);
31060         CHECK_ACCESS(e_ptr);
31061         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31062         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31063         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
31064         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
31065         return tag_ptr(ret_conv, true);
31066 }
31067
31068 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31069         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
31070         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
31071         return ret_conv;
31072 }
31073
31074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31075         if (!ptr_is_owned(_res)) return;
31076         void* _res_ptr = untag_ptr(_res);
31077         CHECK_ACCESS(_res_ptr);
31078         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
31079         FREE(untag_ptr(_res));
31080         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
31081 }
31082
31083 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
31084         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
31085         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
31086         return tag_ptr(ret_conv, true);
31087 }
31088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31089         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
31090         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
31091         return ret_conv;
31092 }
31093
31094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31095         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
31096         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
31097         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
31098         return tag_ptr(ret_conv, true);
31099 }
31100
31101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31102         LDKNodeAnnouncement o_conv;
31103         o_conv.inner = untag_ptr(o);
31104         o_conv.is_owned = ptr_is_owned(o);
31105         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31106         o_conv = NodeAnnouncement_clone(&o_conv);
31107         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
31108         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
31109         return tag_ptr(ret_conv, true);
31110 }
31111
31112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31113         void* e_ptr = untag_ptr(e);
31114         CHECK_ACCESS(e_ptr);
31115         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31116         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31117         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
31118         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
31119         return tag_ptr(ret_conv, true);
31120 }
31121
31122 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31123         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
31124         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
31125         return ret_conv;
31126 }
31127
31128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31129         if (!ptr_is_owned(_res)) return;
31130         void* _res_ptr = untag_ptr(_res);
31131         CHECK_ACCESS(_res_ptr);
31132         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
31133         FREE(untag_ptr(_res));
31134         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
31135 }
31136
31137 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
31138         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
31139         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
31140         return tag_ptr(ret_conv, true);
31141 }
31142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31143         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
31144         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
31145         return ret_conv;
31146 }
31147
31148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31149         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
31150         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
31151         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
31152         return tag_ptr(ret_conv, true);
31153 }
31154
31155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31156         LDKQueryShortChannelIds o_conv;
31157         o_conv.inner = untag_ptr(o);
31158         o_conv.is_owned = ptr_is_owned(o);
31159         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31160         o_conv = QueryShortChannelIds_clone(&o_conv);
31161         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
31162         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
31163         return tag_ptr(ret_conv, true);
31164 }
31165
31166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31167         void* e_ptr = untag_ptr(e);
31168         CHECK_ACCESS(e_ptr);
31169         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31170         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31171         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
31172         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
31173         return tag_ptr(ret_conv, true);
31174 }
31175
31176 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31177         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
31178         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
31179         return ret_conv;
31180 }
31181
31182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31183         if (!ptr_is_owned(_res)) return;
31184         void* _res_ptr = untag_ptr(_res);
31185         CHECK_ACCESS(_res_ptr);
31186         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
31187         FREE(untag_ptr(_res));
31188         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
31189 }
31190
31191 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
31192         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
31193         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
31194         return tag_ptr(ret_conv, true);
31195 }
31196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31197         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
31198         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
31199         return ret_conv;
31200 }
31201
31202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31203         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
31204         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
31205         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
31206         return tag_ptr(ret_conv, true);
31207 }
31208
31209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31210         LDKReplyShortChannelIdsEnd o_conv;
31211         o_conv.inner = untag_ptr(o);
31212         o_conv.is_owned = ptr_is_owned(o);
31213         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31214         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
31215         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
31216         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
31217         return tag_ptr(ret_conv, true);
31218 }
31219
31220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31221         void* e_ptr = untag_ptr(e);
31222         CHECK_ACCESS(e_ptr);
31223         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31224         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31225         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
31226         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
31227         return tag_ptr(ret_conv, true);
31228 }
31229
31230 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31231         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
31232         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
31233         return ret_conv;
31234 }
31235
31236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31237         if (!ptr_is_owned(_res)) return;
31238         void* _res_ptr = untag_ptr(_res);
31239         CHECK_ACCESS(_res_ptr);
31240         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
31241         FREE(untag_ptr(_res));
31242         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
31243 }
31244
31245 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
31246         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
31247         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
31248         return tag_ptr(ret_conv, true);
31249 }
31250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31251         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
31252         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
31253         return ret_conv;
31254 }
31255
31256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31257         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
31258         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
31259         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
31260         return tag_ptr(ret_conv, true);
31261 }
31262
31263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31264         LDKQueryChannelRange o_conv;
31265         o_conv.inner = untag_ptr(o);
31266         o_conv.is_owned = ptr_is_owned(o);
31267         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31268         o_conv = QueryChannelRange_clone(&o_conv);
31269         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
31270         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
31271         return tag_ptr(ret_conv, true);
31272 }
31273
31274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31275         void* e_ptr = untag_ptr(e);
31276         CHECK_ACCESS(e_ptr);
31277         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31278         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31279         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
31280         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
31281         return tag_ptr(ret_conv, true);
31282 }
31283
31284 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31285         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
31286         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
31287         return ret_conv;
31288 }
31289
31290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31291         if (!ptr_is_owned(_res)) return;
31292         void* _res_ptr = untag_ptr(_res);
31293         CHECK_ACCESS(_res_ptr);
31294         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
31295         FREE(untag_ptr(_res));
31296         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
31297 }
31298
31299 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
31300         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
31301         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
31302         return tag_ptr(ret_conv, true);
31303 }
31304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31305         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
31306         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
31307         return ret_conv;
31308 }
31309
31310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31311         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
31312         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
31313         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
31314         return tag_ptr(ret_conv, true);
31315 }
31316
31317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31318         LDKReplyChannelRange o_conv;
31319         o_conv.inner = untag_ptr(o);
31320         o_conv.is_owned = ptr_is_owned(o);
31321         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31322         o_conv = ReplyChannelRange_clone(&o_conv);
31323         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
31324         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
31325         return tag_ptr(ret_conv, true);
31326 }
31327
31328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31329         void* e_ptr = untag_ptr(e);
31330         CHECK_ACCESS(e_ptr);
31331         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31332         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31333         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
31334         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
31335         return tag_ptr(ret_conv, true);
31336 }
31337
31338 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31339         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
31340         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
31341         return ret_conv;
31342 }
31343
31344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31345         if (!ptr_is_owned(_res)) return;
31346         void* _res_ptr = untag_ptr(_res);
31347         CHECK_ACCESS(_res_ptr);
31348         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
31349         FREE(untag_ptr(_res));
31350         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
31351 }
31352
31353 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
31354         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
31355         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
31356         return tag_ptr(ret_conv, true);
31357 }
31358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31359         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
31360         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
31361         return ret_conv;
31362 }
31363
31364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31365         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
31366         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
31367         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
31368         return tag_ptr(ret_conv, true);
31369 }
31370
31371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31372         LDKGossipTimestampFilter o_conv;
31373         o_conv.inner = untag_ptr(o);
31374         o_conv.is_owned = ptr_is_owned(o);
31375         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31376         o_conv = GossipTimestampFilter_clone(&o_conv);
31377         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
31378         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
31379         return tag_ptr(ret_conv, true);
31380 }
31381
31382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31383         void* e_ptr = untag_ptr(e);
31384         CHECK_ACCESS(e_ptr);
31385         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31386         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31387         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
31388         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
31389         return tag_ptr(ret_conv, true);
31390 }
31391
31392 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31393         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
31394         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
31395         return ret_conv;
31396 }
31397
31398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31399         if (!ptr_is_owned(_res)) return;
31400         void* _res_ptr = untag_ptr(_res);
31401         CHECK_ACCESS(_res_ptr);
31402         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
31403         FREE(untag_ptr(_res));
31404         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
31405 }
31406
31407 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
31408         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
31409         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
31410         return tag_ptr(ret_conv, true);
31411 }
31412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31413         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
31414         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
31415         return ret_conv;
31416 }
31417
31418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31419         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
31420         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
31421         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
31422         return tag_ptr(ret_conv, true);
31423 }
31424
31425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PhantomRouteHintsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
31426         LDKCVec_PhantomRouteHintsZ _res_constr;
31427         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
31428         if (_res_constr.datalen > 0)
31429                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
31430         else
31431                 _res_constr.data = NULL;
31432         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
31433         for (size_t t = 0; t < _res_constr.datalen; t++) {
31434                 int64_t _res_conv_19 = _res_vals[t];
31435                 LDKPhantomRouteHints _res_conv_19_conv;
31436                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
31437                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
31438                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
31439                 _res_constr.data[t] = _res_conv_19_conv;
31440         }
31441         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
31442         CVec_PhantomRouteHintsZ_free(_res_constr);
31443 }
31444
31445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31446         LDKBolt11Invoice o_conv;
31447         o_conv.inner = untag_ptr(o);
31448         o_conv.is_owned = ptr_is_owned(o);
31449         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31450         o_conv = Bolt11Invoice_clone(&o_conv);
31451         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
31452         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o_conv);
31453         return tag_ptr(ret_conv, true);
31454 }
31455
31456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31457         void* e_ptr = untag_ptr(e);
31458         CHECK_ACCESS(e_ptr);
31459         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
31460         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
31461         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
31462         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e_conv);
31463         return tag_ptr(ret_conv, true);
31464 }
31465
31466 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31467         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(o);
31468         jboolean ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o_conv);
31469         return ret_conv;
31470 }
31471
31472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31473         if (!ptr_is_owned(_res)) return;
31474         void* _res_ptr = untag_ptr(_res);
31475         CHECK_ACCESS(_res_ptr);
31476         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)(_res_ptr);
31477         FREE(untag_ptr(_res));
31478         CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res_conv);
31479 }
31480
31481 static inline uint64_t CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
31482         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
31483         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(arg);
31484         return tag_ptr(ret_conv, true);
31485 }
31486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31487         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
31488         int64_t ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
31489         return ret_conv;
31490 }
31491
31492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31493         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
31494         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
31495         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig_conv);
31496         return tag_ptr(ret_conv, true);
31497 }
31498
31499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1FutureZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
31500         LDKCVec_FutureZ _res_constr;
31501         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
31502         if (_res_constr.datalen > 0)
31503                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKFuture), "LDKCVec_FutureZ Elements");
31504         else
31505                 _res_constr.data = NULL;
31506         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
31507         for (size_t i = 0; i < _res_constr.datalen; i++) {
31508                 int64_t _res_conv_8 = _res_vals[i];
31509                 LDKFuture _res_conv_8_conv;
31510                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
31511                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
31512                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
31513                 _res_constr.data[i] = _res_conv_8_conv;
31514         }
31515         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
31516         CVec_FutureZ_free(_res_constr);
31517 }
31518
31519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31520         void* o_ptr = untag_ptr(o);
31521         CHECK_ACCESS(o_ptr);
31522         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
31523         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
31524         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
31525         *ret_conv = CResult_OffersMessageDecodeErrorZ_ok(o_conv);
31526         return tag_ptr(ret_conv, true);
31527 }
31528
31529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31530         void* e_ptr = untag_ptr(e);
31531         CHECK_ACCESS(e_ptr);
31532         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31533         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31534         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
31535         *ret_conv = CResult_OffersMessageDecodeErrorZ_err(e_conv);
31536         return tag_ptr(ret_conv, true);
31537 }
31538
31539 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31540         LDKCResult_OffersMessageDecodeErrorZ* o_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(o);
31541         jboolean ret_conv = CResult_OffersMessageDecodeErrorZ_is_ok(o_conv);
31542         return ret_conv;
31543 }
31544
31545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31546         if (!ptr_is_owned(_res)) return;
31547         void* _res_ptr = untag_ptr(_res);
31548         CHECK_ACCESS(_res_ptr);
31549         LDKCResult_OffersMessageDecodeErrorZ _res_conv = *(LDKCResult_OffersMessageDecodeErrorZ*)(_res_ptr);
31550         FREE(untag_ptr(_res));
31551         CResult_OffersMessageDecodeErrorZ_free(_res_conv);
31552 }
31553
31554 static inline uint64_t CResult_OffersMessageDecodeErrorZ_clone_ptr(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR arg) {
31555         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
31556         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(arg);
31557         return tag_ptr(ret_conv, true);
31558 }
31559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31560         LDKCResult_OffersMessageDecodeErrorZ* arg_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(arg);
31561         int64_t ret_conv = CResult_OffersMessageDecodeErrorZ_clone_ptr(arg_conv);
31562         return ret_conv;
31563 }
31564
31565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31566         LDKCResult_OffersMessageDecodeErrorZ* orig_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(orig);
31567         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
31568         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(orig_conv);
31569         return tag_ptr(ret_conv, true);
31570 }
31571
31572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1some(JNIEnv *env, jclass clz, jclass o) {
31573         LDKHTLCClaim o_conv = LDKHTLCClaim_from_java(env, o);
31574         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
31575         *ret_copy = COption_HTLCClaimZ_some(o_conv);
31576         int64_t ret_ref = tag_ptr(ret_copy, true);
31577         return ret_ref;
31578 }
31579
31580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1none(JNIEnv *env, jclass clz) {
31581         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
31582         *ret_copy = COption_HTLCClaimZ_none();
31583         int64_t ret_ref = tag_ptr(ret_copy, true);
31584         return ret_ref;
31585 }
31586
31587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31588         if (!ptr_is_owned(_res)) return;
31589         void* _res_ptr = untag_ptr(_res);
31590         CHECK_ACCESS(_res_ptr);
31591         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
31592         FREE(untag_ptr(_res));
31593         COption_HTLCClaimZ_free(_res_conv);
31594 }
31595
31596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31597         LDKCounterpartyCommitmentSecrets o_conv;
31598         o_conv.inner = untag_ptr(o);
31599         o_conv.is_owned = ptr_is_owned(o);
31600         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31601         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
31602         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
31603         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
31604         return tag_ptr(ret_conv, true);
31605 }
31606
31607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31608         void* e_ptr = untag_ptr(e);
31609         CHECK_ACCESS(e_ptr);
31610         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31611         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31612         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
31613         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
31614         return tag_ptr(ret_conv, true);
31615 }
31616
31617 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31618         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
31619         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
31620         return ret_conv;
31621 }
31622
31623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31624         if (!ptr_is_owned(_res)) return;
31625         void* _res_ptr = untag_ptr(_res);
31626         CHECK_ACCESS(_res_ptr);
31627         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
31628         FREE(untag_ptr(_res));
31629         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
31630 }
31631
31632 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
31633         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
31634         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
31635         return tag_ptr(ret_conv, true);
31636 }
31637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31638         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
31639         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
31640         return ret_conv;
31641 }
31642
31643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31644         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
31645         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
31646         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
31647         return tag_ptr(ret_conv, true);
31648 }
31649
31650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31651         LDKTxCreationKeys o_conv;
31652         o_conv.inner = untag_ptr(o);
31653         o_conv.is_owned = ptr_is_owned(o);
31654         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31655         o_conv = TxCreationKeys_clone(&o_conv);
31656         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
31657         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
31658         return tag_ptr(ret_conv, true);
31659 }
31660
31661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31662         void* e_ptr = untag_ptr(e);
31663         CHECK_ACCESS(e_ptr);
31664         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31665         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31666         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
31667         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
31668         return tag_ptr(ret_conv, true);
31669 }
31670
31671 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31672         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
31673         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
31674         return ret_conv;
31675 }
31676
31677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31678         if (!ptr_is_owned(_res)) return;
31679         void* _res_ptr = untag_ptr(_res);
31680         CHECK_ACCESS(_res_ptr);
31681         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
31682         FREE(untag_ptr(_res));
31683         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
31684 }
31685
31686 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
31687         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
31688         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
31689         return tag_ptr(ret_conv, true);
31690 }
31691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31692         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
31693         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
31694         return ret_conv;
31695 }
31696
31697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31698         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
31699         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
31700         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
31701         return tag_ptr(ret_conv, true);
31702 }
31703
31704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31705         LDKChannelPublicKeys o_conv;
31706         o_conv.inner = untag_ptr(o);
31707         o_conv.is_owned = ptr_is_owned(o);
31708         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31709         o_conv = ChannelPublicKeys_clone(&o_conv);
31710         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
31711         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
31712         return tag_ptr(ret_conv, true);
31713 }
31714
31715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31716         void* e_ptr = untag_ptr(e);
31717         CHECK_ACCESS(e_ptr);
31718         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31719         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31720         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
31721         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
31722         return tag_ptr(ret_conv, true);
31723 }
31724
31725 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31726         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
31727         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
31728         return ret_conv;
31729 }
31730
31731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31732         if (!ptr_is_owned(_res)) return;
31733         void* _res_ptr = untag_ptr(_res);
31734         CHECK_ACCESS(_res_ptr);
31735         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
31736         FREE(untag_ptr(_res));
31737         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
31738 }
31739
31740 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
31741         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
31742         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
31743         return tag_ptr(ret_conv, true);
31744 }
31745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31746         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
31747         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
31748         return ret_conv;
31749 }
31750
31751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31752         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
31753         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
31754         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
31755         return tag_ptr(ret_conv, true);
31756 }
31757
31758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31759         LDKHTLCOutputInCommitment o_conv;
31760         o_conv.inner = untag_ptr(o);
31761         o_conv.is_owned = ptr_is_owned(o);
31762         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31763         o_conv = HTLCOutputInCommitment_clone(&o_conv);
31764         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
31765         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
31766         return tag_ptr(ret_conv, true);
31767 }
31768
31769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31770         void* e_ptr = untag_ptr(e);
31771         CHECK_ACCESS(e_ptr);
31772         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31773         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31774         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
31775         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
31776         return tag_ptr(ret_conv, true);
31777 }
31778
31779 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31780         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
31781         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
31782         return ret_conv;
31783 }
31784
31785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31786         if (!ptr_is_owned(_res)) return;
31787         void* _res_ptr = untag_ptr(_res);
31788         CHECK_ACCESS(_res_ptr);
31789         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
31790         FREE(untag_ptr(_res));
31791         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
31792 }
31793
31794 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
31795         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
31796         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
31797         return tag_ptr(ret_conv, true);
31798 }
31799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31800         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
31801         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
31802         return ret_conv;
31803 }
31804
31805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31806         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
31807         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
31808         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
31809         return tag_ptr(ret_conv, true);
31810 }
31811
31812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31813         LDKCounterpartyChannelTransactionParameters o_conv;
31814         o_conv.inner = untag_ptr(o);
31815         o_conv.is_owned = ptr_is_owned(o);
31816         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31817         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
31818         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
31819         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
31820         return tag_ptr(ret_conv, true);
31821 }
31822
31823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31824         void* e_ptr = untag_ptr(e);
31825         CHECK_ACCESS(e_ptr);
31826         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31827         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31828         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
31829         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
31830         return tag_ptr(ret_conv, true);
31831 }
31832
31833 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31834         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
31835         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
31836         return ret_conv;
31837 }
31838
31839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31840         if (!ptr_is_owned(_res)) return;
31841         void* _res_ptr = untag_ptr(_res);
31842         CHECK_ACCESS(_res_ptr);
31843         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
31844         FREE(untag_ptr(_res));
31845         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
31846 }
31847
31848 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
31849         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
31850         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
31851         return tag_ptr(ret_conv, true);
31852 }
31853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31854         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
31855         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
31856         return ret_conv;
31857 }
31858
31859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31860         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
31861         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
31862         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
31863         return tag_ptr(ret_conv, true);
31864 }
31865
31866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31867         LDKChannelTransactionParameters o_conv;
31868         o_conv.inner = untag_ptr(o);
31869         o_conv.is_owned = ptr_is_owned(o);
31870         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31871         o_conv = ChannelTransactionParameters_clone(&o_conv);
31872         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
31873         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
31874         return tag_ptr(ret_conv, true);
31875 }
31876
31877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31878         void* e_ptr = untag_ptr(e);
31879         CHECK_ACCESS(e_ptr);
31880         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31881         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31882         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
31883         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
31884         return tag_ptr(ret_conv, true);
31885 }
31886
31887 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31888         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
31889         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
31890         return ret_conv;
31891 }
31892
31893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31894         if (!ptr_is_owned(_res)) return;
31895         void* _res_ptr = untag_ptr(_res);
31896         CHECK_ACCESS(_res_ptr);
31897         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
31898         FREE(untag_ptr(_res));
31899         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
31900 }
31901
31902 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
31903         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
31904         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
31905         return tag_ptr(ret_conv, true);
31906 }
31907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31908         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
31909         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
31910         return ret_conv;
31911 }
31912
31913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31914         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
31915         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
31916         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
31917         return tag_ptr(ret_conv, true);
31918 }
31919
31920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31921         LDKHolderCommitmentTransaction o_conv;
31922         o_conv.inner = untag_ptr(o);
31923         o_conv.is_owned = ptr_is_owned(o);
31924         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31925         o_conv = HolderCommitmentTransaction_clone(&o_conv);
31926         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31927         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
31928         return tag_ptr(ret_conv, true);
31929 }
31930
31931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31932         void* e_ptr = untag_ptr(e);
31933         CHECK_ACCESS(e_ptr);
31934         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31935         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31936         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31937         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
31938         return tag_ptr(ret_conv, true);
31939 }
31940
31941 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31942         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
31943         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
31944         return ret_conv;
31945 }
31946
31947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31948         if (!ptr_is_owned(_res)) return;
31949         void* _res_ptr = untag_ptr(_res);
31950         CHECK_ACCESS(_res_ptr);
31951         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
31952         FREE(untag_ptr(_res));
31953         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
31954 }
31955
31956 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
31957         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31958         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
31959         return tag_ptr(ret_conv, true);
31960 }
31961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31962         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
31963         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
31964         return ret_conv;
31965 }
31966
31967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31968         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
31969         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31970         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
31971         return tag_ptr(ret_conv, true);
31972 }
31973
31974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31975         LDKBuiltCommitmentTransaction o_conv;
31976         o_conv.inner = untag_ptr(o);
31977         o_conv.is_owned = ptr_is_owned(o);
31978         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31979         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
31980         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31981         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
31982         return tag_ptr(ret_conv, true);
31983 }
31984
31985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31986         void* e_ptr = untag_ptr(e);
31987         CHECK_ACCESS(e_ptr);
31988         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31989         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31990         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31991         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
31992         return tag_ptr(ret_conv, true);
31993 }
31994
31995 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31996         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
31997         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
31998         return ret_conv;
31999 }
32000
32001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32002         if (!ptr_is_owned(_res)) return;
32003         void* _res_ptr = untag_ptr(_res);
32004         CHECK_ACCESS(_res_ptr);
32005         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
32006         FREE(untag_ptr(_res));
32007         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
32008 }
32009
32010 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
32011         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
32012         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
32013         return tag_ptr(ret_conv, true);
32014 }
32015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32016         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
32017         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
32018         return ret_conv;
32019 }
32020
32021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32022         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
32023         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
32024         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
32025         return tag_ptr(ret_conv, true);
32026 }
32027
32028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32029         LDKTrustedClosingTransaction o_conv;
32030         o_conv.inner = untag_ptr(o);
32031         o_conv.is_owned = ptr_is_owned(o);
32032         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32033         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
32034         
32035         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
32036         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
32037         return tag_ptr(ret_conv, true);
32038 }
32039
32040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
32041         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
32042         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
32043         return tag_ptr(ret_conv, true);
32044 }
32045
32046 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32047         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
32048         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
32049         return ret_conv;
32050 }
32051
32052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32053         if (!ptr_is_owned(_res)) return;
32054         void* _res_ptr = untag_ptr(_res);
32055         CHECK_ACCESS(_res_ptr);
32056         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
32057         FREE(untag_ptr(_res));
32058         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
32059 }
32060
32061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32062         LDKCommitmentTransaction o_conv;
32063         o_conv.inner = untag_ptr(o);
32064         o_conv.is_owned = ptr_is_owned(o);
32065         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32066         o_conv = CommitmentTransaction_clone(&o_conv);
32067         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
32068         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
32069         return tag_ptr(ret_conv, true);
32070 }
32071
32072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32073         void* e_ptr = untag_ptr(e);
32074         CHECK_ACCESS(e_ptr);
32075         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32076         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32077         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
32078         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
32079         return tag_ptr(ret_conv, true);
32080 }
32081
32082 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32083         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
32084         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
32085         return ret_conv;
32086 }
32087
32088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32089         if (!ptr_is_owned(_res)) return;
32090         void* _res_ptr = untag_ptr(_res);
32091         CHECK_ACCESS(_res_ptr);
32092         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
32093         FREE(untag_ptr(_res));
32094         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
32095 }
32096
32097 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
32098         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
32099         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
32100         return tag_ptr(ret_conv, true);
32101 }
32102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32103         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
32104         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
32105         return ret_conv;
32106 }
32107
32108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32109         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
32110         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
32111         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
32112         return tag_ptr(ret_conv, true);
32113 }
32114
32115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32116         LDKTrustedCommitmentTransaction o_conv;
32117         o_conv.inner = untag_ptr(o);
32118         o_conv.is_owned = ptr_is_owned(o);
32119         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32120         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
32121         
32122         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
32123         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
32124         return tag_ptr(ret_conv, true);
32125 }
32126
32127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
32128         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
32129         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
32130         return tag_ptr(ret_conv, true);
32131 }
32132
32133 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32134         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
32135         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
32136         return ret_conv;
32137 }
32138
32139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32140         if (!ptr_is_owned(_res)) return;
32141         void* _res_ptr = untag_ptr(_res);
32142         CHECK_ACCESS(_res_ptr);
32143         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
32144         FREE(untag_ptr(_res));
32145         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
32146 }
32147
32148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
32149         LDKCVec_ECDSASignatureZ o_constr;
32150         o_constr.datalen = (*env)->GetArrayLength(env, o);
32151         if (o_constr.datalen > 0)
32152                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
32153         else
32154                 o_constr.data = NULL;
32155         for (size_t i = 0; i < o_constr.datalen; i++) {
32156                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
32157                 LDKECDSASignature o_conv_8_ref;
32158                 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
32159                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
32160                 o_constr.data[i] = o_conv_8_ref;
32161         }
32162         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
32163         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_ok(o_constr);
32164         return tag_ptr(ret_conv, true);
32165 }
32166
32167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
32168         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
32169         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_err();
32170         return tag_ptr(ret_conv, true);
32171 }
32172
32173 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32174         LDKCResult_CVec_ECDSASignatureZNoneZ* o_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(o);
32175         jboolean ret_conv = CResult_CVec_ECDSASignatureZNoneZ_is_ok(o_conv);
32176         return ret_conv;
32177 }
32178
32179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32180         if (!ptr_is_owned(_res)) return;
32181         void* _res_ptr = untag_ptr(_res);
32182         CHECK_ACCESS(_res_ptr);
32183         LDKCResult_CVec_ECDSASignatureZNoneZ _res_conv = *(LDKCResult_CVec_ECDSASignatureZNoneZ*)(_res_ptr);
32184         FREE(untag_ptr(_res));
32185         CResult_CVec_ECDSASignatureZNoneZ_free(_res_conv);
32186 }
32187
32188 static inline uint64_t CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR arg) {
32189         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
32190         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(arg);
32191         return tag_ptr(ret_conv, true);
32192 }
32193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32194         LDKCResult_CVec_ECDSASignatureZNoneZ* arg_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(arg);
32195         int64_t ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(arg_conv);
32196         return ret_conv;
32197 }
32198
32199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32200         LDKCResult_CVec_ECDSASignatureZNoneZ* orig_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(orig);
32201         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
32202         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(orig_conv);
32203         return tag_ptr(ret_conv, true);
32204 }
32205
32206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
32207         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
32208         *ret_copy = COption_usizeZ_some(o);
32209         int64_t ret_ref = tag_ptr(ret_copy, true);
32210         return ret_ref;
32211 }
32212
32213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1none(JNIEnv *env, jclass clz) {
32214         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
32215         *ret_copy = COption_usizeZ_none();
32216         int64_t ret_ref = tag_ptr(ret_copy, true);
32217         return ret_ref;
32218 }
32219
32220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32221         if (!ptr_is_owned(_res)) return;
32222         void* _res_ptr = untag_ptr(_res);
32223         CHECK_ACCESS(_res_ptr);
32224         LDKCOption_usizeZ _res_conv = *(LDKCOption_usizeZ*)(_res_ptr);
32225         FREE(untag_ptr(_res));
32226         COption_usizeZ_free(_res_conv);
32227 }
32228
32229 static inline uint64_t COption_usizeZ_clone_ptr(LDKCOption_usizeZ *NONNULL_PTR arg) {
32230         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
32231         *ret_copy = COption_usizeZ_clone(arg);
32232         int64_t ret_ref = tag_ptr(ret_copy, true);
32233         return ret_ref;
32234 }
32235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32236         LDKCOption_usizeZ* arg_conv = (LDKCOption_usizeZ*)untag_ptr(arg);
32237         int64_t ret_conv = COption_usizeZ_clone_ptr(arg_conv);
32238         return ret_conv;
32239 }
32240
32241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32242         LDKCOption_usizeZ* orig_conv = (LDKCOption_usizeZ*)untag_ptr(orig);
32243         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
32244         *ret_copy = COption_usizeZ_clone(orig_conv);
32245         int64_t ret_ref = tag_ptr(ret_copy, true);
32246         return ret_ref;
32247 }
32248
32249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32250         LDKShutdownScript o_conv;
32251         o_conv.inner = untag_ptr(o);
32252         o_conv.is_owned = ptr_is_owned(o);
32253         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32254         o_conv = ShutdownScript_clone(&o_conv);
32255         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
32256         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
32257         return tag_ptr(ret_conv, true);
32258 }
32259
32260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32261         void* e_ptr = untag_ptr(e);
32262         CHECK_ACCESS(e_ptr);
32263         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32264         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32265         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
32266         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
32267         return tag_ptr(ret_conv, true);
32268 }
32269
32270 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32271         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
32272         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
32273         return ret_conv;
32274 }
32275
32276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32277         if (!ptr_is_owned(_res)) return;
32278         void* _res_ptr = untag_ptr(_res);
32279         CHECK_ACCESS(_res_ptr);
32280         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
32281         FREE(untag_ptr(_res));
32282         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
32283 }
32284
32285 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
32286         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
32287         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
32288         return tag_ptr(ret_conv, true);
32289 }
32290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32291         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
32292         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
32293         return ret_conv;
32294 }
32295
32296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32297         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
32298         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
32299         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
32300         return tag_ptr(ret_conv, true);
32301 }
32302
32303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32304         LDKShutdownScript o_conv;
32305         o_conv.inner = untag_ptr(o);
32306         o_conv.is_owned = ptr_is_owned(o);
32307         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32308         o_conv = ShutdownScript_clone(&o_conv);
32309         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
32310         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
32311         return tag_ptr(ret_conv, true);
32312 }
32313
32314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32315         LDKInvalidShutdownScript e_conv;
32316         e_conv.inner = untag_ptr(e);
32317         e_conv.is_owned = ptr_is_owned(e);
32318         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
32319         e_conv = InvalidShutdownScript_clone(&e_conv);
32320         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
32321         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
32322         return tag_ptr(ret_conv, true);
32323 }
32324
32325 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32326         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
32327         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
32328         return ret_conv;
32329 }
32330
32331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32332         if (!ptr_is_owned(_res)) return;
32333         void* _res_ptr = untag_ptr(_res);
32334         CHECK_ACCESS(_res_ptr);
32335         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
32336         FREE(untag_ptr(_res));
32337         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
32338 }
32339
32340 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
32341         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
32342         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
32343         return tag_ptr(ret_conv, true);
32344 }
32345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32346         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
32347         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
32348         return ret_conv;
32349 }
32350
32351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32352         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
32353         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
32354         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
32355         return tag_ptr(ret_conv, true);
32356 }
32357
32358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32359         void* o_ptr = untag_ptr(o);
32360         CHECK_ACCESS(o_ptr);
32361         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
32362         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
32363         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
32364         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
32365         return tag_ptr(ret_conv, true);
32366 }
32367
32368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32369         void* e_ptr = untag_ptr(e);
32370         CHECK_ACCESS(e_ptr);
32371         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32372         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32373         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
32374         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
32375         return tag_ptr(ret_conv, true);
32376 }
32377
32378 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32379         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
32380         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
32381         return ret_conv;
32382 }
32383
32384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32385         if (!ptr_is_owned(_res)) return;
32386         void* _res_ptr = untag_ptr(_res);
32387         CHECK_ACCESS(_res_ptr);
32388         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
32389         FREE(untag_ptr(_res));
32390         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
32391 }
32392
32393 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
32394         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
32395         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
32396         return tag_ptr(ret_conv, true);
32397 }
32398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32399         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
32400         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
32401         return ret_conv;
32402 }
32403
32404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32405         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
32406         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
32407         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
32408         return tag_ptr(ret_conv, true);
32409 }
32410
32411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32412         LDKClaimedHTLC o_conv;
32413         o_conv.inner = untag_ptr(o);
32414         o_conv.is_owned = ptr_is_owned(o);
32415         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32416         o_conv = ClaimedHTLC_clone(&o_conv);
32417         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
32418         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_ok(o_conv);
32419         return tag_ptr(ret_conv, true);
32420 }
32421
32422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32423         void* e_ptr = untag_ptr(e);
32424         CHECK_ACCESS(e_ptr);
32425         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32426         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32427         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
32428         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_err(e_conv);
32429         return tag_ptr(ret_conv, true);
32430 }
32431
32432 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32433         LDKCResult_ClaimedHTLCDecodeErrorZ* o_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(o);
32434         jboolean ret_conv = CResult_ClaimedHTLCDecodeErrorZ_is_ok(o_conv);
32435         return ret_conv;
32436 }
32437
32438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32439         if (!ptr_is_owned(_res)) return;
32440         void* _res_ptr = untag_ptr(_res);
32441         CHECK_ACCESS(_res_ptr);
32442         LDKCResult_ClaimedHTLCDecodeErrorZ _res_conv = *(LDKCResult_ClaimedHTLCDecodeErrorZ*)(_res_ptr);
32443         FREE(untag_ptr(_res));
32444         CResult_ClaimedHTLCDecodeErrorZ_free(_res_conv);
32445 }
32446
32447 static inline uint64_t CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR arg) {
32448         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
32449         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(arg);
32450         return tag_ptr(ret_conv, true);
32451 }
32452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32453         LDKCResult_ClaimedHTLCDecodeErrorZ* arg_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(arg);
32454         int64_t ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(arg_conv);
32455         return ret_conv;
32456 }
32457
32458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32459         LDKCResult_ClaimedHTLCDecodeErrorZ* orig_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(orig);
32460         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
32461         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(orig_conv);
32462         return tag_ptr(ret_conv, true);
32463 }
32464
32465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1some(JNIEnv *env, jclass clz, int64_t o) {
32466         void* o_ptr = untag_ptr(o);
32467         CHECK_ACCESS(o_ptr);
32468         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
32469         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
32470         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
32471         *ret_copy = COption_PathFailureZ_some(o_conv);
32472         int64_t ret_ref = tag_ptr(ret_copy, true);
32473         return ret_ref;
32474 }
32475
32476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1none(JNIEnv *env, jclass clz) {
32477         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
32478         *ret_copy = COption_PathFailureZ_none();
32479         int64_t ret_ref = tag_ptr(ret_copy, true);
32480         return ret_ref;
32481 }
32482
32483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32484         if (!ptr_is_owned(_res)) return;
32485         void* _res_ptr = untag_ptr(_res);
32486         CHECK_ACCESS(_res_ptr);
32487         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
32488         FREE(untag_ptr(_res));
32489         COption_PathFailureZ_free(_res_conv);
32490 }
32491
32492 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
32493         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
32494         *ret_copy = COption_PathFailureZ_clone(arg);
32495         int64_t ret_ref = tag_ptr(ret_copy, true);
32496         return ret_ref;
32497 }
32498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32499         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
32500         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
32501         return ret_conv;
32502 }
32503
32504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32505         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
32506         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
32507         *ret_copy = COption_PathFailureZ_clone(orig_conv);
32508         int64_t ret_ref = tag_ptr(ret_copy, true);
32509         return ret_ref;
32510 }
32511
32512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32513         void* o_ptr = untag_ptr(o);
32514         CHECK_ACCESS(o_ptr);
32515         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
32516         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
32517         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
32518         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
32519         return tag_ptr(ret_conv, true);
32520 }
32521
32522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32523         void* e_ptr = untag_ptr(e);
32524         CHECK_ACCESS(e_ptr);
32525         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32526         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32527         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
32528         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
32529         return tag_ptr(ret_conv, true);
32530 }
32531
32532 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32533         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
32534         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
32535         return ret_conv;
32536 }
32537
32538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32539         if (!ptr_is_owned(_res)) return;
32540         void* _res_ptr = untag_ptr(_res);
32541         CHECK_ACCESS(_res_ptr);
32542         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
32543         FREE(untag_ptr(_res));
32544         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
32545 }
32546
32547 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
32548         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
32549         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
32550         return tag_ptr(ret_conv, true);
32551 }
32552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32553         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
32554         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
32555         return ret_conv;
32556 }
32557
32558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32559         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
32560         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
32561         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
32562         return tag_ptr(ret_conv, true);
32563 }
32564
32565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1some(JNIEnv *env, jclass clz, int64_t o) {
32566         void* o_ptr = untag_ptr(o);
32567         CHECK_ACCESS(o_ptr);
32568         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
32569         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
32570         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
32571         *ret_copy = COption_ClosureReasonZ_some(o_conv);
32572         int64_t ret_ref = tag_ptr(ret_copy, true);
32573         return ret_ref;
32574 }
32575
32576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1none(JNIEnv *env, jclass clz) {
32577         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
32578         *ret_copy = COption_ClosureReasonZ_none();
32579         int64_t ret_ref = tag_ptr(ret_copy, true);
32580         return ret_ref;
32581 }
32582
32583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32584         if (!ptr_is_owned(_res)) return;
32585         void* _res_ptr = untag_ptr(_res);
32586         CHECK_ACCESS(_res_ptr);
32587         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
32588         FREE(untag_ptr(_res));
32589         COption_ClosureReasonZ_free(_res_conv);
32590 }
32591
32592 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
32593         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
32594         *ret_copy = COption_ClosureReasonZ_clone(arg);
32595         int64_t ret_ref = tag_ptr(ret_copy, true);
32596         return ret_ref;
32597 }
32598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32599         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
32600         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
32601         return ret_conv;
32602 }
32603
32604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32605         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
32606         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
32607         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
32608         int64_t ret_ref = tag_ptr(ret_copy, true);
32609         return ret_ref;
32610 }
32611
32612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32613         void* o_ptr = untag_ptr(o);
32614         CHECK_ACCESS(o_ptr);
32615         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
32616         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
32617         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
32618         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
32619         return tag_ptr(ret_conv, true);
32620 }
32621
32622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32623         void* e_ptr = untag_ptr(e);
32624         CHECK_ACCESS(e_ptr);
32625         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32626         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32627         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
32628         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
32629         return tag_ptr(ret_conv, true);
32630 }
32631
32632 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32633         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
32634         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
32635         return ret_conv;
32636 }
32637
32638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32639         if (!ptr_is_owned(_res)) return;
32640         void* _res_ptr = untag_ptr(_res);
32641         CHECK_ACCESS(_res_ptr);
32642         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
32643         FREE(untag_ptr(_res));
32644         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
32645 }
32646
32647 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
32648         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
32649         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
32650         return tag_ptr(ret_conv, true);
32651 }
32652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32653         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
32654         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
32655         return ret_conv;
32656 }
32657
32658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32659         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
32660         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
32661         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
32662         return tag_ptr(ret_conv, true);
32663 }
32664
32665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1some(JNIEnv *env, jclass clz, int64_t o) {
32666         void* o_ptr = untag_ptr(o);
32667         CHECK_ACCESS(o_ptr);
32668         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
32669         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
32670         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
32671         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
32672         int64_t ret_ref = tag_ptr(ret_copy, true);
32673         return ret_ref;
32674 }
32675
32676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1none(JNIEnv *env, jclass clz) {
32677         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
32678         *ret_copy = COption_HTLCDestinationZ_none();
32679         int64_t ret_ref = tag_ptr(ret_copy, true);
32680         return ret_ref;
32681 }
32682
32683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32684         if (!ptr_is_owned(_res)) return;
32685         void* _res_ptr = untag_ptr(_res);
32686         CHECK_ACCESS(_res_ptr);
32687         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
32688         FREE(untag_ptr(_res));
32689         COption_HTLCDestinationZ_free(_res_conv);
32690 }
32691
32692 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
32693         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
32694         *ret_copy = COption_HTLCDestinationZ_clone(arg);
32695         int64_t ret_ref = tag_ptr(ret_copy, true);
32696         return ret_ref;
32697 }
32698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32699         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
32700         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
32701         return ret_conv;
32702 }
32703
32704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32705         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
32706         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
32707         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
32708         int64_t ret_ref = tag_ptr(ret_copy, true);
32709         return ret_ref;
32710 }
32711
32712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32713         void* o_ptr = untag_ptr(o);
32714         CHECK_ACCESS(o_ptr);
32715         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
32716         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
32717         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
32718         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
32719         return tag_ptr(ret_conv, true);
32720 }
32721
32722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32723         void* e_ptr = untag_ptr(e);
32724         CHECK_ACCESS(e_ptr);
32725         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32726         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32727         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
32728         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
32729         return tag_ptr(ret_conv, true);
32730 }
32731
32732 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32733         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
32734         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
32735         return ret_conv;
32736 }
32737
32738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32739         if (!ptr_is_owned(_res)) return;
32740         void* _res_ptr = untag_ptr(_res);
32741         CHECK_ACCESS(_res_ptr);
32742         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
32743         FREE(untag_ptr(_res));
32744         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
32745 }
32746
32747 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
32748         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
32749         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
32750         return tag_ptr(ret_conv, true);
32751 }
32752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32753         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
32754         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
32755         return ret_conv;
32756 }
32757
32758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32759         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
32760         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
32761         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
32762         return tag_ptr(ret_conv, true);
32763 }
32764
32765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
32766         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_java(env, o);
32767         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
32768         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_ok(o_conv);
32769         return tag_ptr(ret_conv, true);
32770 }
32771
32772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32773         void* e_ptr = untag_ptr(e);
32774         CHECK_ACCESS(e_ptr);
32775         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32776         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32777         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
32778         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_err(e_conv);
32779         return tag_ptr(ret_conv, true);
32780 }
32781
32782 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32783         LDKCResult_PaymentFailureReasonDecodeErrorZ* o_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(o);
32784         jboolean ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o_conv);
32785         return ret_conv;
32786 }
32787
32788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32789         if (!ptr_is_owned(_res)) return;
32790         void* _res_ptr = untag_ptr(_res);
32791         CHECK_ACCESS(_res_ptr);
32792         LDKCResult_PaymentFailureReasonDecodeErrorZ _res_conv = *(LDKCResult_PaymentFailureReasonDecodeErrorZ*)(_res_ptr);
32793         FREE(untag_ptr(_res));
32794         CResult_PaymentFailureReasonDecodeErrorZ_free(_res_conv);
32795 }
32796
32797 static inline uint64_t CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR arg) {
32798         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
32799         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(arg);
32800         return tag_ptr(ret_conv, true);
32801 }
32802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32803         LDKCResult_PaymentFailureReasonDecodeErrorZ* arg_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(arg);
32804         int64_t ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(arg_conv);
32805         return ret_conv;
32806 }
32807
32808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32809         LDKCResult_PaymentFailureReasonDecodeErrorZ* orig_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(orig);
32810         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
32811         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(orig_conv);
32812         return tag_ptr(ret_conv, true);
32813 }
32814
32815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1some(JNIEnv *env, jclass clz, int8_tArray o) {
32816         LDKU128 o_ref;
32817         CHECK((*env)->GetArrayLength(env, o) == 16);
32818         (*env)->GetByteArrayRegion(env, o, 0, 16, o_ref.le_bytes);
32819         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
32820         *ret_copy = COption_U128Z_some(o_ref);
32821         int64_t ret_ref = tag_ptr(ret_copy, true);
32822         return ret_ref;
32823 }
32824
32825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1none(JNIEnv *env, jclass clz) {
32826         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
32827         *ret_copy = COption_U128Z_none();
32828         int64_t ret_ref = tag_ptr(ret_copy, true);
32829         return ret_ref;
32830 }
32831
32832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
32833         if (!ptr_is_owned(_res)) return;
32834         void* _res_ptr = untag_ptr(_res);
32835         CHECK_ACCESS(_res_ptr);
32836         LDKCOption_U128Z _res_conv = *(LDKCOption_U128Z*)(_res_ptr);
32837         FREE(untag_ptr(_res));
32838         COption_U128Z_free(_res_conv);
32839 }
32840
32841 static inline uint64_t COption_U128Z_clone_ptr(LDKCOption_U128Z *NONNULL_PTR arg) {
32842         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
32843         *ret_copy = COption_U128Z_clone(arg);
32844         int64_t ret_ref = tag_ptr(ret_copy, true);
32845         return ret_ref;
32846 }
32847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32848         LDKCOption_U128Z* arg_conv = (LDKCOption_U128Z*)untag_ptr(arg);
32849         int64_t ret_conv = COption_U128Z_clone_ptr(arg_conv);
32850         return ret_conv;
32851 }
32852
32853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32854         LDKCOption_U128Z* orig_conv = (LDKCOption_U128Z*)untag_ptr(orig);
32855         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
32856         *ret_copy = COption_U128Z_clone(orig_conv);
32857         int64_t ret_ref = tag_ptr(ret_copy, true);
32858         return ret_ref;
32859 }
32860
32861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ClaimedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
32862         LDKCVec_ClaimedHTLCZ _res_constr;
32863         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
32864         if (_res_constr.datalen > 0)
32865                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
32866         else
32867                 _res_constr.data = NULL;
32868         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
32869         for (size_t n = 0; n < _res_constr.datalen; n++) {
32870                 int64_t _res_conv_13 = _res_vals[n];
32871                 LDKClaimedHTLC _res_conv_13_conv;
32872                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
32873                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
32874                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
32875                 _res_constr.data[n] = _res_conv_13_conv;
32876         }
32877         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
32878         CVec_ClaimedHTLCZ_free(_res_constr);
32879 }
32880
32881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1some(JNIEnv *env, jclass clz, jclass o) {
32882         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_java(env, o);
32883         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
32884         *ret_copy = COption_PaymentFailureReasonZ_some(o_conv);
32885         int64_t ret_ref = tag_ptr(ret_copy, true);
32886         return ret_ref;
32887 }
32888
32889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1none(JNIEnv *env, jclass clz) {
32890         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
32891         *ret_copy = COption_PaymentFailureReasonZ_none();
32892         int64_t ret_ref = tag_ptr(ret_copy, true);
32893         return ret_ref;
32894 }
32895
32896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32897         if (!ptr_is_owned(_res)) return;
32898         void* _res_ptr = untag_ptr(_res);
32899         CHECK_ACCESS(_res_ptr);
32900         LDKCOption_PaymentFailureReasonZ _res_conv = *(LDKCOption_PaymentFailureReasonZ*)(_res_ptr);
32901         FREE(untag_ptr(_res));
32902         COption_PaymentFailureReasonZ_free(_res_conv);
32903 }
32904
32905 static inline uint64_t COption_PaymentFailureReasonZ_clone_ptr(LDKCOption_PaymentFailureReasonZ *NONNULL_PTR arg) {
32906         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
32907         *ret_copy = COption_PaymentFailureReasonZ_clone(arg);
32908         int64_t ret_ref = tag_ptr(ret_copy, true);
32909         return ret_ref;
32910 }
32911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32912         LDKCOption_PaymentFailureReasonZ* arg_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(arg);
32913         int64_t ret_conv = COption_PaymentFailureReasonZ_clone_ptr(arg_conv);
32914         return ret_conv;
32915 }
32916
32917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32918         LDKCOption_PaymentFailureReasonZ* orig_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(orig);
32919         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
32920         *ret_copy = COption_PaymentFailureReasonZ_clone(orig_conv);
32921         int64_t ret_ref = tag_ptr(ret_copy, true);
32922         return ret_ref;
32923 }
32924
32925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
32926         void* o_ptr = untag_ptr(o);
32927         CHECK_ACCESS(o_ptr);
32928         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
32929         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
32930         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32931         *ret_copy = COption_EventZ_some(o_conv);
32932         int64_t ret_ref = tag_ptr(ret_copy, true);
32933         return ret_ref;
32934 }
32935
32936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1none(JNIEnv *env, jclass clz) {
32937         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32938         *ret_copy = COption_EventZ_none();
32939         int64_t ret_ref = tag_ptr(ret_copy, true);
32940         return ret_ref;
32941 }
32942
32943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32944         if (!ptr_is_owned(_res)) return;
32945         void* _res_ptr = untag_ptr(_res);
32946         CHECK_ACCESS(_res_ptr);
32947         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
32948         FREE(untag_ptr(_res));
32949         COption_EventZ_free(_res_conv);
32950 }
32951
32952 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
32953         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32954         *ret_copy = COption_EventZ_clone(arg);
32955         int64_t ret_ref = tag_ptr(ret_copy, true);
32956         return ret_ref;
32957 }
32958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32959         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
32960         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
32961         return ret_conv;
32962 }
32963
32964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32965         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
32966         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32967         *ret_copy = COption_EventZ_clone(orig_conv);
32968         int64_t ret_ref = tag_ptr(ret_copy, true);
32969         return ret_ref;
32970 }
32971
32972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32973         void* o_ptr = untag_ptr(o);
32974         CHECK_ACCESS(o_ptr);
32975         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
32976         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
32977         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32978         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
32979         return tag_ptr(ret_conv, true);
32980 }
32981
32982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32983         void* e_ptr = untag_ptr(e);
32984         CHECK_ACCESS(e_ptr);
32985         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32986         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32987         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32988         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
32989         return tag_ptr(ret_conv, true);
32990 }
32991
32992 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32993         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
32994         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
32995         return ret_conv;
32996 }
32997
32998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32999         if (!ptr_is_owned(_res)) return;
33000         void* _res_ptr = untag_ptr(_res);
33001         CHECK_ACCESS(_res_ptr);
33002         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
33003         FREE(untag_ptr(_res));
33004         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
33005 }
33006
33007 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
33008         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
33009         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
33010         return tag_ptr(ret_conv, true);
33011 }
33012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33013         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
33014         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
33015         return ret_conv;
33016 }
33017
33018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33019         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
33020         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
33021         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
33022         return tag_ptr(ret_conv, true);
33023 }
33024
33025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
33026         LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
33027         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
33028         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_ok(o_conv);
33029         return tag_ptr(ret_conv, true);
33030 }
33031
33032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33033         void* e_ptr = untag_ptr(e);
33034         CHECK_ACCESS(e_ptr);
33035         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
33036         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
33037         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
33038         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_err(e_conv);
33039         return tag_ptr(ret_conv, true);
33040 }
33041
33042 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33043         LDKCResult_SiPrefixBolt11ParseErrorZ* o_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(o);
33044         jboolean ret_conv = CResult_SiPrefixBolt11ParseErrorZ_is_ok(o_conv);
33045         return ret_conv;
33046 }
33047
33048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33049         if (!ptr_is_owned(_res)) return;
33050         void* _res_ptr = untag_ptr(_res);
33051         CHECK_ACCESS(_res_ptr);
33052         LDKCResult_SiPrefixBolt11ParseErrorZ _res_conv = *(LDKCResult_SiPrefixBolt11ParseErrorZ*)(_res_ptr);
33053         FREE(untag_ptr(_res));
33054         CResult_SiPrefixBolt11ParseErrorZ_free(_res_conv);
33055 }
33056
33057 static inline uint64_t CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR arg) {
33058         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
33059         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(arg);
33060         return tag_ptr(ret_conv, true);
33061 }
33062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33063         LDKCResult_SiPrefixBolt11ParseErrorZ* arg_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(arg);
33064         int64_t ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(arg_conv);
33065         return ret_conv;
33066 }
33067
33068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33069         LDKCResult_SiPrefixBolt11ParseErrorZ* orig_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(orig);
33070         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
33071         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(orig_conv);
33072         return tag_ptr(ret_conv, true);
33073 }
33074
33075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33076         LDKBolt11Invoice o_conv;
33077         o_conv.inner = untag_ptr(o);
33078         o_conv.is_owned = ptr_is_owned(o);
33079         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33080         o_conv = Bolt11Invoice_clone(&o_conv);
33081         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
33082         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o_conv);
33083         return tag_ptr(ret_conv, true);
33084 }
33085
33086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33087         void* e_ptr = untag_ptr(e);
33088         CHECK_ACCESS(e_ptr);
33089         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
33090         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
33091         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
33092         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e_conv);
33093         return tag_ptr(ret_conv, true);
33094 }
33095
33096 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33097         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
33098         jboolean ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
33099         return ret_conv;
33100 }
33101
33102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33103         if (!ptr_is_owned(_res)) return;
33104         void* _res_ptr = untag_ptr(_res);
33105         CHECK_ACCESS(_res_ptr);
33106         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)(_res_ptr);
33107         FREE(untag_ptr(_res));
33108         CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res_conv);
33109 }
33110
33111 static inline uint64_t CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
33112         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
33113         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(arg);
33114         return tag_ptr(ret_conv, true);
33115 }
33116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33117         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
33118         int64_t ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
33119         return ret_conv;
33120 }
33121
33122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33123         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
33124         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
33125         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig_conv);
33126         return tag_ptr(ret_conv, true);
33127 }
33128
33129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33130         LDKSignedRawBolt11Invoice o_conv;
33131         o_conv.inner = untag_ptr(o);
33132         o_conv.is_owned = ptr_is_owned(o);
33133         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33134         o_conv = SignedRawBolt11Invoice_clone(&o_conv);
33135         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
33136         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o_conv);
33137         return tag_ptr(ret_conv, true);
33138 }
33139
33140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33141         void* e_ptr = untag_ptr(e);
33142         CHECK_ACCESS(e_ptr);
33143         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
33144         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
33145         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
33146         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e_conv);
33147         return tag_ptr(ret_conv, true);
33148 }
33149
33150 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33151         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* o_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(o);
33152         jboolean ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o_conv);
33153         return ret_conv;
33154 }
33155
33156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33157         if (!ptr_is_owned(_res)) return;
33158         void* _res_ptr = untag_ptr(_res);
33159         CHECK_ACCESS(_res_ptr);
33160         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res_conv = *(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)(_res_ptr);
33161         FREE(untag_ptr(_res));
33162         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res_conv);
33163 }
33164
33165 static inline uint64_t CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR arg) {
33166         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
33167         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(arg);
33168         return tag_ptr(ret_conv, true);
33169 }
33170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33171         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* arg_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(arg);
33172         int64_t ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(arg_conv);
33173         return ret_conv;
33174 }
33175
33176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33177         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* orig_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(orig);
33178         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
33179         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig_conv);
33180         return tag_ptr(ret_conv, true);
33181 }
33182
33183 static inline uint64_t C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR arg) {
33184         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
33185         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(arg);
33186         return tag_ptr(ret_conv, true);
33187 }
33188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33189         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(arg);
33190         int64_t ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(arg_conv);
33191         return ret_conv;
33192 }
33193
33194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33195         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(orig);
33196         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
33197         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig_conv);
33198         return tag_ptr(ret_conv, true);
33199 }
33200
33201 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) {
33202         LDKRawBolt11Invoice a_conv;
33203         a_conv.inner = untag_ptr(a);
33204         a_conv.is_owned = ptr_is_owned(a);
33205         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33206         a_conv = RawBolt11Invoice_clone(&a_conv);
33207         LDKThirtyTwoBytes b_ref;
33208         CHECK((*env)->GetArrayLength(env, b) == 32);
33209         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
33210         LDKBolt11InvoiceSignature c_conv;
33211         c_conv.inner = untag_ptr(c);
33212         c_conv.is_owned = ptr_is_owned(c);
33213         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
33214         c_conv = Bolt11InvoiceSignature_clone(&c_conv);
33215         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
33216         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
33217         return tag_ptr(ret_conv, true);
33218 }
33219
33220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33221         if (!ptr_is_owned(_res)) return;
33222         void* _res_ptr = untag_ptr(_res);
33223         CHECK_ACCESS(_res_ptr);
33224         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)(_res_ptr);
33225         FREE(untag_ptr(_res));
33226         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res_conv);
33227 }
33228
33229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33230         LDKPayeePubKey o_conv;
33231         o_conv.inner = untag_ptr(o);
33232         o_conv.is_owned = ptr_is_owned(o);
33233         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33234         o_conv = PayeePubKey_clone(&o_conv);
33235         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
33236         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_ok(o_conv);
33237         return tag_ptr(ret_conv, true);
33238 }
33239
33240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
33241         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
33242         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
33243         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_err(e_conv);
33244         return tag_ptr(ret_conv, true);
33245 }
33246
33247 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33248         LDKCResult_PayeePubKeySecp256k1ErrorZ* o_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(o);
33249         jboolean ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o_conv);
33250         return ret_conv;
33251 }
33252
33253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33254         if (!ptr_is_owned(_res)) return;
33255         void* _res_ptr = untag_ptr(_res);
33256         CHECK_ACCESS(_res_ptr);
33257         LDKCResult_PayeePubKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PayeePubKeySecp256k1ErrorZ*)(_res_ptr);
33258         FREE(untag_ptr(_res));
33259         CResult_PayeePubKeySecp256k1ErrorZ_free(_res_conv);
33260 }
33261
33262 static inline uint64_t CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR arg) {
33263         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
33264         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(arg);
33265         return tag_ptr(ret_conv, true);
33266 }
33267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33268         LDKCResult_PayeePubKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(arg);
33269         int64_t ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(arg_conv);
33270         return ret_conv;
33271 }
33272
33273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33274         LDKCResult_PayeePubKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(orig);
33275         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
33276         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(orig_conv);
33277         return tag_ptr(ret_conv, true);
33278 }
33279
33280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
33281         LDKCVec_PrivateRouteZ _res_constr;
33282         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
33283         if (_res_constr.datalen > 0)
33284                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
33285         else
33286                 _res_constr.data = NULL;
33287         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
33288         for (size_t o = 0; o < _res_constr.datalen; o++) {
33289                 int64_t _res_conv_14 = _res_vals[o];
33290                 LDKPrivateRoute _res_conv_14_conv;
33291                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
33292                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
33293                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
33294                 _res_constr.data[o] = _res_conv_14_conv;
33295         }
33296         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
33297         CVec_PrivateRouteZ_free(_res_constr);
33298 }
33299
33300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33301         LDKPositiveTimestamp o_conv;
33302         o_conv.inner = untag_ptr(o);
33303         o_conv.is_owned = ptr_is_owned(o);
33304         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33305         o_conv = PositiveTimestamp_clone(&o_conv);
33306         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
33307         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
33308         return tag_ptr(ret_conv, true);
33309 }
33310
33311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
33312         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
33313         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
33314         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
33315         return tag_ptr(ret_conv, true);
33316 }
33317
33318 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33319         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
33320         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
33321         return ret_conv;
33322 }
33323
33324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33325         if (!ptr_is_owned(_res)) return;
33326         void* _res_ptr = untag_ptr(_res);
33327         CHECK_ACCESS(_res_ptr);
33328         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
33329         FREE(untag_ptr(_res));
33330         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
33331 }
33332
33333 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
33334         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
33335         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
33336         return tag_ptr(ret_conv, true);
33337 }
33338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33339         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
33340         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
33341         return ret_conv;
33342 }
33343
33344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33345         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
33346         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
33347         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
33348         return tag_ptr(ret_conv, true);
33349 }
33350
33351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
33352         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
33353         *ret_conv = CResult_NoneBolt11SemanticErrorZ_ok();
33354         return tag_ptr(ret_conv, true);
33355 }
33356
33357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
33358         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_java(env, e);
33359         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
33360         *ret_conv = CResult_NoneBolt11SemanticErrorZ_err(e_conv);
33361         return tag_ptr(ret_conv, true);
33362 }
33363
33364 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33365         LDKCResult_NoneBolt11SemanticErrorZ* o_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(o);
33366         jboolean ret_conv = CResult_NoneBolt11SemanticErrorZ_is_ok(o_conv);
33367         return ret_conv;
33368 }
33369
33370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33371         if (!ptr_is_owned(_res)) return;
33372         void* _res_ptr = untag_ptr(_res);
33373         CHECK_ACCESS(_res_ptr);
33374         LDKCResult_NoneBolt11SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt11SemanticErrorZ*)(_res_ptr);
33375         FREE(untag_ptr(_res));
33376         CResult_NoneBolt11SemanticErrorZ_free(_res_conv);
33377 }
33378
33379 static inline uint64_t CResult_NoneBolt11SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR arg) {
33380         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
33381         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(arg);
33382         return tag_ptr(ret_conv, true);
33383 }
33384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33385         LDKCResult_NoneBolt11SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(arg);
33386         int64_t ret_conv = CResult_NoneBolt11SemanticErrorZ_clone_ptr(arg_conv);
33387         return ret_conv;
33388 }
33389
33390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33391         LDKCResult_NoneBolt11SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(orig);
33392         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
33393         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(orig_conv);
33394         return tag_ptr(ret_conv, true);
33395 }
33396
33397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33398         LDKBolt11Invoice o_conv;
33399         o_conv.inner = untag_ptr(o);
33400         o_conv.is_owned = ptr_is_owned(o);
33401         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33402         o_conv = Bolt11Invoice_clone(&o_conv);
33403         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
33404         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o_conv);
33405         return tag_ptr(ret_conv, true);
33406 }
33407
33408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
33409         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_java(env, e);
33410         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
33411         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e_conv);
33412         return tag_ptr(ret_conv, true);
33413 }
33414
33415 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33416         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(o);
33417         jboolean ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o_conv);
33418         return ret_conv;
33419 }
33420
33421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33422         if (!ptr_is_owned(_res)) return;
33423         void* _res_ptr = untag_ptr(_res);
33424         CHECK_ACCESS(_res_ptr);
33425         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)(_res_ptr);
33426         FREE(untag_ptr(_res));
33427         CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res_conv);
33428 }
33429
33430 static inline uint64_t CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR arg) {
33431         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
33432         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(arg);
33433         return tag_ptr(ret_conv, true);
33434 }
33435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33436         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(arg);
33437         int64_t ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(arg_conv);
33438         return ret_conv;
33439 }
33440
33441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33442         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(orig);
33443         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
33444         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig_conv);
33445         return tag_ptr(ret_conv, true);
33446 }
33447
33448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33449         LDKDescription o_conv;
33450         o_conv.inner = untag_ptr(o);
33451         o_conv.is_owned = ptr_is_owned(o);
33452         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33453         o_conv = Description_clone(&o_conv);
33454         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
33455         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
33456         return tag_ptr(ret_conv, true);
33457 }
33458
33459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
33460         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
33461         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
33462         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
33463         return tag_ptr(ret_conv, true);
33464 }
33465
33466 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33467         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
33468         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
33469         return ret_conv;
33470 }
33471
33472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33473         if (!ptr_is_owned(_res)) return;
33474         void* _res_ptr = untag_ptr(_res);
33475         CHECK_ACCESS(_res_ptr);
33476         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
33477         FREE(untag_ptr(_res));
33478         CResult_DescriptionCreationErrorZ_free(_res_conv);
33479 }
33480
33481 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
33482         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
33483         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
33484         return tag_ptr(ret_conv, true);
33485 }
33486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33487         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
33488         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
33489         return ret_conv;
33490 }
33491
33492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33493         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
33494         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
33495         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
33496         return tag_ptr(ret_conv, true);
33497 }
33498
33499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33500         LDKPrivateRoute o_conv;
33501         o_conv.inner = untag_ptr(o);
33502         o_conv.is_owned = ptr_is_owned(o);
33503         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33504         o_conv = PrivateRoute_clone(&o_conv);
33505         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
33506         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
33507         return tag_ptr(ret_conv, true);
33508 }
33509
33510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
33511         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
33512         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
33513         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
33514         return tag_ptr(ret_conv, true);
33515 }
33516
33517 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33518         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
33519         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
33520         return ret_conv;
33521 }
33522
33523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33524         if (!ptr_is_owned(_res)) return;
33525         void* _res_ptr = untag_ptr(_res);
33526         CHECK_ACCESS(_res_ptr);
33527         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
33528         FREE(untag_ptr(_res));
33529         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
33530 }
33531
33532 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
33533         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
33534         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
33535         return tag_ptr(ret_conv, true);
33536 }
33537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33538         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
33539         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
33540         return ret_conv;
33541 }
33542
33543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33544         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
33545         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
33546         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
33547         return tag_ptr(ret_conv, true);
33548 }
33549
33550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33551         LDKOutPoint o_conv;
33552         o_conv.inner = untag_ptr(o);
33553         o_conv.is_owned = ptr_is_owned(o);
33554         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33555         o_conv = OutPoint_clone(&o_conv);
33556         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
33557         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
33558         return tag_ptr(ret_conv, true);
33559 }
33560
33561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33562         void* e_ptr = untag_ptr(e);
33563         CHECK_ACCESS(e_ptr);
33564         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33565         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33566         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
33567         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
33568         return tag_ptr(ret_conv, true);
33569 }
33570
33571 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33572         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
33573         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
33574         return ret_conv;
33575 }
33576
33577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33578         if (!ptr_is_owned(_res)) return;
33579         void* _res_ptr = untag_ptr(_res);
33580         CHECK_ACCESS(_res_ptr);
33581         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
33582         FREE(untag_ptr(_res));
33583         CResult_OutPointDecodeErrorZ_free(_res_conv);
33584 }
33585
33586 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
33587         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
33588         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
33589         return tag_ptr(ret_conv, true);
33590 }
33591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33592         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
33593         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
33594         return ret_conv;
33595 }
33596
33597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33598         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
33599         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
33600         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
33601         return tag_ptr(ret_conv, true);
33602 }
33603
33604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33605         LDKBigSize o_conv;
33606         o_conv.inner = untag_ptr(o);
33607         o_conv.is_owned = ptr_is_owned(o);
33608         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33609         o_conv = BigSize_clone(&o_conv);
33610         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
33611         *ret_conv = CResult_BigSizeDecodeErrorZ_ok(o_conv);
33612         return tag_ptr(ret_conv, true);
33613 }
33614
33615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33616         void* e_ptr = untag_ptr(e);
33617         CHECK_ACCESS(e_ptr);
33618         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33619         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33620         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
33621         *ret_conv = CResult_BigSizeDecodeErrorZ_err(e_conv);
33622         return tag_ptr(ret_conv, true);
33623 }
33624
33625 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33626         LDKCResult_BigSizeDecodeErrorZ* o_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(o);
33627         jboolean ret_conv = CResult_BigSizeDecodeErrorZ_is_ok(o_conv);
33628         return ret_conv;
33629 }
33630
33631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33632         if (!ptr_is_owned(_res)) return;
33633         void* _res_ptr = untag_ptr(_res);
33634         CHECK_ACCESS(_res_ptr);
33635         LDKCResult_BigSizeDecodeErrorZ _res_conv = *(LDKCResult_BigSizeDecodeErrorZ*)(_res_ptr);
33636         FREE(untag_ptr(_res));
33637         CResult_BigSizeDecodeErrorZ_free(_res_conv);
33638 }
33639
33640 static inline uint64_t CResult_BigSizeDecodeErrorZ_clone_ptr(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR arg) {
33641         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
33642         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(arg);
33643         return tag_ptr(ret_conv, true);
33644 }
33645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33646         LDKCResult_BigSizeDecodeErrorZ* arg_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(arg);
33647         int64_t ret_conv = CResult_BigSizeDecodeErrorZ_clone_ptr(arg_conv);
33648         return ret_conv;
33649 }
33650
33651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33652         LDKCResult_BigSizeDecodeErrorZ* orig_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(orig);
33653         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
33654         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(orig_conv);
33655         return tag_ptr(ret_conv, true);
33656 }
33657
33658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33659         LDKHostname o_conv;
33660         o_conv.inner = untag_ptr(o);
33661         o_conv.is_owned = ptr_is_owned(o);
33662         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33663         o_conv = Hostname_clone(&o_conv);
33664         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
33665         *ret_conv = CResult_HostnameDecodeErrorZ_ok(o_conv);
33666         return tag_ptr(ret_conv, true);
33667 }
33668
33669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33670         void* e_ptr = untag_ptr(e);
33671         CHECK_ACCESS(e_ptr);
33672         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33673         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33674         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
33675         *ret_conv = CResult_HostnameDecodeErrorZ_err(e_conv);
33676         return tag_ptr(ret_conv, true);
33677 }
33678
33679 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33680         LDKCResult_HostnameDecodeErrorZ* o_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(o);
33681         jboolean ret_conv = CResult_HostnameDecodeErrorZ_is_ok(o_conv);
33682         return ret_conv;
33683 }
33684
33685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33686         if (!ptr_is_owned(_res)) return;
33687         void* _res_ptr = untag_ptr(_res);
33688         CHECK_ACCESS(_res_ptr);
33689         LDKCResult_HostnameDecodeErrorZ _res_conv = *(LDKCResult_HostnameDecodeErrorZ*)(_res_ptr);
33690         FREE(untag_ptr(_res));
33691         CResult_HostnameDecodeErrorZ_free(_res_conv);
33692 }
33693
33694 static inline uint64_t CResult_HostnameDecodeErrorZ_clone_ptr(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR arg) {
33695         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
33696         *ret_conv = CResult_HostnameDecodeErrorZ_clone(arg);
33697         return tag_ptr(ret_conv, true);
33698 }
33699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33700         LDKCResult_HostnameDecodeErrorZ* arg_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(arg);
33701         int64_t ret_conv = CResult_HostnameDecodeErrorZ_clone_ptr(arg_conv);
33702         return ret_conv;
33703 }
33704
33705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33706         LDKCResult_HostnameDecodeErrorZ* orig_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(orig);
33707         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
33708         *ret_conv = CResult_HostnameDecodeErrorZ_clone(orig_conv);
33709         return tag_ptr(ret_conv, true);
33710 }
33711
33712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33713         LDKTransactionU16LenLimited o_conv;
33714         o_conv.inner = untag_ptr(o);
33715         o_conv.is_owned = ptr_is_owned(o);
33716         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33717         o_conv = TransactionU16LenLimited_clone(&o_conv);
33718         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
33719         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_ok(o_conv);
33720         return tag_ptr(ret_conv, true);
33721 }
33722
33723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1err(JNIEnv *env, jclass clz) {
33724         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
33725         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_err();
33726         return tag_ptr(ret_conv, true);
33727 }
33728
33729 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33730         LDKCResult_TransactionU16LenLimitedNoneZ* o_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(o);
33731         jboolean ret_conv = CResult_TransactionU16LenLimitedNoneZ_is_ok(o_conv);
33732         return ret_conv;
33733 }
33734
33735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33736         if (!ptr_is_owned(_res)) return;
33737         void* _res_ptr = untag_ptr(_res);
33738         CHECK_ACCESS(_res_ptr);
33739         LDKCResult_TransactionU16LenLimitedNoneZ _res_conv = *(LDKCResult_TransactionU16LenLimitedNoneZ*)(_res_ptr);
33740         FREE(untag_ptr(_res));
33741         CResult_TransactionU16LenLimitedNoneZ_free(_res_conv);
33742 }
33743
33744 static inline uint64_t CResult_TransactionU16LenLimitedNoneZ_clone_ptr(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR arg) {
33745         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
33746         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(arg);
33747         return tag_ptr(ret_conv, true);
33748 }
33749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33750         LDKCResult_TransactionU16LenLimitedNoneZ* arg_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(arg);
33751         int64_t ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone_ptr(arg_conv);
33752         return ret_conv;
33753 }
33754
33755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33756         LDKCResult_TransactionU16LenLimitedNoneZ* orig_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(orig);
33757         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
33758         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(orig_conv);
33759         return tag_ptr(ret_conv, true);
33760 }
33761
33762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33763         LDKTransactionU16LenLimited o_conv;
33764         o_conv.inner = untag_ptr(o);
33765         o_conv.is_owned = ptr_is_owned(o);
33766         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33767         o_conv = TransactionU16LenLimited_clone(&o_conv);
33768         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
33769         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o_conv);
33770         return tag_ptr(ret_conv, true);
33771 }
33772
33773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33774         void* e_ptr = untag_ptr(e);
33775         CHECK_ACCESS(e_ptr);
33776         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33777         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33778         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
33779         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_err(e_conv);
33780         return tag_ptr(ret_conv, true);
33781 }
33782
33783 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33784         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* o_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(o);
33785         jboolean ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o_conv);
33786         return ret_conv;
33787 }
33788
33789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33790         if (!ptr_is_owned(_res)) return;
33791         void* _res_ptr = untag_ptr(_res);
33792         CHECK_ACCESS(_res_ptr);
33793         LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res_conv = *(LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)(_res_ptr);
33794         FREE(untag_ptr(_res));
33795         CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res_conv);
33796 }
33797
33798 static inline uint64_t CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR arg) {
33799         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
33800         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(arg);
33801         return tag_ptr(ret_conv, true);
33802 }
33803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33804         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* arg_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(arg);
33805         int64_t ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(arg_conv);
33806         return ret_conv;
33807 }
33808
33809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33810         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* orig_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(orig);
33811         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
33812         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig_conv);
33813         return tag_ptr(ret_conv, true);
33814 }
33815
33816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33817         LDKUntrustedString o_conv;
33818         o_conv.inner = untag_ptr(o);
33819         o_conv.is_owned = ptr_is_owned(o);
33820         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33821         o_conv = UntrustedString_clone(&o_conv);
33822         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
33823         *ret_conv = CResult_UntrustedStringDecodeErrorZ_ok(o_conv);
33824         return tag_ptr(ret_conv, true);
33825 }
33826
33827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33828         void* e_ptr = untag_ptr(e);
33829         CHECK_ACCESS(e_ptr);
33830         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33831         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33832         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
33833         *ret_conv = CResult_UntrustedStringDecodeErrorZ_err(e_conv);
33834         return tag_ptr(ret_conv, true);
33835 }
33836
33837 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33838         LDKCResult_UntrustedStringDecodeErrorZ* o_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(o);
33839         jboolean ret_conv = CResult_UntrustedStringDecodeErrorZ_is_ok(o_conv);
33840         return ret_conv;
33841 }
33842
33843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33844         if (!ptr_is_owned(_res)) return;
33845         void* _res_ptr = untag_ptr(_res);
33846         CHECK_ACCESS(_res_ptr);
33847         LDKCResult_UntrustedStringDecodeErrorZ _res_conv = *(LDKCResult_UntrustedStringDecodeErrorZ*)(_res_ptr);
33848         FREE(untag_ptr(_res));
33849         CResult_UntrustedStringDecodeErrorZ_free(_res_conv);
33850 }
33851
33852 static inline uint64_t CResult_UntrustedStringDecodeErrorZ_clone_ptr(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR arg) {
33853         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
33854         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(arg);
33855         return tag_ptr(ret_conv, true);
33856 }
33857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33858         LDKCResult_UntrustedStringDecodeErrorZ* arg_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(arg);
33859         int64_t ret_conv = CResult_UntrustedStringDecodeErrorZ_clone_ptr(arg_conv);
33860         return ret_conv;
33861 }
33862
33863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33864         LDKCResult_UntrustedStringDecodeErrorZ* orig_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(orig);
33865         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
33866         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(orig_conv);
33867         return tag_ptr(ret_conv, true);
33868 }
33869
33870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33871         LDKReceiveTlvs o_conv;
33872         o_conv.inner = untag_ptr(o);
33873         o_conv.is_owned = ptr_is_owned(o);
33874         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33875         o_conv = ReceiveTlvs_clone(&o_conv);
33876         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
33877         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_ok(o_conv);
33878         return tag_ptr(ret_conv, true);
33879 }
33880
33881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33882         void* e_ptr = untag_ptr(e);
33883         CHECK_ACCESS(e_ptr);
33884         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33885         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33886         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
33887         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_err(e_conv);
33888         return tag_ptr(ret_conv, true);
33889 }
33890
33891 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33892         LDKCResult_ReceiveTlvsDecodeErrorZ* o_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(o);
33893         jboolean ret_conv = CResult_ReceiveTlvsDecodeErrorZ_is_ok(o_conv);
33894         return ret_conv;
33895 }
33896
33897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33898         if (!ptr_is_owned(_res)) return;
33899         void* _res_ptr = untag_ptr(_res);
33900         CHECK_ACCESS(_res_ptr);
33901         LDKCResult_ReceiveTlvsDecodeErrorZ _res_conv = *(LDKCResult_ReceiveTlvsDecodeErrorZ*)(_res_ptr);
33902         FREE(untag_ptr(_res));
33903         CResult_ReceiveTlvsDecodeErrorZ_free(_res_conv);
33904 }
33905
33906 static inline uint64_t CResult_ReceiveTlvsDecodeErrorZ_clone_ptr(LDKCResult_ReceiveTlvsDecodeErrorZ *NONNULL_PTR arg) {
33907         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
33908         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_clone(arg);
33909         return tag_ptr(ret_conv, true);
33910 }
33911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33912         LDKCResult_ReceiveTlvsDecodeErrorZ* arg_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(arg);
33913         int64_t ret_conv = CResult_ReceiveTlvsDecodeErrorZ_clone_ptr(arg_conv);
33914         return ret_conv;
33915 }
33916
33917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33918         LDKCResult_ReceiveTlvsDecodeErrorZ* orig_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(orig);
33919         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
33920         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_clone(orig_conv);
33921         return tag_ptr(ret_conv, true);
33922 }
33923
33924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33925         LDKPaymentRelay o_conv;
33926         o_conv.inner = untag_ptr(o);
33927         o_conv.is_owned = ptr_is_owned(o);
33928         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33929         o_conv = PaymentRelay_clone(&o_conv);
33930         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33931         *ret_conv = CResult_PaymentRelayDecodeErrorZ_ok(o_conv);
33932         return tag_ptr(ret_conv, true);
33933 }
33934
33935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33936         void* e_ptr = untag_ptr(e);
33937         CHECK_ACCESS(e_ptr);
33938         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33939         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33940         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33941         *ret_conv = CResult_PaymentRelayDecodeErrorZ_err(e_conv);
33942         return tag_ptr(ret_conv, true);
33943 }
33944
33945 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33946         LDKCResult_PaymentRelayDecodeErrorZ* o_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(o);
33947         jboolean ret_conv = CResult_PaymentRelayDecodeErrorZ_is_ok(o_conv);
33948         return ret_conv;
33949 }
33950
33951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33952         if (!ptr_is_owned(_res)) return;
33953         void* _res_ptr = untag_ptr(_res);
33954         CHECK_ACCESS(_res_ptr);
33955         LDKCResult_PaymentRelayDecodeErrorZ _res_conv = *(LDKCResult_PaymentRelayDecodeErrorZ*)(_res_ptr);
33956         FREE(untag_ptr(_res));
33957         CResult_PaymentRelayDecodeErrorZ_free(_res_conv);
33958 }
33959
33960 static inline uint64_t CResult_PaymentRelayDecodeErrorZ_clone_ptr(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR arg) {
33961         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33962         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(arg);
33963         return tag_ptr(ret_conv, true);
33964 }
33965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33966         LDKCResult_PaymentRelayDecodeErrorZ* arg_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(arg);
33967         int64_t ret_conv = CResult_PaymentRelayDecodeErrorZ_clone_ptr(arg_conv);
33968         return ret_conv;
33969 }
33970
33971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33972         LDKCResult_PaymentRelayDecodeErrorZ* orig_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(orig);
33973         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33974         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(orig_conv);
33975         return tag_ptr(ret_conv, true);
33976 }
33977
33978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33979         LDKPaymentConstraints o_conv;
33980         o_conv.inner = untag_ptr(o);
33981         o_conv.is_owned = ptr_is_owned(o);
33982         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33983         o_conv = PaymentConstraints_clone(&o_conv);
33984         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33985         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_ok(o_conv);
33986         return tag_ptr(ret_conv, true);
33987 }
33988
33989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33990         void* e_ptr = untag_ptr(e);
33991         CHECK_ACCESS(e_ptr);
33992         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33993         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33994         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33995         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_err(e_conv);
33996         return tag_ptr(ret_conv, true);
33997 }
33998
33999 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34000         LDKCResult_PaymentConstraintsDecodeErrorZ* o_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(o);
34001         jboolean ret_conv = CResult_PaymentConstraintsDecodeErrorZ_is_ok(o_conv);
34002         return ret_conv;
34003 }
34004
34005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34006         if (!ptr_is_owned(_res)) return;
34007         void* _res_ptr = untag_ptr(_res);
34008         CHECK_ACCESS(_res_ptr);
34009         LDKCResult_PaymentConstraintsDecodeErrorZ _res_conv = *(LDKCResult_PaymentConstraintsDecodeErrorZ*)(_res_ptr);
34010         FREE(untag_ptr(_res));
34011         CResult_PaymentConstraintsDecodeErrorZ_free(_res_conv);
34012 }
34013
34014 static inline uint64_t CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR arg) {
34015         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
34016         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(arg);
34017         return tag_ptr(ret_conv, true);
34018 }
34019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34020         LDKCResult_PaymentConstraintsDecodeErrorZ* arg_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(arg);
34021         int64_t ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(arg_conv);
34022         return ret_conv;
34023 }
34024
34025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34026         LDKCResult_PaymentConstraintsDecodeErrorZ* orig_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(orig);
34027         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
34028         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(orig_conv);
34029         return tag_ptr(ret_conv, true);
34030 }
34031
34032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
34033         LDKThirtyTwoBytes o_ref;
34034         CHECK((*env)->GetArrayLength(env, o) == 32);
34035         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
34036         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
34037         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_ok(o_ref);
34038         return tag_ptr(ret_conv, true);
34039 }
34040
34041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34042         void* e_ptr = untag_ptr(e);
34043         CHECK_ACCESS(e_ptr);
34044         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
34045         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
34046         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
34047         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_err(e_conv);
34048         return tag_ptr(ret_conv, true);
34049 }
34050
34051 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34052         LDKCResult_ThirtyTwoBytesPaymentErrorZ* o_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(o);
34053         jboolean ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_is_ok(o_conv);
34054         return ret_conv;
34055 }
34056
34057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34058         if (!ptr_is_owned(_res)) return;
34059         void* _res_ptr = untag_ptr(_res);
34060         CHECK_ACCESS(_res_ptr);
34061         LDKCResult_ThirtyTwoBytesPaymentErrorZ _res_conv = *(LDKCResult_ThirtyTwoBytesPaymentErrorZ*)(_res_ptr);
34062         FREE(untag_ptr(_res));
34063         CResult_ThirtyTwoBytesPaymentErrorZ_free(_res_conv);
34064 }
34065
34066 static inline uint64_t CResult_ThirtyTwoBytesPaymentErrorZ_clone_ptr(LDKCResult_ThirtyTwoBytesPaymentErrorZ *NONNULL_PTR arg) {
34067         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
34068         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_clone(arg);
34069         return tag_ptr(ret_conv, true);
34070 }
34071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34072         LDKCResult_ThirtyTwoBytesPaymentErrorZ* arg_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(arg);
34073         int64_t ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_clone_ptr(arg_conv);
34074         return ret_conv;
34075 }
34076
34077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34078         LDKCResult_ThirtyTwoBytesPaymentErrorZ* orig_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(orig);
34079         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
34080         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_clone(orig_conv);
34081         return tag_ptr(ret_conv, true);
34082 }
34083
34084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1ok(JNIEnv *env, jclass clz) {
34085         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
34086         *ret_conv = CResult_NonePaymentErrorZ_ok();
34087         return tag_ptr(ret_conv, true);
34088 }
34089
34090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34091         void* e_ptr = untag_ptr(e);
34092         CHECK_ACCESS(e_ptr);
34093         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
34094         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
34095         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
34096         *ret_conv = CResult_NonePaymentErrorZ_err(e_conv);
34097         return tag_ptr(ret_conv, true);
34098 }
34099
34100 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34101         LDKCResult_NonePaymentErrorZ* o_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(o);
34102         jboolean ret_conv = CResult_NonePaymentErrorZ_is_ok(o_conv);
34103         return ret_conv;
34104 }
34105
34106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34107         if (!ptr_is_owned(_res)) return;
34108         void* _res_ptr = untag_ptr(_res);
34109         CHECK_ACCESS(_res_ptr);
34110         LDKCResult_NonePaymentErrorZ _res_conv = *(LDKCResult_NonePaymentErrorZ*)(_res_ptr);
34111         FREE(untag_ptr(_res));
34112         CResult_NonePaymentErrorZ_free(_res_conv);
34113 }
34114
34115 static inline uint64_t CResult_NonePaymentErrorZ_clone_ptr(LDKCResult_NonePaymentErrorZ *NONNULL_PTR arg) {
34116         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
34117         *ret_conv = CResult_NonePaymentErrorZ_clone(arg);
34118         return tag_ptr(ret_conv, true);
34119 }
34120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34121         LDKCResult_NonePaymentErrorZ* arg_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(arg);
34122         int64_t ret_conv = CResult_NonePaymentErrorZ_clone_ptr(arg_conv);
34123         return ret_conv;
34124 }
34125
34126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34127         LDKCResult_NonePaymentErrorZ* orig_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(orig);
34128         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
34129         *ret_conv = CResult_NonePaymentErrorZ_clone(orig_conv);
34130         return tag_ptr(ret_conv, true);
34131 }
34132
34133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
34134         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o_constr;
34135         o_constr.datalen = (*env)->GetArrayLength(env, o);
34136         if (o_constr.datalen > 0)
34137                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
34138         else
34139                 o_constr.data = NULL;
34140         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
34141         for (size_t o = 0; o < o_constr.datalen; o++) {
34142                 int64_t o_conv_40 = o_vals[o];
34143                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
34144                 CHECK_ACCESS(o_conv_40_ptr);
34145                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_conv_40_ptr);
34146                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o_conv_40));
34147                 o_constr.data[o] = o_conv_40_conv;
34148         }
34149         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
34150         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
34151         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_ok(o_constr);
34152         return tag_ptr(ret_conv, true);
34153 }
34154
34155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34156         void* e_ptr = untag_ptr(e);
34157         CHECK_ACCESS(e_ptr);
34158         LDKProbingError e_conv = *(LDKProbingError*)(e_ptr);
34159         e_conv = ProbingError_clone((LDKProbingError*)untag_ptr(e));
34160         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
34161         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_err(e_conv);
34162         return tag_ptr(ret_conv, true);
34163 }
34164
34165 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34166         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(o);
34167         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_is_ok(o_conv);
34168         return ret_conv;
34169 }
34170
34171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34172         if (!ptr_is_owned(_res)) return;
34173         void* _res_ptr = untag_ptr(_res);
34174         CHECK_ACCESS(_res_ptr);
34175         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)(_res_ptr);
34176         FREE(untag_ptr(_res));
34177         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_free(_res_conv);
34178 }
34179
34180 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ *NONNULL_PTR arg) {
34181         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
34182         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone(arg);
34183         return tag_ptr(ret_conv, true);
34184 }
34185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34186         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(arg);
34187         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone_ptr(arg_conv);
34188         return ret_conv;
34189 }
34190
34191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34192         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(orig);
34193         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
34194         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone(orig_conv);
34195         return tag_ptr(ret_conv, true);
34196 }
34197
34198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
34199         LDKStr o_conv = java_to_owned_str(env, o);
34200         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
34201         *ret_conv = CResult_StrSecp256k1ErrorZ_ok(o_conv);
34202         return tag_ptr(ret_conv, true);
34203 }
34204
34205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
34206         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
34207         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
34208         *ret_conv = CResult_StrSecp256k1ErrorZ_err(e_conv);
34209         return tag_ptr(ret_conv, true);
34210 }
34211
34212 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34213         LDKCResult_StrSecp256k1ErrorZ* o_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(o);
34214         jboolean ret_conv = CResult_StrSecp256k1ErrorZ_is_ok(o_conv);
34215         return ret_conv;
34216 }
34217
34218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34219         if (!ptr_is_owned(_res)) return;
34220         void* _res_ptr = untag_ptr(_res);
34221         CHECK_ACCESS(_res_ptr);
34222         LDKCResult_StrSecp256k1ErrorZ _res_conv = *(LDKCResult_StrSecp256k1ErrorZ*)(_res_ptr);
34223         FREE(untag_ptr(_res));
34224         CResult_StrSecp256k1ErrorZ_free(_res_conv);
34225 }
34226
34227 static inline uint64_t CResult_StrSecp256k1ErrorZ_clone_ptr(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR arg) {
34228         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
34229         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(arg);
34230         return tag_ptr(ret_conv, true);
34231 }
34232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34233         LDKCResult_StrSecp256k1ErrorZ* arg_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(arg);
34234         int64_t ret_conv = CResult_StrSecp256k1ErrorZ_clone_ptr(arg_conv);
34235         return ret_conv;
34236 }
34237
34238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34239         LDKCResult_StrSecp256k1ErrorZ* orig_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(orig);
34240         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
34241         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(orig_conv);
34242         return tag_ptr(ret_conv, true);
34243 }
34244
34245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34246         void* o_ptr = untag_ptr(o);
34247         CHECK_ACCESS(o_ptr);
34248         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
34249         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
34250         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
34251         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
34252         return tag_ptr(ret_conv, true);
34253 }
34254
34255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
34256         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_java(env, e);
34257         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
34258         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
34259         return tag_ptr(ret_conv, true);
34260 }
34261
34262 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34263         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
34264         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
34265         return ret_conv;
34266 }
34267
34268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34269         if (!ptr_is_owned(_res)) return;
34270         void* _res_ptr = untag_ptr(_res);
34271         CHECK_ACCESS(_res_ptr);
34272         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
34273         FREE(untag_ptr(_res));
34274         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
34275 }
34276
34277 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
34278         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
34279         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
34280         return tag_ptr(ret_conv, true);
34281 }
34282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34283         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
34284         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
34285         return ret_conv;
34286 }
34287
34288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34289         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
34290         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
34291         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
34292         return tag_ptr(ret_conv, true);
34293 }
34294
34295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34296         LDKOnionMessagePath o_conv;
34297         o_conv.inner = untag_ptr(o);
34298         o_conv.is_owned = ptr_is_owned(o);
34299         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34300         o_conv = OnionMessagePath_clone(&o_conv);
34301         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
34302         *ret_conv = CResult_OnionMessagePathNoneZ_ok(o_conv);
34303         return tag_ptr(ret_conv, true);
34304 }
34305
34306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1err(JNIEnv *env, jclass clz) {
34307         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
34308         *ret_conv = CResult_OnionMessagePathNoneZ_err();
34309         return tag_ptr(ret_conv, true);
34310 }
34311
34312 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34313         LDKCResult_OnionMessagePathNoneZ* o_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(o);
34314         jboolean ret_conv = CResult_OnionMessagePathNoneZ_is_ok(o_conv);
34315         return ret_conv;
34316 }
34317
34318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34319         if (!ptr_is_owned(_res)) return;
34320         void* _res_ptr = untag_ptr(_res);
34321         CHECK_ACCESS(_res_ptr);
34322         LDKCResult_OnionMessagePathNoneZ _res_conv = *(LDKCResult_OnionMessagePathNoneZ*)(_res_ptr);
34323         FREE(untag_ptr(_res));
34324         CResult_OnionMessagePathNoneZ_free(_res_conv);
34325 }
34326
34327 static inline uint64_t CResult_OnionMessagePathNoneZ_clone_ptr(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR arg) {
34328         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
34329         *ret_conv = CResult_OnionMessagePathNoneZ_clone(arg);
34330         return tag_ptr(ret_conv, true);
34331 }
34332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34333         LDKCResult_OnionMessagePathNoneZ* arg_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(arg);
34334         int64_t ret_conv = CResult_OnionMessagePathNoneZ_clone_ptr(arg_conv);
34335         return ret_conv;
34336 }
34337
34338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34339         LDKCResult_OnionMessagePathNoneZ* orig_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(orig);
34340         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
34341         *ret_conv = CResult_OnionMessagePathNoneZ_clone(orig_conv);
34342         return tag_ptr(ret_conv, true);
34343 }
34344
34345 static inline uint64_t C2Tuple_PublicKeyOnionMessageZ_clone_ptr(LDKC2Tuple_PublicKeyOnionMessageZ *NONNULL_PTR arg) {
34346         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
34347         *ret_conv = C2Tuple_PublicKeyOnionMessageZ_clone(arg);
34348         return tag_ptr(ret_conv, true);
34349 }
34350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyOnionMessageZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34351         LDKC2Tuple_PublicKeyOnionMessageZ* arg_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(arg);
34352         int64_t ret_conv = C2Tuple_PublicKeyOnionMessageZ_clone_ptr(arg_conv);
34353         return ret_conv;
34354 }
34355
34356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyOnionMessageZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34357         LDKC2Tuple_PublicKeyOnionMessageZ* orig_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(orig);
34358         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
34359         *ret_conv = C2Tuple_PublicKeyOnionMessageZ_clone(orig_conv);
34360         return tag_ptr(ret_conv, true);
34361 }
34362
34363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyOnionMessageZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
34364         LDKPublicKey a_ref;
34365         CHECK((*env)->GetArrayLength(env, a) == 33);
34366         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
34367         LDKOnionMessage b_conv;
34368         b_conv.inner = untag_ptr(b);
34369         b_conv.is_owned = ptr_is_owned(b);
34370         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34371         b_conv = OnionMessage_clone(&b_conv);
34372         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
34373         *ret_conv = C2Tuple_PublicKeyOnionMessageZ_new(a_ref, b_conv);
34374         return tag_ptr(ret_conv, true);
34375 }
34376
34377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyOnionMessageZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34378         if (!ptr_is_owned(_res)) return;
34379         void* _res_ptr = untag_ptr(_res);
34380         CHECK_ACCESS(_res_ptr);
34381         LDKC2Tuple_PublicKeyOnionMessageZ _res_conv = *(LDKC2Tuple_PublicKeyOnionMessageZ*)(_res_ptr);
34382         FREE(untag_ptr(_res));
34383         C2Tuple_PublicKeyOnionMessageZ_free(_res_conv);
34384 }
34385
34386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PublicKeyOnionMessageZSendErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34387         void* o_ptr = untag_ptr(o);
34388         CHECK_ACCESS(o_ptr);
34389         LDKC2Tuple_PublicKeyOnionMessageZ o_conv = *(LDKC2Tuple_PublicKeyOnionMessageZ*)(o_ptr);
34390         o_conv = C2Tuple_PublicKeyOnionMessageZ_clone((LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(o));
34391         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ), "LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ");
34392         *ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_ok(o_conv);
34393         return tag_ptr(ret_conv, true);
34394 }
34395
34396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PublicKeyOnionMessageZSendErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34397         void* e_ptr = untag_ptr(e);
34398         CHECK_ACCESS(e_ptr);
34399         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
34400         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
34401         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ), "LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ");
34402         *ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_err(e_conv);
34403         return tag_ptr(ret_conv, true);
34404 }
34405
34406 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PublicKeyOnionMessageZSendErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34407         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* o_conv = (LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)untag_ptr(o);
34408         jboolean ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_is_ok(o_conv);
34409         return ret_conv;
34410 }
34411
34412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PublicKeyOnionMessageZSendErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34413         if (!ptr_is_owned(_res)) return;
34414         void* _res_ptr = untag_ptr(_res);
34415         CHECK_ACCESS(_res_ptr);
34416         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ _res_conv = *(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)(_res_ptr);
34417         FREE(untag_ptr(_res));
34418         CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_free(_res_conv);
34419 }
34420
34421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34422         void* o_ptr = untag_ptr(o);
34423         CHECK_ACCESS(o_ptr);
34424         LDKPeeledOnion o_conv = *(LDKPeeledOnion*)(o_ptr);
34425         o_conv = PeeledOnion_clone((LDKPeeledOnion*)untag_ptr(o));
34426         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
34427         *ret_conv = CResult_PeeledOnionNoneZ_ok(o_conv);
34428         return tag_ptr(ret_conv, true);
34429 }
34430
34431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1err(JNIEnv *env, jclass clz) {
34432         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
34433         *ret_conv = CResult_PeeledOnionNoneZ_err();
34434         return tag_ptr(ret_conv, true);
34435 }
34436
34437 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34438         LDKCResult_PeeledOnionNoneZ* o_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(o);
34439         jboolean ret_conv = CResult_PeeledOnionNoneZ_is_ok(o_conv);
34440         return ret_conv;
34441 }
34442
34443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34444         if (!ptr_is_owned(_res)) return;
34445         void* _res_ptr = untag_ptr(_res);
34446         CHECK_ACCESS(_res_ptr);
34447         LDKCResult_PeeledOnionNoneZ _res_conv = *(LDKCResult_PeeledOnionNoneZ*)(_res_ptr);
34448         FREE(untag_ptr(_res));
34449         CResult_PeeledOnionNoneZ_free(_res_conv);
34450 }
34451
34452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1ok(JNIEnv *env, jclass clz) {
34453         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
34454         *ret_conv = CResult_NoneSendErrorZ_ok();
34455         return tag_ptr(ret_conv, true);
34456 }
34457
34458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34459         void* e_ptr = untag_ptr(e);
34460         CHECK_ACCESS(e_ptr);
34461         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
34462         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
34463         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
34464         *ret_conv = CResult_NoneSendErrorZ_err(e_conv);
34465         return tag_ptr(ret_conv, true);
34466 }
34467
34468 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34469         LDKCResult_NoneSendErrorZ* o_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(o);
34470         jboolean ret_conv = CResult_NoneSendErrorZ_is_ok(o_conv);
34471         return ret_conv;
34472 }
34473
34474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34475         if (!ptr_is_owned(_res)) return;
34476         void* _res_ptr = untag_ptr(_res);
34477         CHECK_ACCESS(_res_ptr);
34478         LDKCResult_NoneSendErrorZ _res_conv = *(LDKCResult_NoneSendErrorZ*)(_res_ptr);
34479         FREE(untag_ptr(_res));
34480         CResult_NoneSendErrorZ_free(_res_conv);
34481 }
34482
34483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34484         LDKBlindedPath o_conv;
34485         o_conv.inner = untag_ptr(o);
34486         o_conv.is_owned = ptr_is_owned(o);
34487         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34488         o_conv = BlindedPath_clone(&o_conv);
34489         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
34490         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
34491         return tag_ptr(ret_conv, true);
34492 }
34493
34494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1err(JNIEnv *env, jclass clz) {
34495         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
34496         *ret_conv = CResult_BlindedPathNoneZ_err();
34497         return tag_ptr(ret_conv, true);
34498 }
34499
34500 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34501         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
34502         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
34503         return ret_conv;
34504 }
34505
34506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34507         if (!ptr_is_owned(_res)) return;
34508         void* _res_ptr = untag_ptr(_res);
34509         CHECK_ACCESS(_res_ptr);
34510         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
34511         FREE(untag_ptr(_res));
34512         CResult_BlindedPathNoneZ_free(_res_conv);
34513 }
34514
34515 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
34516         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
34517         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
34518         return tag_ptr(ret_conv, true);
34519 }
34520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34521         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
34522         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
34523         return ret_conv;
34524 }
34525
34526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34527         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
34528         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
34529         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
34530         return tag_ptr(ret_conv, true);
34531 }
34532
34533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34534         void* o_ptr = untag_ptr(o);
34535         CHECK_ACCESS(o_ptr);
34536         LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_ptr);
34537         o_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o));
34538         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
34539         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o_conv);
34540         return tag_ptr(ret_conv, true);
34541 }
34542
34543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1err(JNIEnv *env, jclass clz) {
34544         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
34545         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err();
34546         return tag_ptr(ret_conv, true);
34547 }
34548
34549 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34550         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* o_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(o);
34551         jboolean ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o_conv);
34552         return ret_conv;
34553 }
34554
34555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34556         if (!ptr_is_owned(_res)) return;
34557         void* _res_ptr = untag_ptr(_res);
34558         CHECK_ACCESS(_res_ptr);
34559         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ _res_conv = *(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)(_res_ptr);
34560         FREE(untag_ptr(_res));
34561         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res_conv);
34562 }
34563
34564 static inline uint64_t CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR arg) {
34565         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
34566         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(arg);
34567         return tag_ptr(ret_conv, true);
34568 }
34569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34570         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* arg_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(arg);
34571         int64_t ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(arg_conv);
34572         return ret_conv;
34573 }
34574
34575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34576         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* orig_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(orig);
34577         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
34578         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig_conv);
34579         return tag_ptr(ret_conv, true);
34580 }
34581
34582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34583         LDKBlindedPath o_conv;
34584         o_conv.inner = untag_ptr(o);
34585         o_conv.is_owned = ptr_is_owned(o);
34586         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34587         o_conv = BlindedPath_clone(&o_conv);
34588         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
34589         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
34590         return tag_ptr(ret_conv, true);
34591 }
34592
34593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34594         void* e_ptr = untag_ptr(e);
34595         CHECK_ACCESS(e_ptr);
34596         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34597         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34598         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
34599         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
34600         return tag_ptr(ret_conv, true);
34601 }
34602
34603 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34604         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
34605         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
34606         return ret_conv;
34607 }
34608
34609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34610         if (!ptr_is_owned(_res)) return;
34611         void* _res_ptr = untag_ptr(_res);
34612         CHECK_ACCESS(_res_ptr);
34613         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
34614         FREE(untag_ptr(_res));
34615         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
34616 }
34617
34618 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
34619         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
34620         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
34621         return tag_ptr(ret_conv, true);
34622 }
34623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34624         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
34625         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
34626         return ret_conv;
34627 }
34628
34629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34630         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
34631         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
34632         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
34633         return tag_ptr(ret_conv, true);
34634 }
34635
34636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34637         LDKBlindedHop o_conv;
34638         o_conv.inner = untag_ptr(o);
34639         o_conv.is_owned = ptr_is_owned(o);
34640         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34641         o_conv = BlindedHop_clone(&o_conv);
34642         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
34643         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
34644         return tag_ptr(ret_conv, true);
34645 }
34646
34647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34648         void* e_ptr = untag_ptr(e);
34649         CHECK_ACCESS(e_ptr);
34650         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34651         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34652         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
34653         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
34654         return tag_ptr(ret_conv, true);
34655 }
34656
34657 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34658         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
34659         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
34660         return ret_conv;
34661 }
34662
34663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34664         if (!ptr_is_owned(_res)) return;
34665         void* _res_ptr = untag_ptr(_res);
34666         CHECK_ACCESS(_res_ptr);
34667         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
34668         FREE(untag_ptr(_res));
34669         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
34670 }
34671
34672 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
34673         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
34674         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
34675         return tag_ptr(ret_conv, true);
34676 }
34677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34678         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
34679         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
34680         return ret_conv;
34681 }
34682
34683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34684         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
34685         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
34686         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
34687         return tag_ptr(ret_conv, true);
34688 }
34689
34690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34691         LDKInvoiceError o_conv;
34692         o_conv.inner = untag_ptr(o);
34693         o_conv.is_owned = ptr_is_owned(o);
34694         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34695         o_conv = InvoiceError_clone(&o_conv);
34696         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34697         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_ok(o_conv);
34698         return tag_ptr(ret_conv, true);
34699 }
34700
34701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34702         void* e_ptr = untag_ptr(e);
34703         CHECK_ACCESS(e_ptr);
34704         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34705         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34706         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34707         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_err(e_conv);
34708         return tag_ptr(ret_conv, true);
34709 }
34710
34711 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34712         LDKCResult_InvoiceErrorDecodeErrorZ* o_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(o);
34713         jboolean ret_conv = CResult_InvoiceErrorDecodeErrorZ_is_ok(o_conv);
34714         return ret_conv;
34715 }
34716
34717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34718         if (!ptr_is_owned(_res)) return;
34719         void* _res_ptr = untag_ptr(_res);
34720         CHECK_ACCESS(_res_ptr);
34721         LDKCResult_InvoiceErrorDecodeErrorZ _res_conv = *(LDKCResult_InvoiceErrorDecodeErrorZ*)(_res_ptr);
34722         FREE(untag_ptr(_res));
34723         CResult_InvoiceErrorDecodeErrorZ_free(_res_conv);
34724 }
34725
34726 static inline uint64_t CResult_InvoiceErrorDecodeErrorZ_clone_ptr(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR arg) {
34727         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34728         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(arg);
34729         return tag_ptr(ret_conv, true);
34730 }
34731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34732         LDKCResult_InvoiceErrorDecodeErrorZ* arg_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(arg);
34733         int64_t ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone_ptr(arg_conv);
34734         return ret_conv;
34735 }
34736
34737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34738         LDKCResult_InvoiceErrorDecodeErrorZ* orig_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(orig);
34739         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34740         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(orig_conv);
34741         return tag_ptr(ret_conv, true);
34742 }
34743
34744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
34745         void* o_ptr = untag_ptr(o);
34746         CHECK_ACCESS(o_ptr);
34747         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
34748         if (o_conv.free == LDKFilter_JCalls_free) {
34749                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34750                 LDKFilter_JCalls_cloned(&o_conv);
34751         }
34752         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
34753         *ret_copy = COption_FilterZ_some(o_conv);
34754         int64_t ret_ref = tag_ptr(ret_copy, true);
34755         return ret_ref;
34756 }
34757
34758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
34759         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
34760         *ret_copy = COption_FilterZ_none();
34761         int64_t ret_ref = tag_ptr(ret_copy, true);
34762         return ret_ref;
34763 }
34764
34765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34766         if (!ptr_is_owned(_res)) return;
34767         void* _res_ptr = untag_ptr(_res);
34768         CHECK_ACCESS(_res_ptr);
34769         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
34770         FREE(untag_ptr(_res));
34771         COption_FilterZ_free(_res_conv);
34772 }
34773
34774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34775         LDKLockedChannelMonitor o_conv;
34776         o_conv.inner = untag_ptr(o);
34777         o_conv.is_owned = ptr_is_owned(o);
34778         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34779         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
34780         
34781         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
34782         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
34783         return tag_ptr(ret_conv, true);
34784 }
34785
34786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) {
34787         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
34788         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
34789         return tag_ptr(ret_conv, true);
34790 }
34791
34792 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34793         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
34794         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
34795         return ret_conv;
34796 }
34797
34798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34799         if (!ptr_is_owned(_res)) return;
34800         void* _res_ptr = untag_ptr(_res);
34801         CHECK_ACCESS(_res_ptr);
34802         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
34803         FREE(untag_ptr(_res));
34804         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
34805 }
34806
34807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1OutPointZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
34808         LDKCVec_OutPointZ _res_constr;
34809         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
34810         if (_res_constr.datalen > 0)
34811                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
34812         else
34813                 _res_constr.data = NULL;
34814         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
34815         for (size_t k = 0; k < _res_constr.datalen; k++) {
34816                 int64_t _res_conv_10 = _res_vals[k];
34817                 LDKOutPoint _res_conv_10_conv;
34818                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
34819                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
34820                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
34821                 _res_constr.data[k] = _res_conv_10_conv;
34822         }
34823         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
34824         CVec_OutPointZ_free(_res_constr);
34825 }
34826
34827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorUpdateIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
34828         LDKCVec_MonitorUpdateIdZ _res_constr;
34829         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
34830         if (_res_constr.datalen > 0)
34831                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
34832         else
34833                 _res_constr.data = NULL;
34834         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
34835         for (size_t r = 0; r < _res_constr.datalen; r++) {
34836                 int64_t _res_conv_17 = _res_vals[r];
34837                 LDKMonitorUpdateId _res_conv_17_conv;
34838                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
34839                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
34840                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
34841                 _res_constr.data[r] = _res_conv_17_conv;
34842         }
34843         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
34844         CVec_MonitorUpdateIdZ_free(_res_constr);
34845 }
34846
34847 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
34848         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
34849         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
34850         return tag_ptr(ret_conv, true);
34851 }
34852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34853         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
34854         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
34855         return ret_conv;
34856 }
34857
34858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34859         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
34860         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
34861         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
34862         return tag_ptr(ret_conv, true);
34863 }
34864
34865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_tArray b) {
34866         LDKOutPoint a_conv;
34867         a_conv.inner = untag_ptr(a);
34868         a_conv.is_owned = ptr_is_owned(a);
34869         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34870         a_conv = OutPoint_clone(&a_conv);
34871         LDKCVec_MonitorUpdateIdZ b_constr;
34872         b_constr.datalen = (*env)->GetArrayLength(env, b);
34873         if (b_constr.datalen > 0)
34874                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
34875         else
34876                 b_constr.data = NULL;
34877         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
34878         for (size_t r = 0; r < b_constr.datalen; r++) {
34879                 int64_t b_conv_17 = b_vals[r];
34880                 LDKMonitorUpdateId b_conv_17_conv;
34881                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
34882                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
34883                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
34884                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
34885                 b_constr.data[r] = b_conv_17_conv;
34886         }
34887         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
34888         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
34889         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
34890         return tag_ptr(ret_conv, true);
34891 }
34892
34893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34894         if (!ptr_is_owned(_res)) return;
34895         void* _res_ptr = untag_ptr(_res);
34896         CHECK_ACCESS(_res_ptr);
34897         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
34898         FREE(untag_ptr(_res));
34899         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
34900 }
34901
34902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1OutPointCVec_1MonitorUpdateIdZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
34903         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
34904         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
34905         if (_res_constr.datalen > 0)
34906                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
34907         else
34908                 _res_constr.data = NULL;
34909         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
34910         for (size_t p = 0; p < _res_constr.datalen; p++) {
34911                 int64_t _res_conv_41 = _res_vals[p];
34912                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
34913                 CHECK_ACCESS(_res_conv_41_ptr);
34914                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
34915                 FREE(untag_ptr(_res_conv_41));
34916                 _res_constr.data[p] = _res_conv_41_conv;
34917         }
34918         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
34919         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
34920 }
34921
34922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
34923         if (!ptr_is_owned(this_ptr)) return;
34924         void* this_ptr_ptr = untag_ptr(this_ptr);
34925         CHECK_ACCESS(this_ptr_ptr);
34926         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
34927         FREE(untag_ptr(this_ptr));
34928         APIError_free(this_ptr_conv);
34929 }
34930
34931 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
34932         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34933         *ret_copy = APIError_clone(arg);
34934         int64_t ret_ref = tag_ptr(ret_copy, true);
34935         return ret_ref;
34936 }
34937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34938         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
34939         int64_t ret_conv = APIError_clone_ptr(arg_conv);
34940         return ret_conv;
34941 }
34942
34943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34944         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
34945         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34946         *ret_copy = APIError_clone(orig_conv);
34947         int64_t ret_ref = tag_ptr(ret_copy, true);
34948         return ret_ref;
34949 }
34950
34951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
34952         LDKStr err_conv = java_to_owned_str(env, err);
34953         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34954         *ret_copy = APIError_apimisuse_error(err_conv);
34955         int64_t ret_ref = tag_ptr(ret_copy, true);
34956         return ret_ref;
34957 }
34958
34959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
34960         LDKStr err_conv = java_to_owned_str(env, err);
34961         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34962         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
34963         int64_t ret_ref = tag_ptr(ret_copy, true);
34964         return ret_ref;
34965 }
34966
34967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1invalid_1route(JNIEnv *env, jclass clz, jstring err) {
34968         LDKStr err_conv = java_to_owned_str(env, err);
34969         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34970         *ret_copy = APIError_invalid_route(err_conv);
34971         int64_t ret_ref = tag_ptr(ret_copy, true);
34972         return ret_ref;
34973 }
34974
34975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
34976         LDKStr err_conv = java_to_owned_str(env, err);
34977         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34978         *ret_copy = APIError_channel_unavailable(err_conv);
34979         int64_t ret_ref = tag_ptr(ret_copy, true);
34980         return ret_ref;
34981 }
34982
34983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1in_1progress(JNIEnv *env, jclass clz) {
34984         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34985         *ret_copy = APIError_monitor_update_in_progress();
34986         int64_t ret_ref = tag_ptr(ret_copy, true);
34987         return ret_ref;
34988 }
34989
34990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
34991         LDKShutdownScript script_conv;
34992         script_conv.inner = untag_ptr(script);
34993         script_conv.is_owned = ptr_is_owned(script);
34994         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
34995         script_conv = ShutdownScript_clone(&script_conv);
34996         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34997         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
34998         int64_t ret_ref = tag_ptr(ret_copy, true);
34999         return ret_ref;
35000 }
35001
35002 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_APIError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35003         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
35004         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
35005         jboolean ret_conv = APIError_eq(a_conv, b_conv);
35006         return ret_conv;
35007 }
35008
35009 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_APIError_1write(JNIEnv *env, jclass clz, int64_t obj) {
35010         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
35011         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
35012         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35013         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35014         CVec_u8Z_free(ret_var);
35015         return ret_arr;
35016 }
35017
35018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35019         LDKu8slice ser_ref;
35020         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35021         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35022         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
35023         *ret_conv = APIError_read(ser_ref);
35024         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35025         return tag_ptr(ret_conv, true);
35026 }
35027
35028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35029         LDKBigSize this_obj_conv;
35030         this_obj_conv.inner = untag_ptr(this_obj);
35031         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35033         BigSize_free(this_obj_conv);
35034 }
35035
35036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
35037         LDKBigSize this_ptr_conv;
35038         this_ptr_conv.inner = untag_ptr(this_ptr);
35039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35041         this_ptr_conv.is_owned = false;
35042         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
35043         return ret_conv;
35044 }
35045
35046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35047         LDKBigSize this_ptr_conv;
35048         this_ptr_conv.inner = untag_ptr(this_ptr);
35049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35051         this_ptr_conv.is_owned = false;
35052         BigSize_set_a(&this_ptr_conv, val);
35053 }
35054
35055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
35056         LDKBigSize ret_var = BigSize_new(a_arg);
35057         int64_t ret_ref = 0;
35058         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35059         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35060         return ret_ref;
35061 }
35062
35063 static inline uint64_t BigSize_clone_ptr(LDKBigSize *NONNULL_PTR arg) {
35064         LDKBigSize ret_var = BigSize_clone(arg);
35065         int64_t ret_ref = 0;
35066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35068         return ret_ref;
35069 }
35070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35071         LDKBigSize arg_conv;
35072         arg_conv.inner = untag_ptr(arg);
35073         arg_conv.is_owned = ptr_is_owned(arg);
35074         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35075         arg_conv.is_owned = false;
35076         int64_t ret_conv = BigSize_clone_ptr(&arg_conv);
35077         return ret_conv;
35078 }
35079
35080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35081         LDKBigSize orig_conv;
35082         orig_conv.inner = untag_ptr(orig);
35083         orig_conv.is_owned = ptr_is_owned(orig);
35084         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35085         orig_conv.is_owned = false;
35086         LDKBigSize ret_var = BigSize_clone(&orig_conv);
35087         int64_t ret_ref = 0;
35088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35090         return ret_ref;
35091 }
35092
35093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1hash(JNIEnv *env, jclass clz, int64_t o) {
35094         LDKBigSize o_conv;
35095         o_conv.inner = untag_ptr(o);
35096         o_conv.is_owned = ptr_is_owned(o);
35097         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35098         o_conv.is_owned = false;
35099         int64_t ret_conv = BigSize_hash(&o_conv);
35100         return ret_conv;
35101 }
35102
35103 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BigSize_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35104         LDKBigSize a_conv;
35105         a_conv.inner = untag_ptr(a);
35106         a_conv.is_owned = ptr_is_owned(a);
35107         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35108         a_conv.is_owned = false;
35109         LDKBigSize b_conv;
35110         b_conv.inner = untag_ptr(b);
35111         b_conv.is_owned = ptr_is_owned(b);
35112         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35113         b_conv.is_owned = false;
35114         jboolean ret_conv = BigSize_eq(&a_conv, &b_conv);
35115         return ret_conv;
35116 }
35117
35118 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BigSize_1write(JNIEnv *env, jclass clz, int64_t obj) {
35119         LDKBigSize obj_conv;
35120         obj_conv.inner = untag_ptr(obj);
35121         obj_conv.is_owned = ptr_is_owned(obj);
35122         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35123         obj_conv.is_owned = false;
35124         LDKCVec_u8Z ret_var = BigSize_write(&obj_conv);
35125         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35126         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35127         CVec_u8Z_free(ret_var);
35128         return ret_arr;
35129 }
35130
35131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35132         LDKu8slice ser_ref;
35133         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35134         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35135         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
35136         *ret_conv = BigSize_read(ser_ref);
35137         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35138         return tag_ptr(ret_conv, true);
35139 }
35140
35141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Hostname_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35142         LDKHostname this_obj_conv;
35143         this_obj_conv.inner = untag_ptr(this_obj);
35144         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35146         Hostname_free(this_obj_conv);
35147 }
35148
35149 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
35150         LDKHostname ret_var = Hostname_clone(arg);
35151         int64_t ret_ref = 0;
35152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35154         return ret_ref;
35155 }
35156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35157         LDKHostname arg_conv;
35158         arg_conv.inner = untag_ptr(arg);
35159         arg_conv.is_owned = ptr_is_owned(arg);
35160         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35161         arg_conv.is_owned = false;
35162         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
35163         return ret_conv;
35164 }
35165
35166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35167         LDKHostname orig_conv;
35168         orig_conv.inner = untag_ptr(orig);
35169         orig_conv.is_owned = ptr_is_owned(orig);
35170         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35171         orig_conv.is_owned = false;
35172         LDKHostname ret_var = Hostname_clone(&orig_conv);
35173         int64_t ret_ref = 0;
35174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35176         return ret_ref;
35177 }
35178
35179 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Hostname_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35180         LDKHostname a_conv;
35181         a_conv.inner = untag_ptr(a);
35182         a_conv.is_owned = ptr_is_owned(a);
35183         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35184         a_conv.is_owned = false;
35185         LDKHostname b_conv;
35186         b_conv.inner = untag_ptr(b);
35187         b_conv.is_owned = ptr_is_owned(b);
35188         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35189         b_conv.is_owned = false;
35190         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
35191         return ret_conv;
35192 }
35193
35194 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Hostname_1len(JNIEnv *env, jclass clz, int64_t this_arg) {
35195         LDKHostname this_arg_conv;
35196         this_arg_conv.inner = untag_ptr(this_arg);
35197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35199         this_arg_conv.is_owned = false;
35200         int8_t ret_conv = Hostname_len(&this_arg_conv);
35201         return ret_conv;
35202 }
35203
35204 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Hostname_1write(JNIEnv *env, jclass clz, int64_t obj) {
35205         LDKHostname obj_conv;
35206         obj_conv.inner = untag_ptr(obj);
35207         obj_conv.is_owned = ptr_is_owned(obj);
35208         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35209         obj_conv.is_owned = false;
35210         LDKCVec_u8Z ret_var = Hostname_write(&obj_conv);
35211         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35212         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35213         CVec_u8Z_free(ret_var);
35214         return ret_arr;
35215 }
35216
35217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35218         LDKu8slice ser_ref;
35219         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35220         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35221         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
35222         *ret_conv = Hostname_read(ser_ref);
35223         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35224         return tag_ptr(ret_conv, true);
35225 }
35226
35227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35228         LDKTransactionU16LenLimited this_obj_conv;
35229         this_obj_conv.inner = untag_ptr(this_obj);
35230         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35232         TransactionU16LenLimited_free(this_obj_conv);
35233 }
35234
35235 static inline uint64_t TransactionU16LenLimited_clone_ptr(LDKTransactionU16LenLimited *NONNULL_PTR arg) {
35236         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(arg);
35237         int64_t ret_ref = 0;
35238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35240         return ret_ref;
35241 }
35242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35243         LDKTransactionU16LenLimited arg_conv;
35244         arg_conv.inner = untag_ptr(arg);
35245         arg_conv.is_owned = ptr_is_owned(arg);
35246         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35247         arg_conv.is_owned = false;
35248         int64_t ret_conv = TransactionU16LenLimited_clone_ptr(&arg_conv);
35249         return ret_conv;
35250 }
35251
35252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35253         LDKTransactionU16LenLimited orig_conv;
35254         orig_conv.inner = untag_ptr(orig);
35255         orig_conv.is_owned = ptr_is_owned(orig);
35256         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35257         orig_conv.is_owned = false;
35258         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(&orig_conv);
35259         int64_t ret_ref = 0;
35260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35262         return ret_ref;
35263 }
35264
35265 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35266         LDKTransactionU16LenLimited a_conv;
35267         a_conv.inner = untag_ptr(a);
35268         a_conv.is_owned = ptr_is_owned(a);
35269         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35270         a_conv.is_owned = false;
35271         LDKTransactionU16LenLimited b_conv;
35272         b_conv.inner = untag_ptr(b);
35273         b_conv.is_owned = ptr_is_owned(b);
35274         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35275         b_conv.is_owned = false;
35276         jboolean ret_conv = TransactionU16LenLimited_eq(&a_conv, &b_conv);
35277         return ret_conv;
35278 }
35279
35280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1new(JNIEnv *env, jclass clz, int8_tArray transaction) {
35281         LDKTransaction transaction_ref;
35282         transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
35283         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
35284         (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
35285         transaction_ref.data_is_owned = true;
35286         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
35287         *ret_conv = TransactionU16LenLimited_new(transaction_ref);
35288         return tag_ptr(ret_conv, true);
35289 }
35290
35291 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1into_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
35292         LDKTransactionU16LenLimited this_arg_conv;
35293         this_arg_conv.inner = untag_ptr(this_arg);
35294         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35296         this_arg_conv = TransactionU16LenLimited_clone(&this_arg_conv);
35297         LDKTransaction ret_var = TransactionU16LenLimited_into_transaction(this_arg_conv);
35298         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35299         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35300         Transaction_free(ret_var);
35301         return ret_arr;
35302 }
35303
35304 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1write(JNIEnv *env, jclass clz, int64_t obj) {
35305         LDKTransactionU16LenLimited obj_conv;
35306         obj_conv.inner = untag_ptr(obj);
35307         obj_conv.is_owned = ptr_is_owned(obj);
35308         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35309         obj_conv.is_owned = false;
35310         LDKCVec_u8Z ret_var = TransactionU16LenLimited_write(&obj_conv);
35311         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35312         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35313         CVec_u8Z_free(ret_var);
35314         return ret_arr;
35315 }
35316
35317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35318         LDKu8slice ser_ref;
35319         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35320         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35321         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
35322         *ret_conv = TransactionU16LenLimited_read(ser_ref);
35323         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35324         return tag_ptr(ret_conv, true);
35325 }
35326
35327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
35328         LDKu8slice msg_ref;
35329         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
35330         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
35331         uint8_t sk_arr[32];
35332         CHECK((*env)->GetArrayLength(env, sk) == 32);
35333         (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
35334         uint8_t (*sk_ref)[32] = &sk_arr;
35335         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
35336         *ret_conv = sign(msg_ref, sk_ref);
35337         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
35338         return tag_ptr(ret_conv, true);
35339 }
35340
35341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
35342         LDKu8slice msg_ref;
35343         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
35344         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
35345         LDKStr sig_conv = java_to_owned_str(env, sig);
35346         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
35347         *ret_conv = recover_pk(msg_ref, sig_conv);
35348         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
35349         return tag_ptr(ret_conv, true);
35350 }
35351
35352 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
35353         LDKu8slice msg_ref;
35354         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
35355         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
35356         LDKStr sig_conv = java_to_owned_str(env, sig);
35357         LDKPublicKey pk_ref;
35358         CHECK((*env)->GetArrayLength(env, pk) == 33);
35359         (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
35360         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
35361         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
35362         return ret_conv;
35363 }
35364
35365 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_construct_1invoice_1preimage(JNIEnv *env, jclass clz, int8_tArray hrp_bytes, jobjectArray data_without_signature) {
35366         LDKu8slice hrp_bytes_ref;
35367         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
35368         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
35369         LDKCVec_U5Z data_without_signature_constr;
35370         data_without_signature_constr.datalen = (*env)->GetArrayLength(env, data_without_signature);
35371         if (data_without_signature_constr.datalen > 0)
35372                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
35373         else
35374                 data_without_signature_constr.data = NULL;
35375         int8_t* data_without_signature_vals = (*env)->GetByteArrayElements (env, data_without_signature, NULL);
35376         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
35377                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
35378                 
35379                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
35380         }
35381         (*env)->ReleaseByteArrayElements(env, data_without_signature, data_without_signature_vals, 0);
35382         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
35383         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35384         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35385         CVec_u8Z_free(ret_var);
35386         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
35387         return ret_arr;
35388 }
35389
35390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KVStore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35391         if (!ptr_is_owned(this_ptr)) return;
35392         void* this_ptr_ptr = untag_ptr(this_ptr);
35393         CHECK_ACCESS(this_ptr_ptr);
35394         LDKKVStore this_ptr_conv = *(LDKKVStore*)(this_ptr_ptr);
35395         FREE(untag_ptr(this_ptr));
35396         KVStore_free(this_ptr_conv);
35397 }
35398
35399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35400         if (!ptr_is_owned(this_ptr)) return;
35401         void* this_ptr_ptr = untag_ptr(this_ptr);
35402         CHECK_ACCESS(this_ptr_ptr);
35403         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
35404         FREE(untag_ptr(this_ptr));
35405         Persister_free(this_ptr_conv);
35406 }
35407
35408 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) {
35409         void* kv_store_ptr = untag_ptr(kv_store);
35410         CHECK_ACCESS(kv_store_ptr);
35411         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
35412         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
35413                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35414                 LDKKVStore_JCalls_cloned(&kv_store_conv);
35415         }
35416         void* entropy_source_ptr = untag_ptr(entropy_source);
35417         CHECK_ACCESS(entropy_source_ptr);
35418         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
35419         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
35420                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35421                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
35422         }
35423         void* signer_provider_ptr = untag_ptr(signer_provider);
35424         CHECK_ACCESS(signer_provider_ptr);
35425         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
35426         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
35427                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35428                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
35429         }
35430         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
35431         *ret_conv = read_channel_monitors(kv_store_conv, entropy_source_conv, signer_provider_conv);
35432         return tag_ptr(ret_conv, true);
35433 }
35434
35435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35436         LDKMonitorUpdatingPersister this_obj_conv;
35437         this_obj_conv.inner = untag_ptr(this_obj);
35438         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35440         MonitorUpdatingPersister_free(this_obj_conv);
35441 }
35442
35443 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) {
35444         void* kv_store_ptr = untag_ptr(kv_store);
35445         CHECK_ACCESS(kv_store_ptr);
35446         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
35447         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
35448                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35449                 LDKKVStore_JCalls_cloned(&kv_store_conv);
35450         }
35451         void* logger_ptr = untag_ptr(logger);
35452         CHECK_ACCESS(logger_ptr);
35453         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
35454         if (logger_conv.free == LDKLogger_JCalls_free) {
35455                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35456                 LDKLogger_JCalls_cloned(&logger_conv);
35457         }
35458         void* entropy_source_ptr = untag_ptr(entropy_source);
35459         CHECK_ACCESS(entropy_source_ptr);
35460         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
35461         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
35462                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35463                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
35464         }
35465         void* signer_provider_ptr = untag_ptr(signer_provider);
35466         CHECK_ACCESS(signer_provider_ptr);
35467         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
35468         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
35469                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35470                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
35471         }
35472         LDKMonitorUpdatingPersister ret_var = MonitorUpdatingPersister_new(kv_store_conv, logger_conv, maximum_pending_updates, entropy_source_conv, signer_provider_conv);
35473         int64_t ret_ref = 0;
35474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35476         return ret_ref;
35477 }
35478
35479 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) {
35480         LDKMonitorUpdatingPersister this_arg_conv;
35481         this_arg_conv.inner = untag_ptr(this_arg);
35482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35484         this_arg_conv.is_owned = false;
35485         void* broadcaster_ptr = untag_ptr(broadcaster);
35486         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
35487         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
35488         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35489         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
35490         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
35491         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
35492         *ret_conv = MonitorUpdatingPersister_read_all_channel_monitors_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv);
35493         return tag_ptr(ret_conv, true);
35494 }
35495
35496 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) {
35497         LDKMonitorUpdatingPersister this_arg_conv;
35498         this_arg_conv.inner = untag_ptr(this_arg);
35499         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35501         this_arg_conv.is_owned = false;
35502         void* broadcaster_ptr = untag_ptr(broadcaster);
35503         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
35504         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
35505         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35506         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
35507         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
35508         LDKStr monitor_key_conv = java_to_owned_str(env, monitor_key);
35509         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
35510         *ret_conv = MonitorUpdatingPersister_read_channel_monitor_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv, monitor_key_conv);
35511         return tag_ptr(ret_conv, true);
35512 }
35513
35514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1cleanup_1stale_1updates(JNIEnv *env, jclass clz, int64_t this_arg, jboolean lazy) {
35515         LDKMonitorUpdatingPersister this_arg_conv;
35516         this_arg_conv.inner = untag_ptr(this_arg);
35517         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35519         this_arg_conv.is_owned = false;
35520         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
35521         *ret_conv = MonitorUpdatingPersister_cleanup_stale_updates(&this_arg_conv, lazy);
35522         return tag_ptr(ret_conv, true);
35523 }
35524
35525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1as_1Persist(JNIEnv *env, jclass clz, int64_t this_arg) {
35526         LDKMonitorUpdatingPersister this_arg_conv;
35527         this_arg_conv.inner = untag_ptr(this_arg);
35528         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35530         this_arg_conv.is_owned = false;
35531         LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
35532         *ret_ret = MonitorUpdatingPersister_as_Persist(&this_arg_conv);
35533         return tag_ptr(ret_ret, true);
35534 }
35535
35536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UntrustedString_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35537         LDKUntrustedString this_obj_conv;
35538         this_obj_conv.inner = untag_ptr(this_obj);
35539         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35541         UntrustedString_free(this_obj_conv);
35542 }
35543
35544 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_UntrustedString_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
35545         LDKUntrustedString this_ptr_conv;
35546         this_ptr_conv.inner = untag_ptr(this_ptr);
35547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35549         this_ptr_conv.is_owned = false;
35550         LDKStr ret_str = UntrustedString_get_a(&this_ptr_conv);
35551         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
35552         Str_free(ret_str);
35553         return ret_conv;
35554 }
35555
35556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UntrustedString_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
35557         LDKUntrustedString 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         LDKStr val_conv = java_to_owned_str(env, val);
35563         UntrustedString_set_a(&this_ptr_conv, val_conv);
35564 }
35565
35566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1new(JNIEnv *env, jclass clz, jstring a_arg) {
35567         LDKStr a_arg_conv = java_to_owned_str(env, a_arg);
35568         LDKUntrustedString ret_var = UntrustedString_new(a_arg_conv);
35569         int64_t ret_ref = 0;
35570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35572         return ret_ref;
35573 }
35574
35575 static inline uint64_t UntrustedString_clone_ptr(LDKUntrustedString *NONNULL_PTR arg) {
35576         LDKUntrustedString ret_var = UntrustedString_clone(arg);
35577         int64_t ret_ref = 0;
35578         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35579         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35580         return ret_ref;
35581 }
35582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35583         LDKUntrustedString arg_conv;
35584         arg_conv.inner = untag_ptr(arg);
35585         arg_conv.is_owned = ptr_is_owned(arg);
35586         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35587         arg_conv.is_owned = false;
35588         int64_t ret_conv = UntrustedString_clone_ptr(&arg_conv);
35589         return ret_conv;
35590 }
35591
35592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35593         LDKUntrustedString orig_conv;
35594         orig_conv.inner = untag_ptr(orig);
35595         orig_conv.is_owned = ptr_is_owned(orig);
35596         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35597         orig_conv.is_owned = false;
35598         LDKUntrustedString ret_var = UntrustedString_clone(&orig_conv);
35599         int64_t ret_ref = 0;
35600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35602         return ret_ref;
35603 }
35604
35605 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UntrustedString_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35606         LDKUntrustedString a_conv;
35607         a_conv.inner = untag_ptr(a);
35608         a_conv.is_owned = ptr_is_owned(a);
35609         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35610         a_conv.is_owned = false;
35611         LDKUntrustedString b_conv;
35612         b_conv.inner = untag_ptr(b);
35613         b_conv.is_owned = ptr_is_owned(b);
35614         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35615         b_conv.is_owned = false;
35616         jboolean ret_conv = UntrustedString_eq(&a_conv, &b_conv);
35617         return ret_conv;
35618 }
35619
35620 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UntrustedString_1write(JNIEnv *env, jclass clz, int64_t obj) {
35621         LDKUntrustedString obj_conv;
35622         obj_conv.inner = untag_ptr(obj);
35623         obj_conv.is_owned = ptr_is_owned(obj);
35624         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35625         obj_conv.is_owned = false;
35626         LDKCVec_u8Z ret_var = UntrustedString_write(&obj_conv);
35627         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35628         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35629         CVec_u8Z_free(ret_var);
35630         return ret_arr;
35631 }
35632
35633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35634         LDKu8slice ser_ref;
35635         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35636         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35637         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
35638         *ret_conv = UntrustedString_read(ser_ref);
35639         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35640         return tag_ptr(ret_conv, true);
35641 }
35642
35643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrintableString_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35644         LDKPrintableString this_obj_conv;
35645         this_obj_conv.inner = untag_ptr(this_obj);
35646         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35648         PrintableString_free(this_obj_conv);
35649 }
35650
35651 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_PrintableString_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
35652         LDKPrintableString 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         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
35658         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
35659         Str_free(ret_str);
35660         return ret_conv;
35661 }
35662
35663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrintableString_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
35664         LDKPrintableString this_ptr_conv;
35665         this_ptr_conv.inner = untag_ptr(this_ptr);
35666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35668         this_ptr_conv.is_owned = false;
35669         LDKStr val_conv = java_to_owned_str(env, val);
35670         PrintableString_set_a(&this_ptr_conv, val_conv);
35671 }
35672
35673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrintableString_1new(JNIEnv *env, jclass clz, jstring a_arg) {
35674         LDKStr a_arg_conv = java_to_owned_str(env, a_arg);
35675         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
35676         int64_t ret_ref = 0;
35677         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35678         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35679         return ret_ref;
35680 }
35681
35682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FutureCallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35683         if (!ptr_is_owned(this_ptr)) return;
35684         void* this_ptr_ptr = untag_ptr(this_ptr);
35685         CHECK_ACCESS(this_ptr_ptr);
35686         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
35687         FREE(untag_ptr(this_ptr));
35688         FutureCallback_free(this_ptr_conv);
35689 }
35690
35691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35692         LDKFuture this_obj_conv;
35693         this_obj_conv.inner = untag_ptr(this_obj);
35694         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35696         Future_free(this_obj_conv);
35697 }
35698
35699 static inline uint64_t Future_clone_ptr(LDKFuture *NONNULL_PTR arg) {
35700         LDKFuture ret_var = Future_clone(arg);
35701         int64_t ret_ref = 0;
35702         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35703         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35704         return ret_ref;
35705 }
35706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Future_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35707         LDKFuture arg_conv;
35708         arg_conv.inner = untag_ptr(arg);
35709         arg_conv.is_owned = ptr_is_owned(arg);
35710         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35711         arg_conv.is_owned = false;
35712         int64_t ret_conv = Future_clone_ptr(&arg_conv);
35713         return ret_conv;
35714 }
35715
35716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Future_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35717         LDKFuture orig_conv;
35718         orig_conv.inner = untag_ptr(orig);
35719         orig_conv.is_owned = ptr_is_owned(orig);
35720         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35721         orig_conv.is_owned = false;
35722         LDKFuture ret_var = Future_clone(&orig_conv);
35723         int64_t ret_ref = 0;
35724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35726         return ret_ref;
35727 }
35728
35729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1register_1callback_1fn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t callback) {
35730         LDKFuture this_arg_conv;
35731         this_arg_conv.inner = untag_ptr(this_arg);
35732         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35734         this_arg_conv.is_owned = false;
35735         void* callback_ptr = untag_ptr(callback);
35736         CHECK_ACCESS(callback_ptr);
35737         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
35738         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
35739                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35740                 LDKFutureCallback_JCalls_cloned(&callback_conv);
35741         }
35742         Future_register_callback_fn(&this_arg_conv, callback_conv);
35743 }
35744
35745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1wait(JNIEnv *env, jclass clz, int64_t this_arg) {
35746         LDKFuture this_arg_conv;
35747         this_arg_conv.inner = untag_ptr(this_arg);
35748         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35750         this_arg_conv = Future_clone(&this_arg_conv);
35751         Future_wait(this_arg_conv);
35752 }
35753
35754 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Future_1wait_1timeout(JNIEnv *env, jclass clz, int64_t this_arg, int64_t max_wait) {
35755         LDKFuture this_arg_conv;
35756         this_arg_conv.inner = untag_ptr(this_arg);
35757         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35759         this_arg_conv = Future_clone(&this_arg_conv);
35760         jboolean ret_conv = Future_wait_timeout(this_arg_conv, max_wait);
35761         return ret_conv;
35762 }
35763
35764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sleeper_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35765         LDKSleeper this_obj_conv;
35766         this_obj_conv.inner = untag_ptr(this_obj);
35767         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35769         Sleeper_free(this_obj_conv);
35770 }
35771
35772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sleeper_1from_1single_1future(JNIEnv *env, jclass clz, int64_t future) {
35773         LDKFuture future_conv;
35774         future_conv.inner = untag_ptr(future);
35775         future_conv.is_owned = ptr_is_owned(future);
35776         CHECK_INNER_FIELD_ACCESS_OR_NULL(future_conv);
35777         future_conv = Future_clone(&future_conv);
35778         LDKSleeper ret_var = Sleeper_from_single_future(future_conv);
35779         int64_t ret_ref = 0;
35780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35782         return ret_ref;
35783 }
35784
35785 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) {
35786         LDKFuture fut_a_conv;
35787         fut_a_conv.inner = untag_ptr(fut_a);
35788         fut_a_conv.is_owned = ptr_is_owned(fut_a);
35789         CHECK_INNER_FIELD_ACCESS_OR_NULL(fut_a_conv);
35790         fut_a_conv = Future_clone(&fut_a_conv);
35791         LDKFuture fut_b_conv;
35792         fut_b_conv.inner = untag_ptr(fut_b);
35793         fut_b_conv.is_owned = ptr_is_owned(fut_b);
35794         CHECK_INNER_FIELD_ACCESS_OR_NULL(fut_b_conv);
35795         fut_b_conv = Future_clone(&fut_b_conv);
35796         LDKSleeper ret_var = Sleeper_from_two_futures(fut_a_conv, fut_b_conv);
35797         int64_t ret_ref = 0;
35798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35800         return ret_ref;
35801 }
35802
35803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sleeper_1new(JNIEnv *env, jclass clz, int64_tArray futures) {
35804         LDKCVec_FutureZ futures_constr;
35805         futures_constr.datalen = (*env)->GetArrayLength(env, futures);
35806         if (futures_constr.datalen > 0)
35807                 futures_constr.data = MALLOC(futures_constr.datalen * sizeof(LDKFuture), "LDKCVec_FutureZ Elements");
35808         else
35809                 futures_constr.data = NULL;
35810         int64_t* futures_vals = (*env)->GetLongArrayElements (env, futures, NULL);
35811         for (size_t i = 0; i < futures_constr.datalen; i++) {
35812                 int64_t futures_conv_8 = futures_vals[i];
35813                 LDKFuture futures_conv_8_conv;
35814                 futures_conv_8_conv.inner = untag_ptr(futures_conv_8);
35815                 futures_conv_8_conv.is_owned = ptr_is_owned(futures_conv_8);
35816                 CHECK_INNER_FIELD_ACCESS_OR_NULL(futures_conv_8_conv);
35817                 futures_conv_8_conv = Future_clone(&futures_conv_8_conv);
35818                 futures_constr.data[i] = futures_conv_8_conv;
35819         }
35820         (*env)->ReleaseLongArrayElements(env, futures, futures_vals, 0);
35821         LDKSleeper ret_var = Sleeper_new(futures_constr);
35822         int64_t ret_ref = 0;
35823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35825         return ret_ref;
35826 }
35827
35828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sleeper_1wait(JNIEnv *env, jclass clz, int64_t this_arg) {
35829         LDKSleeper this_arg_conv;
35830         this_arg_conv.inner = untag_ptr(this_arg);
35831         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35833         this_arg_conv.is_owned = false;
35834         Sleeper_wait(&this_arg_conv);
35835 }
35836
35837 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sleeper_1wait_1timeout(JNIEnv *env, jclass clz, int64_t this_arg, int64_t max_wait) {
35838         LDKSleeper this_arg_conv;
35839         this_arg_conv.inner = untag_ptr(this_arg);
35840         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35842         this_arg_conv.is_owned = false;
35843         jboolean ret_conv = Sleeper_wait_timeout(&this_arg_conv, max_wait);
35844         return ret_conv;
35845 }
35846
35847 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35848         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
35849         jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
35850         return ret_conv;
35851 }
35852
35853 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1gossip(JNIEnv *env, jclass clz) {
35854         jclass ret_conv = LDKLevel_to_java(env, Level_gossip());
35855         return ret_conv;
35856 }
35857
35858 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
35859         jclass ret_conv = LDKLevel_to_java(env, Level_trace());
35860         return ret_conv;
35861 }
35862
35863 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
35864         jclass ret_conv = LDKLevel_to_java(env, Level_debug());
35865         return ret_conv;
35866 }
35867
35868 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
35869         jclass ret_conv = LDKLevel_to_java(env, Level_info());
35870         return ret_conv;
35871 }
35872
35873 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
35874         jclass ret_conv = LDKLevel_to_java(env, Level_warn());
35875         return ret_conv;
35876 }
35877
35878 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
35879         jclass ret_conv = LDKLevel_to_java(env, Level_error());
35880         return ret_conv;
35881 }
35882
35883 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35884         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
35885         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
35886         jboolean ret_conv = Level_eq(a_conv, b_conv);
35887         return ret_conv;
35888 }
35889
35890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
35891         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
35892         int64_t ret_conv = Level_hash(o_conv);
35893         return ret_conv;
35894 }
35895
35896 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
35897         jclass ret_conv = LDKLevel_to_java(env, Level_max());
35898         return ret_conv;
35899 }
35900
35901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35902         LDKRecord this_obj_conv;
35903         this_obj_conv.inner = untag_ptr(this_obj);
35904         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35906         Record_free(this_obj_conv);
35907 }
35908
35909 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Record_1get_1level(JNIEnv *env, jclass clz, int64_t this_ptr) {
35910         LDKRecord this_ptr_conv;
35911         this_ptr_conv.inner = untag_ptr(this_ptr);
35912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35914         this_ptr_conv.is_owned = false;
35915         jclass ret_conv = LDKLevel_to_java(env, Record_get_level(&this_ptr_conv));
35916         return ret_conv;
35917 }
35918
35919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1level(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
35920         LDKRecord this_ptr_conv;
35921         this_ptr_conv.inner = untag_ptr(this_ptr);
35922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35924         this_ptr_conv.is_owned = false;
35925         LDKLevel val_conv = LDKLevel_from_java(env, val);
35926         Record_set_level(&this_ptr_conv, val_conv);
35927 }
35928
35929 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1args(JNIEnv *env, jclass clz, int64_t this_ptr) {
35930         LDKRecord this_ptr_conv;
35931         this_ptr_conv.inner = untag_ptr(this_ptr);
35932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35934         this_ptr_conv.is_owned = false;
35935         LDKStr ret_str = Record_get_args(&this_ptr_conv);
35936         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
35937         Str_free(ret_str);
35938         return ret_conv;
35939 }
35940
35941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1args(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
35942         LDKRecord this_ptr_conv;
35943         this_ptr_conv.inner = untag_ptr(this_ptr);
35944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35946         this_ptr_conv.is_owned = false;
35947         LDKStr val_conv = java_to_owned_str(env, val);
35948         Record_set_args(&this_ptr_conv, val_conv);
35949 }
35950
35951 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr) {
35952         LDKRecord this_ptr_conv;
35953         this_ptr_conv.inner = untag_ptr(this_ptr);
35954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35956         this_ptr_conv.is_owned = false;
35957         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
35958         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
35959         Str_free(ret_str);
35960         return ret_conv;
35961 }
35962
35963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
35964         LDKRecord this_ptr_conv;
35965         this_ptr_conv.inner = untag_ptr(this_ptr);
35966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35968         this_ptr_conv.is_owned = false;
35969         LDKStr val_conv = java_to_owned_str(env, val);
35970         Record_set_module_path(&this_ptr_conv, val_conv);
35971 }
35972
35973 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1file(JNIEnv *env, jclass clz, int64_t this_ptr) {
35974         LDKRecord this_ptr_conv;
35975         this_ptr_conv.inner = untag_ptr(this_ptr);
35976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35978         this_ptr_conv.is_owned = false;
35979         LDKStr ret_str = Record_get_file(&this_ptr_conv);
35980         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
35981         Str_free(ret_str);
35982         return ret_conv;
35983 }
35984
35985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1file(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
35986         LDKRecord this_ptr_conv;
35987         this_ptr_conv.inner = untag_ptr(this_ptr);
35988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35990         this_ptr_conv.is_owned = false;
35991         LDKStr val_conv = java_to_owned_str(env, val);
35992         Record_set_file(&this_ptr_conv, val_conv);
35993 }
35994
35995 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1line(JNIEnv *env, jclass clz, int64_t this_ptr) {
35996         LDKRecord this_ptr_conv;
35997         this_ptr_conv.inner = untag_ptr(this_ptr);
35998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36000         this_ptr_conv.is_owned = false;
36001         int32_t ret_conv = Record_get_line(&this_ptr_conv);
36002         return ret_conv;
36003 }
36004
36005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1line(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36006         LDKRecord this_ptr_conv;
36007         this_ptr_conv.inner = untag_ptr(this_ptr);
36008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36010         this_ptr_conv.is_owned = false;
36011         Record_set_line(&this_ptr_conv, val);
36012 }
36013
36014 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
36015         LDKRecord ret_var = Record_clone(arg);
36016         int64_t ret_ref = 0;
36017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36019         return ret_ref;
36020 }
36021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36022         LDKRecord arg_conv;
36023         arg_conv.inner = untag_ptr(arg);
36024         arg_conv.is_owned = ptr_is_owned(arg);
36025         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36026         arg_conv.is_owned = false;
36027         int64_t ret_conv = Record_clone_ptr(&arg_conv);
36028         return ret_conv;
36029 }
36030
36031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36032         LDKRecord orig_conv;
36033         orig_conv.inner = untag_ptr(orig);
36034         orig_conv.is_owned = ptr_is_owned(orig);
36035         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36036         orig_conv.is_owned = false;
36037         LDKRecord ret_var = Record_clone(&orig_conv);
36038         int64_t ret_ref = 0;
36039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36041         return ret_ref;
36042 }
36043
36044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36045         if (!ptr_is_owned(this_ptr)) return;
36046         void* this_ptr_ptr = untag_ptr(this_ptr);
36047         CHECK_ACCESS(this_ptr_ptr);
36048         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
36049         FREE(untag_ptr(this_ptr));
36050         Logger_free(this_ptr_conv);
36051 }
36052
36053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36054         LDKChannelHandshakeConfig this_obj_conv;
36055         this_obj_conv.inner = untag_ptr(this_obj);
36056         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36058         ChannelHandshakeConfig_free(this_obj_conv);
36059 }
36060
36061 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
36062         LDKChannelHandshakeConfig this_ptr_conv;
36063         this_ptr_conv.inner = untag_ptr(this_ptr);
36064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36066         this_ptr_conv.is_owned = false;
36067         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
36068         return ret_conv;
36069 }
36070
36071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36072         LDKChannelHandshakeConfig this_ptr_conv;
36073         this_ptr_conv.inner = untag_ptr(this_ptr);
36074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36076         this_ptr_conv.is_owned = false;
36077         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
36078 }
36079
36080 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
36081         LDKChannelHandshakeConfig this_ptr_conv;
36082         this_ptr_conv.inner = untag_ptr(this_ptr);
36083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36085         this_ptr_conv.is_owned = false;
36086         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
36087         return ret_conv;
36088 }
36089
36090 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) {
36091         LDKChannelHandshakeConfig this_ptr_conv;
36092         this_ptr_conv.inner = untag_ptr(this_ptr);
36093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36095         this_ptr_conv.is_owned = false;
36096         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
36097 }
36098
36099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
36100         LDKChannelHandshakeConfig this_ptr_conv;
36101         this_ptr_conv.inner = untag_ptr(this_ptr);
36102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36104         this_ptr_conv.is_owned = false;
36105         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
36106         return ret_conv;
36107 }
36108
36109 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) {
36110         LDKChannelHandshakeConfig this_ptr_conv;
36111         this_ptr_conv.inner = untag_ptr(this_ptr);
36112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36114         this_ptr_conv.is_owned = false;
36115         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
36116 }
36117
36118 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) {
36119         LDKChannelHandshakeConfig this_ptr_conv;
36120         this_ptr_conv.inner = untag_ptr(this_ptr);
36121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36123         this_ptr_conv.is_owned = false;
36124         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
36125         return ret_conv;
36126 }
36127
36128 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) {
36129         LDKChannelHandshakeConfig this_ptr_conv;
36130         this_ptr_conv.inner = untag_ptr(this_ptr);
36131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36133         this_ptr_conv.is_owned = false;
36134         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
36135 }
36136
36137 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr) {
36138         LDKChannelHandshakeConfig this_ptr_conv;
36139         this_ptr_conv.inner = untag_ptr(this_ptr);
36140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36142         this_ptr_conv.is_owned = false;
36143         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
36144         return ret_conv;
36145 }
36146
36147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36148         LDKChannelHandshakeConfig 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         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
36154 }
36155
36156 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
36157         LDKChannelHandshakeConfig this_ptr_conv;
36158         this_ptr_conv.inner = untag_ptr(this_ptr);
36159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36161         this_ptr_conv.is_owned = false;
36162         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
36163         return ret_conv;
36164 }
36165
36166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36167         LDKChannelHandshakeConfig 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         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
36173 }
36174
36175 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
36176         LDKChannelHandshakeConfig this_ptr_conv;
36177         this_ptr_conv.inner = untag_ptr(this_ptr);
36178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36180         this_ptr_conv.is_owned = false;
36181         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
36182         return ret_conv;
36183 }
36184
36185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36186         LDKChannelHandshakeConfig this_ptr_conv;
36187         this_ptr_conv.inner = untag_ptr(this_ptr);
36188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36190         this_ptr_conv.is_owned = false;
36191         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
36192 }
36193
36194 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1their_1channel_1reserve_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
36195         LDKChannelHandshakeConfig this_ptr_conv;
36196         this_ptr_conv.inner = untag_ptr(this_ptr);
36197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36199         this_ptr_conv.is_owned = false;
36200         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
36201         return ret_conv;
36202 }
36203
36204 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) {
36205         LDKChannelHandshakeConfig this_ptr_conv;
36206         this_ptr_conv.inner = untag_ptr(this_ptr);
36207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36209         this_ptr_conv.is_owned = false;
36210         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
36211 }
36212
36213 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_ptr) {
36214         LDKChannelHandshakeConfig this_ptr_conv;
36215         this_ptr_conv.inner = untag_ptr(this_ptr);
36216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36218         this_ptr_conv.is_owned = false;
36219         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv);
36220         return ret_conv;
36221 }
36222
36223 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) {
36224         LDKChannelHandshakeConfig this_ptr_conv;
36225         this_ptr_conv.inner = untag_ptr(this_ptr);
36226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36228         this_ptr_conv.is_owned = false;
36229         ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv, val);
36230 }
36231
36232 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
36233         LDKChannelHandshakeConfig this_ptr_conv;
36234         this_ptr_conv.inner = untag_ptr(this_ptr);
36235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36237         this_ptr_conv.is_owned = false;
36238         int16_t ret_conv = ChannelHandshakeConfig_get_our_max_accepted_htlcs(&this_ptr_conv);
36239         return ret_conv;
36240 }
36241
36242 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) {
36243         LDKChannelHandshakeConfig this_ptr_conv;
36244         this_ptr_conv.inner = untag_ptr(this_ptr);
36245         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36247         this_ptr_conv.is_owned = false;
36248         ChannelHandshakeConfig_set_our_max_accepted_htlcs(&this_ptr_conv, val);
36249 }
36250
36251 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) {
36252         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);
36253         int64_t ret_ref = 0;
36254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36256         return ret_ref;
36257 }
36258
36259 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
36260         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
36261         int64_t ret_ref = 0;
36262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36264         return ret_ref;
36265 }
36266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36267         LDKChannelHandshakeConfig arg_conv;
36268         arg_conv.inner = untag_ptr(arg);
36269         arg_conv.is_owned = ptr_is_owned(arg);
36270         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36271         arg_conv.is_owned = false;
36272         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
36273         return ret_conv;
36274 }
36275
36276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36277         LDKChannelHandshakeConfig orig_conv;
36278         orig_conv.inner = untag_ptr(orig);
36279         orig_conv.is_owned = ptr_is_owned(orig);
36280         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36281         orig_conv.is_owned = false;
36282         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
36283         int64_t ret_ref = 0;
36284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36286         return ret_ref;
36287 }
36288
36289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
36290         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
36291         int64_t ret_ref = 0;
36292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36294         return ret_ref;
36295 }
36296
36297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36298         LDKChannelHandshakeLimits this_obj_conv;
36299         this_obj_conv.inner = untag_ptr(this_obj);
36300         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36302         ChannelHandshakeLimits_free(this_obj_conv);
36303 }
36304
36305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
36306         LDKChannelHandshakeLimits this_ptr_conv;
36307         this_ptr_conv.inner = untag_ptr(this_ptr);
36308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36310         this_ptr_conv.is_owned = false;
36311         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
36312         return ret_conv;
36313 }
36314
36315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36316         LDKChannelHandshakeLimits this_ptr_conv;
36317         this_ptr_conv.inner = untag_ptr(this_ptr);
36318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36320         this_ptr_conv.is_owned = false;
36321         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
36322 }
36323
36324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
36325         LDKChannelHandshakeLimits this_ptr_conv;
36326         this_ptr_conv.inner = untag_ptr(this_ptr);
36327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36329         this_ptr_conv.is_owned = false;
36330         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
36331         return ret_conv;
36332 }
36333
36334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36335         LDKChannelHandshakeLimits this_ptr_conv;
36336         this_ptr_conv.inner = untag_ptr(this_ptr);
36337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36339         this_ptr_conv.is_owned = false;
36340         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
36341 }
36342
36343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
36344         LDKChannelHandshakeLimits this_ptr_conv;
36345         this_ptr_conv.inner = untag_ptr(this_ptr);
36346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36348         this_ptr_conv.is_owned = false;
36349         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
36350         return ret_conv;
36351 }
36352
36353 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) {
36354         LDKChannelHandshakeLimits this_ptr_conv;
36355         this_ptr_conv.inner = untag_ptr(this_ptr);
36356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36358         this_ptr_conv.is_owned = false;
36359         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
36360 }
36361
36362 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) {
36363         LDKChannelHandshakeLimits this_ptr_conv;
36364         this_ptr_conv.inner = untag_ptr(this_ptr);
36365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36367         this_ptr_conv.is_owned = false;
36368         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
36369         return ret_conv;
36370 }
36371
36372 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) {
36373         LDKChannelHandshakeLimits this_ptr_conv;
36374         this_ptr_conv.inner = untag_ptr(this_ptr);
36375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36377         this_ptr_conv.is_owned = false;
36378         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
36379 }
36380
36381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
36382         LDKChannelHandshakeLimits this_ptr_conv;
36383         this_ptr_conv.inner = untag_ptr(this_ptr);
36384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36386         this_ptr_conv.is_owned = false;
36387         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
36388         return ret_conv;
36389 }
36390
36391 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) {
36392         LDKChannelHandshakeLimits this_ptr_conv;
36393         this_ptr_conv.inner = untag_ptr(this_ptr);
36394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36396         this_ptr_conv.is_owned = false;
36397         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
36398 }
36399
36400 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
36401         LDKChannelHandshakeLimits this_ptr_conv;
36402         this_ptr_conv.inner = untag_ptr(this_ptr);
36403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36405         this_ptr_conv.is_owned = false;
36406         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
36407         return ret_conv;
36408 }
36409
36410 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) {
36411         LDKChannelHandshakeLimits this_ptr_conv;
36412         this_ptr_conv.inner = untag_ptr(this_ptr);
36413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36415         this_ptr_conv.is_owned = false;
36416         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
36417 }
36418
36419 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
36420         LDKChannelHandshakeLimits this_ptr_conv;
36421         this_ptr_conv.inner = untag_ptr(this_ptr);
36422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36424         this_ptr_conv.is_owned = false;
36425         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
36426         return ret_conv;
36427 }
36428
36429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36430         LDKChannelHandshakeLimits this_ptr_conv;
36431         this_ptr_conv.inner = untag_ptr(this_ptr);
36432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36434         this_ptr_conv.is_owned = false;
36435         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
36436 }
36437
36438 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr) {
36439         LDKChannelHandshakeLimits this_ptr_conv;
36440         this_ptr_conv.inner = untag_ptr(this_ptr);
36441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36443         this_ptr_conv.is_owned = false;
36444         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
36445         return ret_conv;
36446 }
36447
36448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36449         LDKChannelHandshakeLimits this_ptr_conv;
36450         this_ptr_conv.inner = untag_ptr(this_ptr);
36451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36453         this_ptr_conv.is_owned = false;
36454         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
36455 }
36456
36457 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
36458         LDKChannelHandshakeLimits this_ptr_conv;
36459         this_ptr_conv.inner = untag_ptr(this_ptr);
36460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36462         this_ptr_conv.is_owned = false;
36463         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
36464         return ret_conv;
36465 }
36466
36467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36468         LDKChannelHandshakeLimits this_ptr_conv;
36469         this_ptr_conv.inner = untag_ptr(this_ptr);
36470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36472         this_ptr_conv.is_owned = false;
36473         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
36474 }
36475
36476 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
36477         LDKChannelHandshakeLimits this_ptr_conv;
36478         this_ptr_conv.inner = untag_ptr(this_ptr);
36479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36481         this_ptr_conv.is_owned = false;
36482         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
36483         return ret_conv;
36484 }
36485
36486 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) {
36487         LDKChannelHandshakeLimits this_ptr_conv;
36488         this_ptr_conv.inner = untag_ptr(this_ptr);
36489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36491         this_ptr_conv.is_owned = false;
36492         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
36493 }
36494
36495 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) {
36496         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);
36497         int64_t ret_ref = 0;
36498         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36499         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36500         return ret_ref;
36501 }
36502
36503 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
36504         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
36505         int64_t ret_ref = 0;
36506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36508         return ret_ref;
36509 }
36510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36511         LDKChannelHandshakeLimits arg_conv;
36512         arg_conv.inner = untag_ptr(arg);
36513         arg_conv.is_owned = ptr_is_owned(arg);
36514         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36515         arg_conv.is_owned = false;
36516         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
36517         return ret_conv;
36518 }
36519
36520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36521         LDKChannelHandshakeLimits orig_conv;
36522         orig_conv.inner = untag_ptr(orig);
36523         orig_conv.is_owned = ptr_is_owned(orig);
36524         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36525         orig_conv.is_owned = false;
36526         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
36527         int64_t ret_ref = 0;
36528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36530         return ret_ref;
36531 }
36532
36533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
36534         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
36535         int64_t ret_ref = 0;
36536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36538         return ret_ref;
36539 }
36540
36541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36542         if (!ptr_is_owned(this_ptr)) return;
36543         void* this_ptr_ptr = untag_ptr(this_ptr);
36544         CHECK_ACCESS(this_ptr_ptr);
36545         LDKMaxDustHTLCExposure this_ptr_conv = *(LDKMaxDustHTLCExposure*)(this_ptr_ptr);
36546         FREE(untag_ptr(this_ptr));
36547         MaxDustHTLCExposure_free(this_ptr_conv);
36548 }
36549
36550 static inline uint64_t MaxDustHTLCExposure_clone_ptr(LDKMaxDustHTLCExposure *NONNULL_PTR arg) {
36551         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
36552         *ret_copy = MaxDustHTLCExposure_clone(arg);
36553         int64_t ret_ref = tag_ptr(ret_copy, true);
36554         return ret_ref;
36555 }
36556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36557         LDKMaxDustHTLCExposure* arg_conv = (LDKMaxDustHTLCExposure*)untag_ptr(arg);
36558         int64_t ret_conv = MaxDustHTLCExposure_clone_ptr(arg_conv);
36559         return ret_conv;
36560 }
36561
36562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36563         LDKMaxDustHTLCExposure* orig_conv = (LDKMaxDustHTLCExposure*)untag_ptr(orig);
36564         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
36565         *ret_copy = MaxDustHTLCExposure_clone(orig_conv);
36566         int64_t ret_ref = tag_ptr(ret_copy, true);
36567         return ret_ref;
36568 }
36569
36570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1fixed_1limit_1msat(JNIEnv *env, jclass clz, int64_t a) {
36571         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
36572         *ret_copy = MaxDustHTLCExposure_fixed_limit_msat(a);
36573         int64_t ret_ref = tag_ptr(ret_copy, true);
36574         return ret_ref;
36575 }
36576
36577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1fee_1rate_1multiplier(JNIEnv *env, jclass clz, int64_t a) {
36578         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
36579         *ret_copy = MaxDustHTLCExposure_fee_rate_multiplier(a);
36580         int64_t ret_ref = tag_ptr(ret_copy, true);
36581         return ret_ref;
36582 }
36583
36584 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
36585         LDKMaxDustHTLCExposure* a_conv = (LDKMaxDustHTLCExposure*)untag_ptr(a);
36586         LDKMaxDustHTLCExposure* b_conv = (LDKMaxDustHTLCExposure*)untag_ptr(b);
36587         jboolean ret_conv = MaxDustHTLCExposure_eq(a_conv, b_conv);
36588         return ret_conv;
36589 }
36590
36591 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1write(JNIEnv *env, jclass clz, int64_t obj) {
36592         LDKMaxDustHTLCExposure* obj_conv = (LDKMaxDustHTLCExposure*)untag_ptr(obj);
36593         LDKCVec_u8Z ret_var = MaxDustHTLCExposure_write(obj_conv);
36594         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36595         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36596         CVec_u8Z_free(ret_var);
36597         return ret_arr;
36598 }
36599
36600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36601         LDKu8slice ser_ref;
36602         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36603         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36604         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
36605         *ret_conv = MaxDustHTLCExposure_read(ser_ref);
36606         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36607         return tag_ptr(ret_conv, true);
36608 }
36609
36610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36611         LDKChannelConfig this_obj_conv;
36612         this_obj_conv.inner = untag_ptr(this_obj);
36613         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36615         ChannelConfig_free(this_obj_conv);
36616 }
36617
36618 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
36619         LDKChannelConfig this_ptr_conv;
36620         this_ptr_conv.inner = untag_ptr(this_ptr);
36621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36623         this_ptr_conv.is_owned = false;
36624         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
36625         return ret_conv;
36626 }
36627
36628 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) {
36629         LDKChannelConfig this_ptr_conv;
36630         this_ptr_conv.inner = untag_ptr(this_ptr);
36631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36633         this_ptr_conv.is_owned = false;
36634         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
36635 }
36636
36637 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
36638         LDKChannelConfig this_ptr_conv;
36639         this_ptr_conv.inner = untag_ptr(this_ptr);
36640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36642         this_ptr_conv.is_owned = false;
36643         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
36644         return ret_conv;
36645 }
36646
36647 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) {
36648         LDKChannelConfig this_ptr_conv;
36649         this_ptr_conv.inner = untag_ptr(this_ptr);
36650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36652         this_ptr_conv.is_owned = false;
36653         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
36654 }
36655
36656 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
36657         LDKChannelConfig this_ptr_conv;
36658         this_ptr_conv.inner = untag_ptr(this_ptr);
36659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36661         this_ptr_conv.is_owned = false;
36662         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
36663         return ret_conv;
36664 }
36665
36666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
36667         LDKChannelConfig this_ptr_conv;
36668         this_ptr_conv.inner = untag_ptr(this_ptr);
36669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36671         this_ptr_conv.is_owned = false;
36672         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
36673 }
36674
36675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure(JNIEnv *env, jclass clz, int64_t this_ptr) {
36676         LDKChannelConfig this_ptr_conv;
36677         this_ptr_conv.inner = untag_ptr(this_ptr);
36678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36680         this_ptr_conv.is_owned = false;
36681         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
36682         *ret_copy = ChannelConfig_get_max_dust_htlc_exposure(&this_ptr_conv);
36683         int64_t ret_ref = tag_ptr(ret_copy, true);
36684         return ret_ref;
36685 }
36686
36687 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) {
36688         LDKChannelConfig this_ptr_conv;
36689         this_ptr_conv.inner = untag_ptr(this_ptr);
36690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36692         this_ptr_conv.is_owned = false;
36693         void* val_ptr = untag_ptr(val);
36694         CHECK_ACCESS(val_ptr);
36695         LDKMaxDustHTLCExposure val_conv = *(LDKMaxDustHTLCExposure*)(val_ptr);
36696         val_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(val));
36697         ChannelConfig_set_max_dust_htlc_exposure(&this_ptr_conv, val_conv);
36698 }
36699
36700 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) {
36701         LDKChannelConfig this_ptr_conv;
36702         this_ptr_conv.inner = untag_ptr(this_ptr);
36703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36705         this_ptr_conv.is_owned = false;
36706         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
36707         return ret_conv;
36708 }
36709
36710 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) {
36711         LDKChannelConfig this_ptr_conv;
36712         this_ptr_conv.inner = untag_ptr(this_ptr);
36713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36715         this_ptr_conv.is_owned = false;
36716         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
36717 }
36718
36719 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1accept_1underpaying_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
36720         LDKChannelConfig this_ptr_conv;
36721         this_ptr_conv.inner = untag_ptr(this_ptr);
36722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36724         this_ptr_conv.is_owned = false;
36725         jboolean ret_conv = ChannelConfig_get_accept_underpaying_htlcs(&this_ptr_conv);
36726         return ret_conv;
36727 }
36728
36729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1accept_1underpaying_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36730         LDKChannelConfig this_ptr_conv;
36731         this_ptr_conv.inner = untag_ptr(this_ptr);
36732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36734         this_ptr_conv.is_owned = false;
36735         ChannelConfig_set_accept_underpaying_htlcs(&this_ptr_conv, val);
36736 }
36737
36738 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) {
36739         void* max_dust_htlc_exposure_arg_ptr = untag_ptr(max_dust_htlc_exposure_arg);
36740         CHECK_ACCESS(max_dust_htlc_exposure_arg_ptr);
36741         LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg_conv = *(LDKMaxDustHTLCExposure*)(max_dust_htlc_exposure_arg_ptr);
36742         max_dust_htlc_exposure_arg_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(max_dust_htlc_exposure_arg));
36743         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);
36744         int64_t ret_ref = 0;
36745         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36746         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36747         return ret_ref;
36748 }
36749
36750 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
36751         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
36752         int64_t ret_ref = 0;
36753         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36754         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36755         return ret_ref;
36756 }
36757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36758         LDKChannelConfig arg_conv;
36759         arg_conv.inner = untag_ptr(arg);
36760         arg_conv.is_owned = ptr_is_owned(arg);
36761         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36762         arg_conv.is_owned = false;
36763         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
36764         return ret_conv;
36765 }
36766
36767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36768         LDKChannelConfig orig_conv;
36769         orig_conv.inner = untag_ptr(orig);
36770         orig_conv.is_owned = ptr_is_owned(orig);
36771         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36772         orig_conv.is_owned = false;
36773         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
36774         int64_t ret_ref = 0;
36775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36777         return ret_ref;
36778 }
36779
36780 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
36781         LDKChannelConfig a_conv;
36782         a_conv.inner = untag_ptr(a);
36783         a_conv.is_owned = ptr_is_owned(a);
36784         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36785         a_conv.is_owned = false;
36786         LDKChannelConfig b_conv;
36787         b_conv.inner = untag_ptr(b);
36788         b_conv.is_owned = ptr_is_owned(b);
36789         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36790         b_conv.is_owned = false;
36791         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
36792         return ret_conv;
36793 }
36794
36795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1apply(JNIEnv *env, jclass clz, int64_t this_arg, int64_t update) {
36796         LDKChannelConfig this_arg_conv;
36797         this_arg_conv.inner = untag_ptr(this_arg);
36798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36800         this_arg_conv.is_owned = false;
36801         LDKChannelConfigUpdate update_conv;
36802         update_conv.inner = untag_ptr(update);
36803         update_conv.is_owned = ptr_is_owned(update);
36804         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
36805         update_conv.is_owned = false;
36806         ChannelConfig_apply(&this_arg_conv, &update_conv);
36807 }
36808
36809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
36810         LDKChannelConfig ret_var = ChannelConfig_default();
36811         int64_t ret_ref = 0;
36812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36814         return ret_ref;
36815 }
36816
36817 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
36818         LDKChannelConfig obj_conv;
36819         obj_conv.inner = untag_ptr(obj);
36820         obj_conv.is_owned = ptr_is_owned(obj);
36821         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36822         obj_conv.is_owned = false;
36823         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
36824         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36825         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36826         CVec_u8Z_free(ret_var);
36827         return ret_arr;
36828 }
36829
36830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36831         LDKu8slice ser_ref;
36832         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36833         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36834         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
36835         *ret_conv = ChannelConfig_read(ser_ref);
36836         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36837         return tag_ptr(ret_conv, true);
36838 }
36839
36840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36841         LDKChannelConfigUpdate this_obj_conv;
36842         this_obj_conv.inner = untag_ptr(this_obj);
36843         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36845         ChannelConfigUpdate_free(this_obj_conv);
36846 }
36847
36848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
36849         LDKChannelConfigUpdate this_ptr_conv;
36850         this_ptr_conv.inner = untag_ptr(this_ptr);
36851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36853         this_ptr_conv.is_owned = false;
36854         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
36855         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
36856         int64_t ret_ref = tag_ptr(ret_copy, true);
36857         return ret_ref;
36858 }
36859
36860 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) {
36861         LDKChannelConfigUpdate this_ptr_conv;
36862         this_ptr_conv.inner = untag_ptr(this_ptr);
36863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36865         this_ptr_conv.is_owned = false;
36866         void* val_ptr = untag_ptr(val);
36867         CHECK_ACCESS(val_ptr);
36868         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
36869         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
36870         ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val_conv);
36871 }
36872
36873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
36874         LDKChannelConfigUpdate this_ptr_conv;
36875         this_ptr_conv.inner = untag_ptr(this_ptr);
36876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36878         this_ptr_conv.is_owned = false;
36879         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
36880         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_base_msat(&this_ptr_conv);
36881         int64_t ret_ref = tag_ptr(ret_copy, true);
36882         return ret_ref;
36883 }
36884
36885 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) {
36886         LDKChannelConfigUpdate this_ptr_conv;
36887         this_ptr_conv.inner = untag_ptr(this_ptr);
36888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36890         this_ptr_conv.is_owned = false;
36891         void* val_ptr = untag_ptr(val);
36892         CHECK_ACCESS(val_ptr);
36893         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
36894         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
36895         ChannelConfigUpdate_set_forwarding_fee_base_msat(&this_ptr_conv, val_conv);
36896 }
36897
36898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
36899         LDKChannelConfigUpdate this_ptr_conv;
36900         this_ptr_conv.inner = untag_ptr(this_ptr);
36901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36903         this_ptr_conv.is_owned = false;
36904         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
36905         *ret_copy = ChannelConfigUpdate_get_cltv_expiry_delta(&this_ptr_conv);
36906         int64_t ret_ref = tag_ptr(ret_copy, true);
36907         return ret_ref;
36908 }
36909
36910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36911         LDKChannelConfigUpdate this_ptr_conv;
36912         this_ptr_conv.inner = untag_ptr(this_ptr);
36913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36915         this_ptr_conv.is_owned = false;
36916         void* val_ptr = untag_ptr(val);
36917         CHECK_ACCESS(val_ptr);
36918         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
36919         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
36920         ChannelConfigUpdate_set_cltv_expiry_delta(&this_ptr_conv, val_conv);
36921 }
36922
36923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
36924         LDKChannelConfigUpdate this_ptr_conv;
36925         this_ptr_conv.inner = untag_ptr(this_ptr);
36926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36928         this_ptr_conv.is_owned = false;
36929         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
36930         *ret_copy = ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
36931         int64_t ret_ref = tag_ptr(ret_copy, true);
36932         return ret_ref;
36933 }
36934
36935 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) {
36936         LDKChannelConfigUpdate this_ptr_conv;
36937         this_ptr_conv.inner = untag_ptr(this_ptr);
36938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36940         this_ptr_conv.is_owned = false;
36941         void* val_ptr = untag_ptr(val);
36942         CHECK_ACCESS(val_ptr);
36943         LDKCOption_MaxDustHTLCExposureZ val_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(val_ptr);
36944         val_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(val));
36945         ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val_conv);
36946 }
36947
36948 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) {
36949         LDKChannelConfigUpdate this_ptr_conv;
36950         this_ptr_conv.inner = untag_ptr(this_ptr);
36951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36953         this_ptr_conv.is_owned = false;
36954         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
36955         *ret_copy = ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
36956         int64_t ret_ref = tag_ptr(ret_copy, true);
36957         return ret_ref;
36958 }
36959
36960 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) {
36961         LDKChannelConfigUpdate this_ptr_conv;
36962         this_ptr_conv.inner = untag_ptr(this_ptr);
36963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36965         this_ptr_conv.is_owned = false;
36966         void* val_ptr = untag_ptr(val);
36967         CHECK_ACCESS(val_ptr);
36968         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
36969         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
36970         ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val_conv);
36971 }
36972
36973 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) {
36974         void* forwarding_fee_proportional_millionths_arg_ptr = untag_ptr(forwarding_fee_proportional_millionths_arg);
36975         CHECK_ACCESS(forwarding_fee_proportional_millionths_arg_ptr);
36976         LDKCOption_u32Z forwarding_fee_proportional_millionths_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_proportional_millionths_arg_ptr);
36977         forwarding_fee_proportional_millionths_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_proportional_millionths_arg));
36978         void* forwarding_fee_base_msat_arg_ptr = untag_ptr(forwarding_fee_base_msat_arg);
36979         CHECK_ACCESS(forwarding_fee_base_msat_arg_ptr);
36980         LDKCOption_u32Z forwarding_fee_base_msat_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_base_msat_arg_ptr);
36981         forwarding_fee_base_msat_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_base_msat_arg));
36982         void* cltv_expiry_delta_arg_ptr = untag_ptr(cltv_expiry_delta_arg);
36983         CHECK_ACCESS(cltv_expiry_delta_arg_ptr);
36984         LDKCOption_u16Z cltv_expiry_delta_arg_conv = *(LDKCOption_u16Z*)(cltv_expiry_delta_arg_ptr);
36985         cltv_expiry_delta_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(cltv_expiry_delta_arg));
36986         void* max_dust_htlc_exposure_msat_arg_ptr = untag_ptr(max_dust_htlc_exposure_msat_arg);
36987         CHECK_ACCESS(max_dust_htlc_exposure_msat_arg_ptr);
36988         LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(max_dust_htlc_exposure_msat_arg_ptr);
36989         max_dust_htlc_exposure_msat_arg_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(max_dust_htlc_exposure_msat_arg));
36990         void* force_close_avoidance_max_fee_satoshis_arg_ptr = untag_ptr(force_close_avoidance_max_fee_satoshis_arg);
36991         CHECK_ACCESS(force_close_avoidance_max_fee_satoshis_arg_ptr);
36992         LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg_conv = *(LDKCOption_u64Z*)(force_close_avoidance_max_fee_satoshis_arg_ptr);
36993         force_close_avoidance_max_fee_satoshis_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(force_close_avoidance_max_fee_satoshis_arg));
36994         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);
36995         int64_t ret_ref = 0;
36996         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36997         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36998         return ret_ref;
36999 }
37000
37001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1default(JNIEnv *env, jclass clz) {
37002         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_default();
37003         int64_t ret_ref = 0;
37004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37006         return ret_ref;
37007 }
37008
37009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37010         LDKUserConfig this_obj_conv;
37011         this_obj_conv.inner = untag_ptr(this_obj);
37012         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37014         UserConfig_free(this_obj_conv);
37015 }
37016
37017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
37018         LDKUserConfig this_ptr_conv;
37019         this_ptr_conv.inner = untag_ptr(this_ptr);
37020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37022         this_ptr_conv.is_owned = false;
37023         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
37024         int64_t ret_ref = 0;
37025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37027         return ret_ref;
37028 }
37029
37030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37031         LDKUserConfig this_ptr_conv;
37032         this_ptr_conv.inner = untag_ptr(this_ptr);
37033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37035         this_ptr_conv.is_owned = false;
37036         LDKChannelHandshakeConfig val_conv;
37037         val_conv.inner = untag_ptr(val);
37038         val_conv.is_owned = ptr_is_owned(val);
37039         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37040         val_conv = ChannelHandshakeConfig_clone(&val_conv);
37041         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
37042 }
37043
37044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
37045         LDKUserConfig this_ptr_conv;
37046         this_ptr_conv.inner = untag_ptr(this_ptr);
37047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37049         this_ptr_conv.is_owned = false;
37050         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
37051         int64_t ret_ref = 0;
37052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37054         return ret_ref;
37055 }
37056
37057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37058         LDKUserConfig this_ptr_conv;
37059         this_ptr_conv.inner = untag_ptr(this_ptr);
37060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37062         this_ptr_conv.is_owned = false;
37063         LDKChannelHandshakeLimits val_conv;
37064         val_conv.inner = untag_ptr(val);
37065         val_conv.is_owned = ptr_is_owned(val);
37066         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37067         val_conv = ChannelHandshakeLimits_clone(&val_conv);
37068         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
37069 }
37070
37071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
37072         LDKUserConfig this_ptr_conv;
37073         this_ptr_conv.inner = untag_ptr(this_ptr);
37074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37076         this_ptr_conv.is_owned = false;
37077         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
37078         int64_t ret_ref = 0;
37079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37081         return ret_ref;
37082 }
37083
37084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37085         LDKUserConfig this_ptr_conv;
37086         this_ptr_conv.inner = untag_ptr(this_ptr);
37087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37089         this_ptr_conv.is_owned = false;
37090         LDKChannelConfig val_conv;
37091         val_conv.inner = untag_ptr(val);
37092         val_conv.is_owned = ptr_is_owned(val);
37093         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37094         val_conv = ChannelConfig_clone(&val_conv);
37095         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
37096 }
37097
37098 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
37099         LDKUserConfig this_ptr_conv;
37100         this_ptr_conv.inner = untag_ptr(this_ptr);
37101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37103         this_ptr_conv.is_owned = false;
37104         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
37105         return ret_conv;
37106 }
37107
37108 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) {
37109         LDKUserConfig this_ptr_conv;
37110         this_ptr_conv.inner = untag_ptr(this_ptr);
37111         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37113         this_ptr_conv.is_owned = false;
37114         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
37115 }
37116
37117 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
37118         LDKUserConfig this_ptr_conv;
37119         this_ptr_conv.inner = untag_ptr(this_ptr);
37120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37122         this_ptr_conv.is_owned = false;
37123         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
37124         return ret_conv;
37125 }
37126
37127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
37128         LDKUserConfig this_ptr_conv;
37129         this_ptr_conv.inner = untag_ptr(this_ptr);
37130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37132         this_ptr_conv.is_owned = false;
37133         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
37134 }
37135
37136 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
37137         LDKUserConfig this_ptr_conv;
37138         this_ptr_conv.inner = untag_ptr(this_ptr);
37139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37141         this_ptr_conv.is_owned = false;
37142         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
37143         return ret_conv;
37144 }
37145
37146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
37147         LDKUserConfig this_ptr_conv;
37148         this_ptr_conv.inner = untag_ptr(this_ptr);
37149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37151         this_ptr_conv.is_owned = false;
37152         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
37153 }
37154
37155 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1intercept_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
37156         LDKUserConfig this_ptr_conv;
37157         this_ptr_conv.inner = untag_ptr(this_ptr);
37158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37160         this_ptr_conv.is_owned = false;
37161         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
37162         return ret_conv;
37163 }
37164
37165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1intercept_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
37166         LDKUserConfig this_ptr_conv;
37167         this_ptr_conv.inner = untag_ptr(this_ptr);
37168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37170         this_ptr_conv.is_owned = false;
37171         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
37172 }
37173
37174 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1mpp_1keysend(JNIEnv *env, jclass clz, int64_t this_ptr) {
37175         LDKUserConfig this_ptr_conv;
37176         this_ptr_conv.inner = untag_ptr(this_ptr);
37177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37179         this_ptr_conv.is_owned = false;
37180         jboolean ret_conv = UserConfig_get_accept_mpp_keysend(&this_ptr_conv);
37181         return ret_conv;
37182 }
37183
37184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1mpp_1keysend(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
37185         LDKUserConfig this_ptr_conv;
37186         this_ptr_conv.inner = untag_ptr(this_ptr);
37187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37189         this_ptr_conv.is_owned = false;
37190         UserConfig_set_accept_mpp_keysend(&this_ptr_conv, val);
37191 }
37192
37193 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) {
37194         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
37195         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
37196         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
37197         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
37198         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
37199         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
37200         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
37201         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
37202         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
37203         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
37204         LDKChannelConfig channel_config_arg_conv;
37205         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
37206         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
37207         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
37208         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
37209         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);
37210         int64_t ret_ref = 0;
37211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37213         return ret_ref;
37214 }
37215
37216 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
37217         LDKUserConfig ret_var = UserConfig_clone(arg);
37218         int64_t ret_ref = 0;
37219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37221         return ret_ref;
37222 }
37223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37224         LDKUserConfig arg_conv;
37225         arg_conv.inner = untag_ptr(arg);
37226         arg_conv.is_owned = ptr_is_owned(arg);
37227         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37228         arg_conv.is_owned = false;
37229         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
37230         return ret_conv;
37231 }
37232
37233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37234         LDKUserConfig orig_conv;
37235         orig_conv.inner = untag_ptr(orig);
37236         orig_conv.is_owned = ptr_is_owned(orig);
37237         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37238         orig_conv.is_owned = false;
37239         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
37240         int64_t ret_ref = 0;
37241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37243         return ret_ref;
37244 }
37245
37246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
37247         LDKUserConfig ret_var = UserConfig_default();
37248         int64_t ret_ref = 0;
37249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37250         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37251         return ret_ref;
37252 }
37253
37254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37255         LDKBestBlock this_obj_conv;
37256         this_obj_conv.inner = untag_ptr(this_obj);
37257         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37259         BestBlock_free(this_obj_conv);
37260 }
37261
37262 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
37263         LDKBestBlock ret_var = BestBlock_clone(arg);
37264         int64_t ret_ref = 0;
37265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37266         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37267         return ret_ref;
37268 }
37269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37270         LDKBestBlock arg_conv;
37271         arg_conv.inner = untag_ptr(arg);
37272         arg_conv.is_owned = ptr_is_owned(arg);
37273         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37274         arg_conv.is_owned = false;
37275         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
37276         return ret_conv;
37277 }
37278
37279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37280         LDKBestBlock orig_conv;
37281         orig_conv.inner = untag_ptr(orig);
37282         orig_conv.is_owned = ptr_is_owned(orig);
37283         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37284         orig_conv.is_owned = false;
37285         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
37286         int64_t ret_ref = 0;
37287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37289         return ret_ref;
37290 }
37291
37292 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BestBlock_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37293         LDKBestBlock a_conv;
37294         a_conv.inner = untag_ptr(a);
37295         a_conv.is_owned = ptr_is_owned(a);
37296         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37297         a_conv.is_owned = false;
37298         LDKBestBlock b_conv;
37299         b_conv.inner = untag_ptr(b);
37300         b_conv.is_owned = ptr_is_owned(b);
37301         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37302         b_conv.is_owned = false;
37303         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
37304         return ret_conv;
37305 }
37306
37307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1network(JNIEnv *env, jclass clz, jclass network) {
37308         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
37309         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
37310         int64_t ret_ref = 0;
37311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37313         return ret_ref;
37314 }
37315
37316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
37317         LDKThirtyTwoBytes block_hash_ref;
37318         CHECK((*env)->GetArrayLength(env, block_hash) == 32);
37319         (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
37320         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
37321         int64_t ret_ref = 0;
37322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37324         return ret_ref;
37325 }
37326
37327 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
37328         LDKBestBlock this_arg_conv;
37329         this_arg_conv.inner = untag_ptr(this_arg);
37330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37332         this_arg_conv.is_owned = false;
37333         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37334         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
37335         return ret_arr;
37336 }
37337
37338 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
37339         LDKBestBlock this_arg_conv;
37340         this_arg_conv.inner = untag_ptr(this_arg);
37341         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37343         this_arg_conv.is_owned = false;
37344         int32_t ret_conv = BestBlock_height(&this_arg_conv);
37345         return ret_conv;
37346 }
37347
37348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37349         if (!ptr_is_owned(this_ptr)) return;
37350         void* this_ptr_ptr = untag_ptr(this_ptr);
37351         CHECK_ACCESS(this_ptr_ptr);
37352         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
37353         FREE(untag_ptr(this_ptr));
37354         Listen_free(this_ptr_conv);
37355 }
37356
37357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37358         if (!ptr_is_owned(this_ptr)) return;
37359         void* this_ptr_ptr = untag_ptr(this_ptr);
37360         CHECK_ACCESS(this_ptr_ptr);
37361         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
37362         FREE(untag_ptr(this_ptr));
37363         Confirm_free(this_ptr_conv);
37364 }
37365
37366 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37367         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
37368         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_clone(orig_conv));
37369         return ret_conv;
37370 }
37371
37372 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1completed(JNIEnv *env, jclass clz) {
37373         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_completed());
37374         return ret_conv;
37375 }
37376
37377 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1in_1progress(JNIEnv *env, jclass clz) {
37378         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_in_progress());
37379         return ret_conv;
37380 }
37381
37382 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1unrecoverable_1error(JNIEnv *env, jclass clz) {
37383         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_unrecoverable_error());
37384         return ret_conv;
37385 }
37386
37387 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37388         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
37389         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
37390         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
37391         return ret_conv;
37392 }
37393
37394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37395         if (!ptr_is_owned(this_ptr)) return;
37396         void* this_ptr_ptr = untag_ptr(this_ptr);
37397         CHECK_ACCESS(this_ptr_ptr);
37398         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
37399         FREE(untag_ptr(this_ptr));
37400         Watch_free(this_ptr_conv);
37401 }
37402
37403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37404         if (!ptr_is_owned(this_ptr)) return;
37405         void* this_ptr_ptr = untag_ptr(this_ptr);
37406         CHECK_ACCESS(this_ptr_ptr);
37407         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
37408         FREE(untag_ptr(this_ptr));
37409         Filter_free(this_ptr_conv);
37410 }
37411
37412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37413         LDKWatchedOutput this_obj_conv;
37414         this_obj_conv.inner = untag_ptr(this_obj);
37415         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37417         WatchedOutput_free(this_obj_conv);
37418 }
37419
37420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
37421         LDKWatchedOutput this_ptr_conv;
37422         this_ptr_conv.inner = untag_ptr(this_ptr);
37423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37425         this_ptr_conv.is_owned = false;
37426         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
37427         *ret_copy = WatchedOutput_get_block_hash(&this_ptr_conv);
37428         int64_t ret_ref = tag_ptr(ret_copy, true);
37429         return ret_ref;
37430 }
37431
37432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37433         LDKWatchedOutput this_ptr_conv;
37434         this_ptr_conv.inner = untag_ptr(this_ptr);
37435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37437         this_ptr_conv.is_owned = false;
37438         void* val_ptr = untag_ptr(val);
37439         CHECK_ACCESS(val_ptr);
37440         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
37441         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
37442         WatchedOutput_set_block_hash(&this_ptr_conv, val_conv);
37443 }
37444
37445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
37446         LDKWatchedOutput this_ptr_conv;
37447         this_ptr_conv.inner = untag_ptr(this_ptr);
37448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37450         this_ptr_conv.is_owned = false;
37451         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
37452         int64_t ret_ref = 0;
37453         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37454         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37455         return ret_ref;
37456 }
37457
37458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37459         LDKWatchedOutput this_ptr_conv;
37460         this_ptr_conv.inner = untag_ptr(this_ptr);
37461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37463         this_ptr_conv.is_owned = false;
37464         LDKOutPoint val_conv;
37465         val_conv.inner = untag_ptr(val);
37466         val_conv.is_owned = ptr_is_owned(val);
37467         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37468         val_conv = OutPoint_clone(&val_conv);
37469         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
37470 }
37471
37472 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
37473         LDKWatchedOutput this_ptr_conv;
37474         this_ptr_conv.inner = untag_ptr(this_ptr);
37475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37477         this_ptr_conv.is_owned = false;
37478         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
37479         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37480         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37481         return ret_arr;
37482 }
37483
37484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37485         LDKWatchedOutput this_ptr_conv;
37486         this_ptr_conv.inner = untag_ptr(this_ptr);
37487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37489         this_ptr_conv.is_owned = false;
37490         LDKCVec_u8Z val_ref;
37491         val_ref.datalen = (*env)->GetArrayLength(env, val);
37492         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
37493         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
37494         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
37495 }
37496
37497 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) {
37498         void* block_hash_arg_ptr = untag_ptr(block_hash_arg);
37499         CHECK_ACCESS(block_hash_arg_ptr);
37500         LDKCOption_ThirtyTwoBytesZ block_hash_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(block_hash_arg_ptr);
37501         block_hash_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(block_hash_arg));
37502         LDKOutPoint outpoint_arg_conv;
37503         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
37504         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
37505         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
37506         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
37507         LDKCVec_u8Z script_pubkey_arg_ref;
37508         script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
37509         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
37510         (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
37511         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_conv, outpoint_arg_conv, script_pubkey_arg_ref);
37512         int64_t ret_ref = 0;
37513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37515         return ret_ref;
37516 }
37517
37518 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
37519         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
37520         int64_t ret_ref = 0;
37521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37523         return ret_ref;
37524 }
37525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37526         LDKWatchedOutput arg_conv;
37527         arg_conv.inner = untag_ptr(arg);
37528         arg_conv.is_owned = ptr_is_owned(arg);
37529         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37530         arg_conv.is_owned = false;
37531         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
37532         return ret_conv;
37533 }
37534
37535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37536         LDKWatchedOutput orig_conv;
37537         orig_conv.inner = untag_ptr(orig);
37538         orig_conv.is_owned = ptr_is_owned(orig);
37539         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37540         orig_conv.is_owned = false;
37541         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
37542         int64_t ret_ref = 0;
37543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37545         return ret_ref;
37546 }
37547
37548 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37549         LDKWatchedOutput a_conv;
37550         a_conv.inner = untag_ptr(a);
37551         a_conv.is_owned = ptr_is_owned(a);
37552         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37553         a_conv.is_owned = false;
37554         LDKWatchedOutput b_conv;
37555         b_conv.inner = untag_ptr(b);
37556         b_conv.is_owned = ptr_is_owned(b);
37557         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37558         b_conv.is_owned = false;
37559         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
37560         return ret_conv;
37561 }
37562
37563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
37564         LDKWatchedOutput o_conv;
37565         o_conv.inner = untag_ptr(o);
37566         o_conv.is_owned = ptr_is_owned(o);
37567         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37568         o_conv.is_owned = false;
37569         int64_t ret_conv = WatchedOutput_hash(&o_conv);
37570         return ret_conv;
37571 }
37572
37573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37574         if (!ptr_is_owned(this_ptr)) return;
37575         void* this_ptr_ptr = untag_ptr(this_ptr);
37576         CHECK_ACCESS(this_ptr_ptr);
37577         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
37578         FREE(untag_ptr(this_ptr));
37579         BroadcasterInterface_free(this_ptr_conv);
37580 }
37581
37582 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37583         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
37584         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
37585         return ret_conv;
37586 }
37587
37588 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1on_1chain_1sweep(JNIEnv *env, jclass clz) {
37589         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_on_chain_sweep());
37590         return ret_conv;
37591 }
37592
37593 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1max_1allowed_1non_1anchor_1channel_1remote_1fee(JNIEnv *env, jclass clz) {
37594         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_max_allowed_non_anchor_channel_remote_fee());
37595         return ret_conv;
37596 }
37597
37598 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1min_1allowed_1anchor_1channel_1remote_1fee(JNIEnv *env, jclass clz) {
37599         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_min_allowed_anchor_channel_remote_fee());
37600         return ret_conv;
37601 }
37602
37603 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1min_1allowed_1non_1anchor_1channel_1remote_1fee(JNIEnv *env, jclass clz) {
37604         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee());
37605         return ret_conv;
37606 }
37607
37608 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1anchor_1channel_1fee(JNIEnv *env, jclass clz) {
37609         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_anchor_channel_fee());
37610         return ret_conv;
37611 }
37612
37613 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1non_1anchor_1channel_1fee(JNIEnv *env, jclass clz) {
37614         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_non_anchor_channel_fee());
37615         return ret_conv;
37616 }
37617
37618 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1channel_1close_1minimum(JNIEnv *env, jclass clz) {
37619         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_channel_close_minimum());
37620         return ret_conv;
37621 }
37622
37623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1hash(JNIEnv *env, jclass clz, int64_t o) {
37624         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
37625         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
37626         return ret_conv;
37627 }
37628
37629 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37630         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
37631         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
37632         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
37633         return ret_conv;
37634 }
37635
37636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37637         if (!ptr_is_owned(this_ptr)) return;
37638         void* this_ptr_ptr = untag_ptr(this_ptr);
37639         CHECK_ACCESS(this_ptr_ptr);
37640         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
37641         FREE(untag_ptr(this_ptr));
37642         FeeEstimator_free(this_ptr_conv);
37643 }
37644
37645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37646         LDKMonitorUpdateId this_obj_conv;
37647         this_obj_conv.inner = untag_ptr(this_obj);
37648         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37650         MonitorUpdateId_free(this_obj_conv);
37651 }
37652
37653 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
37654         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
37655         int64_t ret_ref = 0;
37656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37658         return ret_ref;
37659 }
37660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37661         LDKMonitorUpdateId arg_conv;
37662         arg_conv.inner = untag_ptr(arg);
37663         arg_conv.is_owned = ptr_is_owned(arg);
37664         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37665         arg_conv.is_owned = false;
37666         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
37667         return ret_conv;
37668 }
37669
37670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37671         LDKMonitorUpdateId orig_conv;
37672         orig_conv.inner = untag_ptr(orig);
37673         orig_conv.is_owned = ptr_is_owned(orig);
37674         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37675         orig_conv.is_owned = false;
37676         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
37677         int64_t ret_ref = 0;
37678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37680         return ret_ref;
37681 }
37682
37683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1hash(JNIEnv *env, jclass clz, int64_t o) {
37684         LDKMonitorUpdateId o_conv;
37685         o_conv.inner = untag_ptr(o);
37686         o_conv.is_owned = ptr_is_owned(o);
37687         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37688         o_conv.is_owned = false;
37689         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
37690         return ret_conv;
37691 }
37692
37693 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37694         LDKMonitorUpdateId a_conv;
37695         a_conv.inner = untag_ptr(a);
37696         a_conv.is_owned = ptr_is_owned(a);
37697         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37698         a_conv.is_owned = false;
37699         LDKMonitorUpdateId b_conv;
37700         b_conv.inner = untag_ptr(b);
37701         b_conv.is_owned = ptr_is_owned(b);
37702         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37703         b_conv.is_owned = false;
37704         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
37705         return ret_conv;
37706 }
37707
37708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37709         if (!ptr_is_owned(this_ptr)) return;
37710         void* this_ptr_ptr = untag_ptr(this_ptr);
37711         CHECK_ACCESS(this_ptr_ptr);
37712         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
37713         FREE(untag_ptr(this_ptr));
37714         Persist_free(this_ptr_conv);
37715 }
37716
37717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37718         LDKLockedChannelMonitor this_obj_conv;
37719         this_obj_conv.inner = untag_ptr(this_obj);
37720         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37722         LockedChannelMonitor_free(this_obj_conv);
37723 }
37724
37725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37726         LDKChainMonitor this_obj_conv;
37727         this_obj_conv.inner = untag_ptr(this_obj);
37728         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37730         ChainMonitor_free(this_obj_conv);
37731 }
37732
37733 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) {
37734         void* chain_source_ptr = untag_ptr(chain_source);
37735         CHECK_ACCESS(chain_source_ptr);
37736         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
37737         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
37738         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
37739                 // Manually implement clone for Java trait instances
37740                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
37741                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37742                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
37743                 }
37744         }
37745         void* broadcaster_ptr = untag_ptr(broadcaster);
37746         CHECK_ACCESS(broadcaster_ptr);
37747         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
37748         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
37749                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37750                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
37751         }
37752         void* logger_ptr = untag_ptr(logger);
37753         CHECK_ACCESS(logger_ptr);
37754         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
37755         if (logger_conv.free == LDKLogger_JCalls_free) {
37756                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37757                 LDKLogger_JCalls_cloned(&logger_conv);
37758         }
37759         void* feeest_ptr = untag_ptr(feeest);
37760         CHECK_ACCESS(feeest_ptr);
37761         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
37762         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
37763                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37764                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
37765         }
37766         void* persister_ptr = untag_ptr(persister);
37767         CHECK_ACCESS(persister_ptr);
37768         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
37769         if (persister_conv.free == LDKPersist_JCalls_free) {
37770                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37771                 LDKPersist_JCalls_cloned(&persister_conv);
37772         }
37773         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
37774         int64_t ret_ref = 0;
37775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37777         return ret_ref;
37778 }
37779
37780 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) {
37781         LDKChainMonitor this_arg_conv;
37782         this_arg_conv.inner = untag_ptr(this_arg);
37783         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37785         this_arg_conv.is_owned = false;
37786         LDKCVec_ChannelDetailsZ ignored_channels_constr;
37787         ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
37788         if (ignored_channels_constr.datalen > 0)
37789                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
37790         else
37791                 ignored_channels_constr.data = NULL;
37792         int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
37793         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
37794                 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
37795                 LDKChannelDetails ignored_channels_conv_16_conv;
37796                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
37797                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
37798                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
37799                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
37800                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
37801         }
37802         (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
37803         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
37804         int64_tArray ret_arr = NULL;
37805         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37806         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37807         for (size_t j = 0; j < ret_var.datalen; j++) {
37808                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
37809                 *ret_conv_9_copy = ret_var.data[j];
37810                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
37811                 ret_arr_ptr[j] = ret_conv_9_ref;
37812         }
37813         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37814         FREE(ret_var.data);
37815         return ret_arr;
37816 }
37817
37818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) {
37819         LDKChainMonitor this_arg_conv;
37820         this_arg_conv.inner = untag_ptr(this_arg);
37821         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37823         this_arg_conv.is_owned = false;
37824         LDKOutPoint funding_txo_conv;
37825         funding_txo_conv.inner = untag_ptr(funding_txo);
37826         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
37827         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
37828         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
37829         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
37830         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
37831         return tag_ptr(ret_conv, true);
37832 }
37833
37834 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
37835         LDKChainMonitor this_arg_conv;
37836         this_arg_conv.inner = untag_ptr(this_arg);
37837         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37839         this_arg_conv.is_owned = false;
37840         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
37841         int64_tArray ret_arr = NULL;
37842         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37843         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37844         for (size_t k = 0; k < ret_var.datalen; k++) {
37845                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
37846                 int64_t ret_conv_10_ref = 0;
37847                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
37848                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
37849                 ret_arr_ptr[k] = ret_conv_10_ref;
37850         }
37851         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37852         FREE(ret_var.data);
37853         return ret_arr;
37854 }
37855
37856 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1pending_1monitor_1updates(JNIEnv *env, jclass clz, int64_t this_arg) {
37857         LDKChainMonitor this_arg_conv;
37858         this_arg_conv.inner = untag_ptr(this_arg);
37859         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37861         this_arg_conv.is_owned = false;
37862         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
37863         int64_tArray ret_arr = NULL;
37864         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37865         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37866         for (size_t p = 0; p < ret_var.datalen; p++) {
37867                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
37868                 *ret_conv_41_conv = ret_var.data[p];
37869                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
37870         }
37871         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37872         FREE(ret_var.data);
37873         return ret_arr;
37874 }
37875
37876 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) {
37877         LDKChainMonitor this_arg_conv;
37878         this_arg_conv.inner = untag_ptr(this_arg);
37879         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37881         this_arg_conv.is_owned = false;
37882         LDKOutPoint funding_txo_conv;
37883         funding_txo_conv.inner = untag_ptr(funding_txo);
37884         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
37885         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
37886         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
37887         LDKMonitorUpdateId completed_update_id_conv;
37888         completed_update_id_conv.inner = untag_ptr(completed_update_id);
37889         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
37890         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
37891         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
37892         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
37893         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
37894         return tag_ptr(ret_conv, true);
37895 }
37896
37897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1update_1future(JNIEnv *env, jclass clz, int64_t this_arg) {
37898         LDKChainMonitor this_arg_conv;
37899         this_arg_conv.inner = untag_ptr(this_arg);
37900         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37902         this_arg_conv.is_owned = false;
37903         LDKFuture ret_var = ChainMonitor_get_update_future(&this_arg_conv);
37904         int64_t ret_ref = 0;
37905         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37906         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37907         return ret_ref;
37908 }
37909
37910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1rebroadcast_1pending_1claims(JNIEnv *env, jclass clz, int64_t this_arg) {
37911         LDKChainMonitor this_arg_conv;
37912         this_arg_conv.inner = untag_ptr(this_arg);
37913         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37915         this_arg_conv.is_owned = false;
37916         ChainMonitor_rebroadcast_pending_claims(&this_arg_conv);
37917 }
37918
37919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
37920         LDKChainMonitor this_arg_conv;
37921         this_arg_conv.inner = untag_ptr(this_arg);
37922         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37924         this_arg_conv.is_owned = false;
37925         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
37926         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
37927         return tag_ptr(ret_ret, true);
37928 }
37929
37930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
37931         LDKChainMonitor this_arg_conv;
37932         this_arg_conv.inner = untag_ptr(this_arg);
37933         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37935         this_arg_conv.is_owned = false;
37936         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
37937         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
37938         return tag_ptr(ret_ret, true);
37939 }
37940
37941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
37942         LDKChainMonitor this_arg_conv;
37943         this_arg_conv.inner = untag_ptr(this_arg);
37944         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37946         this_arg_conv.is_owned = false;
37947         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
37948         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
37949         return tag_ptr(ret_ret, true);
37950 }
37951
37952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
37953         LDKChainMonitor this_arg_conv;
37954         this_arg_conv.inner = untag_ptr(this_arg);
37955         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37957         this_arg_conv.is_owned = false;
37958         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
37959         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
37960         return tag_ptr(ret_ret, true);
37961 }
37962
37963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37964         LDKChannelMonitorUpdate this_obj_conv;
37965         this_obj_conv.inner = untag_ptr(this_obj);
37966         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37968         ChannelMonitorUpdate_free(this_obj_conv);
37969 }
37970
37971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
37972         LDKChannelMonitorUpdate this_ptr_conv;
37973         this_ptr_conv.inner = untag_ptr(this_ptr);
37974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37976         this_ptr_conv.is_owned = false;
37977         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
37978         return ret_conv;
37979 }
37980
37981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37982         LDKChannelMonitorUpdate this_ptr_conv;
37983         this_ptr_conv.inner = untag_ptr(this_ptr);
37984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37986         this_ptr_conv.is_owned = false;
37987         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
37988 }
37989
37990 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
37991         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
37992         int64_t ret_ref = 0;
37993         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37994         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37995         return ret_ref;
37996 }
37997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37998         LDKChannelMonitorUpdate arg_conv;
37999         arg_conv.inner = untag_ptr(arg);
38000         arg_conv.is_owned = ptr_is_owned(arg);
38001         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38002         arg_conv.is_owned = false;
38003         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
38004         return ret_conv;
38005 }
38006
38007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38008         LDKChannelMonitorUpdate orig_conv;
38009         orig_conv.inner = untag_ptr(orig);
38010         orig_conv.is_owned = ptr_is_owned(orig);
38011         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38012         orig_conv.is_owned = false;
38013         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
38014         int64_t ret_ref = 0;
38015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38017         return ret_ref;
38018 }
38019
38020 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38021         LDKChannelMonitorUpdate a_conv;
38022         a_conv.inner = untag_ptr(a);
38023         a_conv.is_owned = ptr_is_owned(a);
38024         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38025         a_conv.is_owned = false;
38026         LDKChannelMonitorUpdate b_conv;
38027         b_conv.inner = untag_ptr(b);
38028         b_conv.is_owned = ptr_is_owned(b);
38029         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38030         b_conv.is_owned = false;
38031         jboolean ret_conv = ChannelMonitorUpdate_eq(&a_conv, &b_conv);
38032         return ret_conv;
38033 }
38034
38035 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
38036         LDKChannelMonitorUpdate obj_conv;
38037         obj_conv.inner = untag_ptr(obj);
38038         obj_conv.is_owned = ptr_is_owned(obj);
38039         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38040         obj_conv.is_owned = false;
38041         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
38042         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38043         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38044         CVec_u8Z_free(ret_var);
38045         return ret_arr;
38046 }
38047
38048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38049         LDKu8slice ser_ref;
38050         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38051         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38052         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
38053         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
38054         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38055         return tag_ptr(ret_conv, true);
38056 }
38057
38058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
38059         if (!ptr_is_owned(this_ptr)) return;
38060         void* this_ptr_ptr = untag_ptr(this_ptr);
38061         CHECK_ACCESS(this_ptr_ptr);
38062         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
38063         FREE(untag_ptr(this_ptr));
38064         MonitorEvent_free(this_ptr_conv);
38065 }
38066
38067 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
38068         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
38069         *ret_copy = MonitorEvent_clone(arg);
38070         int64_t ret_ref = tag_ptr(ret_copy, true);
38071         return ret_ref;
38072 }
38073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38074         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
38075         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
38076         return ret_conv;
38077 }
38078
38079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38080         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
38081         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
38082         *ret_copy = MonitorEvent_clone(orig_conv);
38083         int64_t ret_ref = tag_ptr(ret_copy, true);
38084         return ret_ref;
38085 }
38086
38087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
38088         LDKHTLCUpdate a_conv;
38089         a_conv.inner = untag_ptr(a);
38090         a_conv.is_owned = ptr_is_owned(a);
38091         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38092         a_conv = HTLCUpdate_clone(&a_conv);
38093         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
38094         *ret_copy = MonitorEvent_htlcevent(a_conv);
38095         int64_t ret_ref = tag_ptr(ret_copy, true);
38096         return ret_ref;
38097 }
38098
38099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1holder_1force_1closed(JNIEnv *env, jclass clz, int64_t a) {
38100         LDKOutPoint a_conv;
38101         a_conv.inner = untag_ptr(a);
38102         a_conv.is_owned = ptr_is_owned(a);
38103         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38104         a_conv = OutPoint_clone(&a_conv);
38105         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
38106         *ret_copy = MonitorEvent_holder_force_closed(a_conv);
38107         int64_t ret_ref = tag_ptr(ret_copy, true);
38108         return ret_ref;
38109 }
38110
38111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1completed(JNIEnv *env, jclass clz, int64_t funding_txo, int64_t monitor_update_id) {
38112         LDKOutPoint funding_txo_conv;
38113         funding_txo_conv.inner = untag_ptr(funding_txo);
38114         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
38115         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
38116         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
38117         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
38118         *ret_copy = MonitorEvent_completed(funding_txo_conv, monitor_update_id);
38119         int64_t ret_ref = tag_ptr(ret_copy, true);
38120         return ret_ref;
38121 }
38122
38123 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38124         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
38125         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
38126         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
38127         return ret_conv;
38128 }
38129
38130 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1write(JNIEnv *env, jclass clz, int64_t obj) {
38131         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
38132         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
38133         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38134         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38135         CVec_u8Z_free(ret_var);
38136         return ret_arr;
38137 }
38138
38139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38140         LDKu8slice ser_ref;
38141         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38142         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38143         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
38144         *ret_conv = MonitorEvent_read(ser_ref);
38145         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38146         return tag_ptr(ret_conv, true);
38147 }
38148
38149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38150         LDKHTLCUpdate this_obj_conv;
38151         this_obj_conv.inner = untag_ptr(this_obj);
38152         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38154         HTLCUpdate_free(this_obj_conv);
38155 }
38156
38157 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
38158         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
38159         int64_t ret_ref = 0;
38160         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38161         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38162         return ret_ref;
38163 }
38164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38165         LDKHTLCUpdate arg_conv;
38166         arg_conv.inner = untag_ptr(arg);
38167         arg_conv.is_owned = ptr_is_owned(arg);
38168         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38169         arg_conv.is_owned = false;
38170         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
38171         return ret_conv;
38172 }
38173
38174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38175         LDKHTLCUpdate orig_conv;
38176         orig_conv.inner = untag_ptr(orig);
38177         orig_conv.is_owned = ptr_is_owned(orig);
38178         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38179         orig_conv.is_owned = false;
38180         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
38181         int64_t ret_ref = 0;
38182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38184         return ret_ref;
38185 }
38186
38187 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38188         LDKHTLCUpdate a_conv;
38189         a_conv.inner = untag_ptr(a);
38190         a_conv.is_owned = ptr_is_owned(a);
38191         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38192         a_conv.is_owned = false;
38193         LDKHTLCUpdate b_conv;
38194         b_conv.inner = untag_ptr(b);
38195         b_conv.is_owned = ptr_is_owned(b);
38196         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38197         b_conv.is_owned = false;
38198         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
38199         return ret_conv;
38200 }
38201
38202 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
38203         LDKHTLCUpdate obj_conv;
38204         obj_conv.inner = untag_ptr(obj);
38205         obj_conv.is_owned = ptr_is_owned(obj);
38206         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38207         obj_conv.is_owned = false;
38208         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
38209         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38210         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38211         CVec_u8Z_free(ret_var);
38212         return ret_arr;
38213 }
38214
38215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38216         LDKu8slice ser_ref;
38217         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38218         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38219         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
38220         *ret_conv = HTLCUpdate_read(ser_ref);
38221         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38222         return tag_ptr(ret_conv, true);
38223 }
38224
38225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
38226         if (!ptr_is_owned(this_ptr)) return;
38227         void* this_ptr_ptr = untag_ptr(this_ptr);
38228         CHECK_ACCESS(this_ptr_ptr);
38229         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
38230         FREE(untag_ptr(this_ptr));
38231         Balance_free(this_ptr_conv);
38232 }
38233
38234 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
38235         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38236         *ret_copy = Balance_clone(arg);
38237         int64_t ret_ref = tag_ptr(ret_copy, true);
38238         return ret_ref;
38239 }
38240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38241         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
38242         int64_t ret_conv = Balance_clone_ptr(arg_conv);
38243         return ret_conv;
38244 }
38245
38246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38247         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
38248         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38249         *ret_copy = Balance_clone(orig_conv);
38250         int64_t ret_ref = tag_ptr(ret_copy, true);
38251         return ret_ref;
38252 }
38253
38254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t amount_satoshis) {
38255         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38256         *ret_copy = Balance_claimable_on_channel_close(amount_satoshis);
38257         int64_t ret_ref = tag_ptr(ret_copy, true);
38258         return ret_ref;
38259 }
38260
38261 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) {
38262         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38263         *ret_copy = Balance_claimable_awaiting_confirmations(amount_satoshis, confirmation_height);
38264         int64_t ret_ref = tag_ptr(ret_copy, true);
38265         return ret_ref;
38266 }
38267
38268 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) {
38269         LDKThirtyTwoBytes payment_hash_ref;
38270         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
38271         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
38272         LDKThirtyTwoBytes payment_preimage_ref;
38273         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
38274         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
38275         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38276         *ret_copy = Balance_contentious_claimable(amount_satoshis, timeout_height, payment_hash_ref, payment_preimage_ref);
38277         int64_t ret_ref = tag_ptr(ret_copy, true);
38278         return ret_ref;
38279 }
38280
38281 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) {
38282         LDKThirtyTwoBytes payment_hash_ref;
38283         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
38284         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
38285         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38286         *ret_copy = Balance_maybe_timeout_claimable_htlc(amount_satoshis, claimable_height, payment_hash_ref);
38287         int64_t ret_ref = tag_ptr(ret_copy, true);
38288         return ret_ref;
38289 }
38290
38291 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) {
38292         LDKThirtyTwoBytes payment_hash_ref;
38293         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
38294         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
38295         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38296         *ret_copy = Balance_maybe_preimage_claimable_htlc(amount_satoshis, expiry_height, payment_hash_ref);
38297         int64_t ret_ref = tag_ptr(ret_copy, true);
38298         return ret_ref;
38299 }
38300
38301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1counterparty_1revoked_1output_1claimable(JNIEnv *env, jclass clz, int64_t amount_satoshis) {
38302         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38303         *ret_copy = Balance_counterparty_revoked_output_claimable(amount_satoshis);
38304         int64_t ret_ref = tag_ptr(ret_copy, true);
38305         return ret_ref;
38306 }
38307
38308 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38309         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
38310         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
38311         jboolean ret_conv = Balance_eq(a_conv, b_conv);
38312         return ret_conv;
38313 }
38314
38315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1amount_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
38316         LDKBalance* this_arg_conv = (LDKBalance*)untag_ptr(this_arg);
38317         int64_t ret_conv = Balance_claimable_amount_satoshis(this_arg_conv);
38318         return ret_conv;
38319 }
38320
38321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38322         LDKChannelMonitor this_obj_conv;
38323         this_obj_conv.inner = untag_ptr(this_obj);
38324         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38326         ChannelMonitor_free(this_obj_conv);
38327 }
38328
38329 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
38330         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
38331         int64_t ret_ref = 0;
38332         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38333         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38334         return ret_ref;
38335 }
38336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38337         LDKChannelMonitor arg_conv;
38338         arg_conv.inner = untag_ptr(arg);
38339         arg_conv.is_owned = ptr_is_owned(arg);
38340         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38341         arg_conv.is_owned = false;
38342         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
38343         return ret_conv;
38344 }
38345
38346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38347         LDKChannelMonitor orig_conv;
38348         orig_conv.inner = untag_ptr(orig);
38349         orig_conv.is_owned = ptr_is_owned(orig);
38350         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38351         orig_conv.is_owned = false;
38352         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
38353         int64_t ret_ref = 0;
38354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38356         return ret_ref;
38357 }
38358
38359 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
38360         LDKChannelMonitor obj_conv;
38361         obj_conv.inner = untag_ptr(obj);
38362         obj_conv.is_owned = ptr_is_owned(obj);
38363         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38364         obj_conv.is_owned = false;
38365         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
38366         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38367         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38368         CVec_u8Z_free(ret_var);
38369         return ret_arr;
38370 }
38371
38372 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) {
38373         LDKChannelMonitor this_arg_conv;
38374         this_arg_conv.inner = untag_ptr(this_arg);
38375         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38377         this_arg_conv.is_owned = false;
38378         LDKChannelMonitorUpdate updates_conv;
38379         updates_conv.inner = untag_ptr(updates);
38380         updates_conv.is_owned = ptr_is_owned(updates);
38381         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
38382         updates_conv.is_owned = false;
38383         void* broadcaster_ptr = untag_ptr(broadcaster);
38384         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
38385         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
38386         void* fee_estimator_ptr = untag_ptr(fee_estimator);
38387         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
38388         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
38389         void* logger_ptr = untag_ptr(logger);
38390         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
38391         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
38392         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
38393         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
38394         return tag_ptr(ret_conv, true);
38395 }
38396
38397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
38398         LDKChannelMonitor this_arg_conv;
38399         this_arg_conv.inner = untag_ptr(this_arg);
38400         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38402         this_arg_conv.is_owned = false;
38403         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
38404         return ret_conv;
38405 }
38406
38407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
38408         LDKChannelMonitor this_arg_conv;
38409         this_arg_conv.inner = untag_ptr(this_arg);
38410         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38412         this_arg_conv.is_owned = false;
38413         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
38414         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
38415         return tag_ptr(ret_conv, true);
38416 }
38417
38418 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
38419         LDKChannelMonitor this_arg_conv;
38420         this_arg_conv.inner = untag_ptr(this_arg);
38421         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38423         this_arg_conv.is_owned = false;
38424         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
38425         int64_tArray ret_arr = NULL;
38426         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38427         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38428         for (size_t a = 0; a < ret_var.datalen; a++) {
38429                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv_52_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
38430                 *ret_conv_52_conv = ret_var.data[a];
38431                 ret_arr_ptr[a] = tag_ptr(ret_conv_52_conv, true);
38432         }
38433         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38434         FREE(ret_var.data);
38435         return ret_arr;
38436 }
38437
38438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
38439         LDKChannelMonitor this_arg_conv;
38440         this_arg_conv.inner = untag_ptr(this_arg);
38441         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38443         this_arg_conv.is_owned = false;
38444         void* filter_ptr = untag_ptr(filter);
38445         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
38446         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
38447         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
38448 }
38449
38450 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
38451         LDKChannelMonitor this_arg_conv;
38452         this_arg_conv.inner = untag_ptr(this_arg);
38453         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38455         this_arg_conv.is_owned = false;
38456         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
38457         int64_tArray ret_arr = NULL;
38458         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38459         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38460         for (size_t o = 0; o < ret_var.datalen; o++) {
38461                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
38462                 *ret_conv_14_copy = ret_var.data[o];
38463                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
38464                 ret_arr_ptr[o] = ret_conv_14_ref;
38465         }
38466         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38467         FREE(ret_var.data);
38468         return ret_arr;
38469 }
38470
38471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
38472         LDKChannelMonitor this_arg_conv;
38473         this_arg_conv.inner = untag_ptr(this_arg);
38474         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38476         this_arg_conv.is_owned = false;
38477         void* handler_ptr = untag_ptr(handler);
38478         if (ptr_is_owned(handler)) { CHECK_ACCESS(handler_ptr); }
38479         LDKEventHandler* handler_conv = (LDKEventHandler*)handler_ptr;
38480         ChannelMonitor_process_pending_events(&this_arg_conv, handler_conv);
38481 }
38482
38483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1initial_1counterparty_1commitment_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
38484         LDKChannelMonitor this_arg_conv;
38485         this_arg_conv.inner = untag_ptr(this_arg);
38486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38488         this_arg_conv.is_owned = false;
38489         LDKCommitmentTransaction ret_var = ChannelMonitor_initial_counterparty_commitment_tx(&this_arg_conv);
38490         int64_t ret_ref = 0;
38491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38493         return ret_ref;
38494 }
38495
38496 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) {
38497         LDKChannelMonitor this_arg_conv;
38498         this_arg_conv.inner = untag_ptr(this_arg);
38499         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38501         this_arg_conv.is_owned = false;
38502         LDKChannelMonitorUpdate update_conv;
38503         update_conv.inner = untag_ptr(update);
38504         update_conv.is_owned = ptr_is_owned(update);
38505         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
38506         update_conv.is_owned = false;
38507         LDKCVec_CommitmentTransactionZ ret_var = ChannelMonitor_counterparty_commitment_txs_from_update(&this_arg_conv, &update_conv);
38508         int64_tArray ret_arr = NULL;
38509         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38510         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38511         for (size_t x = 0; x < ret_var.datalen; x++) {
38512                 LDKCommitmentTransaction ret_conv_23_var = ret_var.data[x];
38513                 int64_t ret_conv_23_ref = 0;
38514                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_23_var);
38515                 ret_conv_23_ref = tag_ptr(ret_conv_23_var.inner, ret_conv_23_var.is_owned);
38516                 ret_arr_ptr[x] = ret_conv_23_ref;
38517         }
38518         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38519         FREE(ret_var.data);
38520         return ret_arr;
38521 }
38522
38523 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) {
38524         LDKChannelMonitor this_arg_conv;
38525         this_arg_conv.inner = untag_ptr(this_arg);
38526         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38528         this_arg_conv.is_owned = false;
38529         LDKTransaction justice_tx_ref;
38530         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
38531         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
38532         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
38533         justice_tx_ref.data_is_owned = true;
38534         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
38535         *ret_conv = ChannelMonitor_sign_to_local_justice_tx(&this_arg_conv, justice_tx_ref, input_idx, value, commitment_number);
38536         return tag_ptr(ret_conv, true);
38537 }
38538
38539 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1counterparty_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
38540         LDKChannelMonitor this_arg_conv;
38541         this_arg_conv.inner = untag_ptr(this_arg);
38542         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38544         this_arg_conv.is_owned = false;
38545         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
38546         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form);
38547         return ret_arr;
38548 }
38549
38550 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) {
38551         LDKChannelMonitor this_arg_conv;
38552         this_arg_conv.inner = untag_ptr(this_arg);
38553         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38555         this_arg_conv.is_owned = false;
38556         void* logger_ptr = untag_ptr(logger);
38557         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
38558         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
38559         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
38560         jobjectArray ret_arr = NULL;
38561         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
38562         ;
38563         for (size_t i = 0; i < ret_var.datalen; i++) {
38564                 LDKTransaction ret_conv_8_var = ret_var.data[i];
38565                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
38566                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
38567                 Transaction_free(ret_conv_8_var);
38568                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
38569         }
38570         
38571         FREE(ret_var.data);
38572         return ret_arr;
38573 }
38574
38575 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) {
38576         LDKChannelMonitor this_arg_conv;
38577         this_arg_conv.inner = untag_ptr(this_arg);
38578         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38580         this_arg_conv.is_owned = false;
38581         uint8_t header_arr[80];
38582         CHECK((*env)->GetArrayLength(env, header) == 80);
38583         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
38584         uint8_t (*header_ref)[80] = &header_arr;
38585         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
38586         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
38587         if (txdata_constr.datalen > 0)
38588                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
38589         else
38590                 txdata_constr.data = NULL;
38591         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
38592         for (size_t c = 0; c < txdata_constr.datalen; c++) {
38593                 int64_t txdata_conv_28 = txdata_vals[c];
38594                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
38595                 CHECK_ACCESS(txdata_conv_28_ptr);
38596                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
38597                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
38598                 txdata_constr.data[c] = txdata_conv_28_conv;
38599         }
38600         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
38601         void* broadcaster_ptr = untag_ptr(broadcaster);
38602         CHECK_ACCESS(broadcaster_ptr);
38603         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
38604         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38605                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38606                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
38607         }
38608         void* fee_estimator_ptr = untag_ptr(fee_estimator);
38609         CHECK_ACCESS(fee_estimator_ptr);
38610         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
38611         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
38612                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38613                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
38614         }
38615         void* logger_ptr = untag_ptr(logger);
38616         CHECK_ACCESS(logger_ptr);
38617         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38618         if (logger_conv.free == LDKLogger_JCalls_free) {
38619                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38620                 LDKLogger_JCalls_cloned(&logger_conv);
38621         }
38622         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);
38623         int64_tArray ret_arr = NULL;
38624         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38625         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38626         for (size_t x = 0; x < ret_var.datalen; x++) {
38627                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
38628                 *ret_conv_49_conv = ret_var.data[x];
38629                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
38630         }
38631         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38632         FREE(ret_var.data);
38633         return ret_arr;
38634 }
38635
38636 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) {
38637         LDKChannelMonitor this_arg_conv;
38638         this_arg_conv.inner = untag_ptr(this_arg);
38639         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38641         this_arg_conv.is_owned = false;
38642         uint8_t header_arr[80];
38643         CHECK((*env)->GetArrayLength(env, header) == 80);
38644         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
38645         uint8_t (*header_ref)[80] = &header_arr;
38646         void* broadcaster_ptr = untag_ptr(broadcaster);
38647         CHECK_ACCESS(broadcaster_ptr);
38648         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
38649         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38650                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38651                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
38652         }
38653         void* fee_estimator_ptr = untag_ptr(fee_estimator);
38654         CHECK_ACCESS(fee_estimator_ptr);
38655         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
38656         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
38657                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38658                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
38659         }
38660         void* logger_ptr = untag_ptr(logger);
38661         CHECK_ACCESS(logger_ptr);
38662         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38663         if (logger_conv.free == LDKLogger_JCalls_free) {
38664                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38665                 LDKLogger_JCalls_cloned(&logger_conv);
38666         }
38667         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
38668 }
38669
38670 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) {
38671         LDKChannelMonitor this_arg_conv;
38672         this_arg_conv.inner = untag_ptr(this_arg);
38673         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38675         this_arg_conv.is_owned = false;
38676         uint8_t header_arr[80];
38677         CHECK((*env)->GetArrayLength(env, header) == 80);
38678         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
38679         uint8_t (*header_ref)[80] = &header_arr;
38680         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
38681         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
38682         if (txdata_constr.datalen > 0)
38683                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
38684         else
38685                 txdata_constr.data = NULL;
38686         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
38687         for (size_t c = 0; c < txdata_constr.datalen; c++) {
38688                 int64_t txdata_conv_28 = txdata_vals[c];
38689                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
38690                 CHECK_ACCESS(txdata_conv_28_ptr);
38691                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
38692                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
38693                 txdata_constr.data[c] = txdata_conv_28_conv;
38694         }
38695         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
38696         void* broadcaster_ptr = untag_ptr(broadcaster);
38697         CHECK_ACCESS(broadcaster_ptr);
38698         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
38699         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38700                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38701                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
38702         }
38703         void* fee_estimator_ptr = untag_ptr(fee_estimator);
38704         CHECK_ACCESS(fee_estimator_ptr);
38705         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
38706         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
38707                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38708                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
38709         }
38710         void* logger_ptr = untag_ptr(logger);
38711         CHECK_ACCESS(logger_ptr);
38712         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38713         if (logger_conv.free == LDKLogger_JCalls_free) {
38714                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38715                 LDKLogger_JCalls_cloned(&logger_conv);
38716         }
38717         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);
38718         int64_tArray ret_arr = NULL;
38719         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38720         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38721         for (size_t x = 0; x < ret_var.datalen; x++) {
38722                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
38723                 *ret_conv_49_conv = ret_var.data[x];
38724                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
38725         }
38726         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38727         FREE(ret_var.data);
38728         return ret_arr;
38729 }
38730
38731 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) {
38732         LDKChannelMonitor this_arg_conv;
38733         this_arg_conv.inner = untag_ptr(this_arg);
38734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38736         this_arg_conv.is_owned = false;
38737         uint8_t txid_arr[32];
38738         CHECK((*env)->GetArrayLength(env, txid) == 32);
38739         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
38740         uint8_t (*txid_ref)[32] = &txid_arr;
38741         void* broadcaster_ptr = untag_ptr(broadcaster);
38742         CHECK_ACCESS(broadcaster_ptr);
38743         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
38744         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38745                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38746                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
38747         }
38748         void* fee_estimator_ptr = untag_ptr(fee_estimator);
38749         CHECK_ACCESS(fee_estimator_ptr);
38750         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
38751         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
38752                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38753                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
38754         }
38755         void* logger_ptr = untag_ptr(logger);
38756         CHECK_ACCESS(logger_ptr);
38757         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38758         if (logger_conv.free == LDKLogger_JCalls_free) {
38759                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38760                 LDKLogger_JCalls_cloned(&logger_conv);
38761         }
38762         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
38763 }
38764
38765 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) {
38766         LDKChannelMonitor this_arg_conv;
38767         this_arg_conv.inner = untag_ptr(this_arg);
38768         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38770         this_arg_conv.is_owned = false;
38771         uint8_t header_arr[80];
38772         CHECK((*env)->GetArrayLength(env, header) == 80);
38773         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
38774         uint8_t (*header_ref)[80] = &header_arr;
38775         void* broadcaster_ptr = untag_ptr(broadcaster);
38776         CHECK_ACCESS(broadcaster_ptr);
38777         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
38778         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38779                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38780                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
38781         }
38782         void* fee_estimator_ptr = untag_ptr(fee_estimator);
38783         CHECK_ACCESS(fee_estimator_ptr);
38784         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
38785         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
38786                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38787                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
38788         }
38789         void* logger_ptr = untag_ptr(logger);
38790         CHECK_ACCESS(logger_ptr);
38791         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38792         if (logger_conv.free == LDKLogger_JCalls_free) {
38793                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38794                 LDKLogger_JCalls_cloned(&logger_conv);
38795         }
38796         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
38797         int64_tArray ret_arr = NULL;
38798         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38799         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38800         for (size_t x = 0; x < ret_var.datalen; x++) {
38801                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
38802                 *ret_conv_49_conv = ret_var.data[x];
38803                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
38804         }
38805         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38806         FREE(ret_var.data);
38807         return ret_arr;
38808 }
38809
38810 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
38811         LDKChannelMonitor this_arg_conv;
38812         this_arg_conv.inner = untag_ptr(this_arg);
38813         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38815         this_arg_conv.is_owned = false;
38816         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
38817         int64_tArray ret_arr = NULL;
38818         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38819         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38820         for (size_t x = 0; x < ret_var.datalen; x++) {
38821                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
38822                 *ret_conv_49_conv = ret_var.data[x];
38823                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
38824         }
38825         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38826         FREE(ret_var.data);
38827         return ret_arr;
38828 }
38829
38830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
38831         LDKChannelMonitor this_arg_conv;
38832         this_arg_conv.inner = untag_ptr(this_arg);
38833         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38835         this_arg_conv.is_owned = false;
38836         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
38837         int64_t ret_ref = 0;
38838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38840         return ret_ref;
38841 }
38842
38843 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) {
38844         LDKChannelMonitor this_arg_conv;
38845         this_arg_conv.inner = untag_ptr(this_arg);
38846         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38848         this_arg_conv.is_owned = false;
38849         void* broadcaster_ptr = untag_ptr(broadcaster);
38850         CHECK_ACCESS(broadcaster_ptr);
38851         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
38852         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38853                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38854                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
38855         }
38856         void* fee_estimator_ptr = untag_ptr(fee_estimator);
38857         CHECK_ACCESS(fee_estimator_ptr);
38858         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
38859         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
38860                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38861                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
38862         }
38863         void* logger_ptr = untag_ptr(logger);
38864         CHECK_ACCESS(logger_ptr);
38865         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38866         if (logger_conv.free == LDKLogger_JCalls_free) {
38867                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38868                 LDKLogger_JCalls_cloned(&logger_conv);
38869         }
38870         ChannelMonitor_rebroadcast_pending_claims(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
38871 }
38872
38873 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) {
38874         LDKChannelMonitor this_arg_conv;
38875         this_arg_conv.inner = untag_ptr(this_arg);
38876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38878         this_arg_conv.is_owned = false;
38879         LDKTransaction tx_ref;
38880         tx_ref.datalen = (*env)->GetArrayLength(env, tx);
38881         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
38882         (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
38883         tx_ref.data_is_owned = true;
38884         LDKCVec_SpendableOutputDescriptorZ ret_var = ChannelMonitor_get_spendable_outputs(&this_arg_conv, tx_ref, confirmation_height);
38885         int64_tArray ret_arr = NULL;
38886         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38887         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38888         for (size_t b = 0; b < ret_var.datalen; b++) {
38889                 LDKSpendableOutputDescriptor *ret_conv_27_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
38890                 *ret_conv_27_copy = ret_var.data[b];
38891                 int64_t ret_conv_27_ref = tag_ptr(ret_conv_27_copy, true);
38892                 ret_arr_ptr[b] = ret_conv_27_ref;
38893         }
38894         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38895         FREE(ret_var.data);
38896         return ret_arr;
38897 }
38898
38899 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
38900         LDKChannelMonitor this_arg_conv;
38901         this_arg_conv.inner = untag_ptr(this_arg);
38902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38904         this_arg_conv.is_owned = false;
38905         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
38906         int64_tArray ret_arr = NULL;
38907         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38908         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38909         for (size_t j = 0; j < ret_var.datalen; j++) {
38910                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38911                 *ret_conv_9_copy = ret_var.data[j];
38912                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
38913                 ret_arr_ptr[j] = ret_conv_9_ref;
38914         }
38915         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38916         FREE(ret_var.data);
38917         return ret_arr;
38918 }
38919
38920 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) {
38921         LDKu8slice ser_ref;
38922         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38923         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38924         void* arg_a_ptr = untag_ptr(arg_a);
38925         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
38926         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
38927         void* arg_b_ptr = untag_ptr(arg_b);
38928         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
38929         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
38930         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
38931         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
38932         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38933         return tag_ptr(ret_conv, true);
38934 }
38935
38936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38937         LDKOutPoint this_obj_conv;
38938         this_obj_conv.inner = untag_ptr(this_obj);
38939         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38941         OutPoint_free(this_obj_conv);
38942 }
38943
38944 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
38945         LDKOutPoint this_ptr_conv;
38946         this_ptr_conv.inner = untag_ptr(this_ptr);
38947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38949         this_ptr_conv.is_owned = false;
38950         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38951         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
38952         return ret_arr;
38953 }
38954
38955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38956         LDKOutPoint this_ptr_conv;
38957         this_ptr_conv.inner = untag_ptr(this_ptr);
38958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38960         this_ptr_conv.is_owned = false;
38961         LDKThirtyTwoBytes val_ref;
38962         CHECK((*env)->GetArrayLength(env, val) == 32);
38963         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
38964         OutPoint_set_txid(&this_ptr_conv, val_ref);
38965 }
38966
38967 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
38968         LDKOutPoint this_ptr_conv;
38969         this_ptr_conv.inner = untag_ptr(this_ptr);
38970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38972         this_ptr_conv.is_owned = false;
38973         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
38974         return ret_conv;
38975 }
38976
38977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
38978         LDKOutPoint this_ptr_conv;
38979         this_ptr_conv.inner = untag_ptr(this_ptr);
38980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38982         this_ptr_conv.is_owned = false;
38983         OutPoint_set_index(&this_ptr_conv, val);
38984 }
38985
38986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
38987         LDKThirtyTwoBytes txid_arg_ref;
38988         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
38989         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
38990         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
38991         int64_t ret_ref = 0;
38992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38994         return ret_ref;
38995 }
38996
38997 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
38998         LDKOutPoint ret_var = OutPoint_clone(arg);
38999         int64_t ret_ref = 0;
39000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39002         return ret_ref;
39003 }
39004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39005         LDKOutPoint arg_conv;
39006         arg_conv.inner = untag_ptr(arg);
39007         arg_conv.is_owned = ptr_is_owned(arg);
39008         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39009         arg_conv.is_owned = false;
39010         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
39011         return ret_conv;
39012 }
39013
39014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39015         LDKOutPoint orig_conv;
39016         orig_conv.inner = untag_ptr(orig);
39017         orig_conv.is_owned = ptr_is_owned(orig);
39018         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39019         orig_conv.is_owned = false;
39020         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
39021         int64_t ret_ref = 0;
39022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39024         return ret_ref;
39025 }
39026
39027 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39028         LDKOutPoint a_conv;
39029         a_conv.inner = untag_ptr(a);
39030         a_conv.is_owned = ptr_is_owned(a);
39031         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39032         a_conv.is_owned = false;
39033         LDKOutPoint b_conv;
39034         b_conv.inner = untag_ptr(b);
39035         b_conv.is_owned = ptr_is_owned(b);
39036         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39037         b_conv.is_owned = false;
39038         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
39039         return ret_conv;
39040 }
39041
39042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
39043         LDKOutPoint o_conv;
39044         o_conv.inner = untag_ptr(o);
39045         o_conv.is_owned = ptr_is_owned(o);
39046         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39047         o_conv.is_owned = false;
39048         int64_t ret_conv = OutPoint_hash(&o_conv);
39049         return ret_conv;
39050 }
39051
39052 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
39053         LDKOutPoint this_arg_conv;
39054         this_arg_conv.inner = untag_ptr(this_arg);
39055         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39057         this_arg_conv.is_owned = false;
39058         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39059         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
39060         return ret_arr;
39061 }
39062
39063 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
39064         LDKOutPoint obj_conv;
39065         obj_conv.inner = untag_ptr(obj);
39066         obj_conv.is_owned = ptr_is_owned(obj);
39067         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39068         obj_conv.is_owned = false;
39069         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
39070         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39071         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39072         CVec_u8Z_free(ret_var);
39073         return ret_arr;
39074 }
39075
39076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39077         LDKu8slice ser_ref;
39078         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39079         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39080         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
39081         *ret_conv = OutPoint_read(ser_ref);
39082         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39083         return tag_ptr(ret_conv, true);
39084 }
39085
39086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FailureCode_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
39087         if (!ptr_is_owned(this_ptr)) return;
39088         void* this_ptr_ptr = untag_ptr(this_ptr);
39089         CHECK_ACCESS(this_ptr_ptr);
39090         LDKFailureCode this_ptr_conv = *(LDKFailureCode*)(this_ptr_ptr);
39091         FREE(untag_ptr(this_ptr));
39092         FailureCode_free(this_ptr_conv);
39093 }
39094
39095 static inline uint64_t FailureCode_clone_ptr(LDKFailureCode *NONNULL_PTR arg) {
39096         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
39097         *ret_copy = FailureCode_clone(arg);
39098         int64_t ret_ref = tag_ptr(ret_copy, true);
39099         return ret_ref;
39100 }
39101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39102         LDKFailureCode* arg_conv = (LDKFailureCode*)untag_ptr(arg);
39103         int64_t ret_conv = FailureCode_clone_ptr(arg_conv);
39104         return ret_conv;
39105 }
39106
39107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39108         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
39109         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
39110         *ret_copy = FailureCode_clone(orig_conv);
39111         int64_t ret_ref = tag_ptr(ret_copy, true);
39112         return ret_ref;
39113 }
39114
39115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1temporary_1node_1failure(JNIEnv *env, jclass clz) {
39116         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
39117         *ret_copy = FailureCode_temporary_node_failure();
39118         int64_t ret_ref = tag_ptr(ret_copy, true);
39119         return ret_ref;
39120 }
39121
39122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1required_1node_1feature_1missing(JNIEnv *env, jclass clz) {
39123         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
39124         *ret_copy = FailureCode_required_node_feature_missing();
39125         int64_t ret_ref = tag_ptr(ret_copy, true);
39126         return ret_ref;
39127 }
39128
39129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1incorrect_1or_1unknown_1payment_1details(JNIEnv *env, jclass clz) {
39130         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
39131         *ret_copy = FailureCode_incorrect_or_unknown_payment_details();
39132         int64_t ret_ref = tag_ptr(ret_copy, true);
39133         return ret_ref;
39134 }
39135
39136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1invalid_1onion_1payload(JNIEnv *env, jclass clz, int64_t a) {
39137         void* a_ptr = untag_ptr(a);
39138         CHECK_ACCESS(a_ptr);
39139         LDKCOption_C2Tuple_u64u16ZZ a_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(a_ptr);
39140         a_conv = COption_C2Tuple_u64u16ZZ_clone((LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(a));
39141         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
39142         *ret_copy = FailureCode_invalid_onion_payload(a_conv);
39143         int64_t ret_ref = tag_ptr(ret_copy, true);
39144         return ret_ref;
39145 }
39146
39147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39148         LDKChannelManager this_obj_conv;
39149         this_obj_conv.inner = untag_ptr(this_obj);
39150         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39152         ChannelManager_free(this_obj_conv);
39153 }
39154
39155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39156         LDKChainParameters this_obj_conv;
39157         this_obj_conv.inner = untag_ptr(this_obj);
39158         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39160         ChainParameters_free(this_obj_conv);
39161 }
39162
39163 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
39164         LDKChainParameters this_ptr_conv;
39165         this_ptr_conv.inner = untag_ptr(this_ptr);
39166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39168         this_ptr_conv.is_owned = false;
39169         jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
39170         return ret_conv;
39171 }
39172
39173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
39174         LDKChainParameters this_ptr_conv;
39175         this_ptr_conv.inner = untag_ptr(this_ptr);
39176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39178         this_ptr_conv.is_owned = false;
39179         LDKNetwork val_conv = LDKNetwork_from_java(env, val);
39180         ChainParameters_set_network(&this_ptr_conv, val_conv);
39181 }
39182
39183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
39184         LDKChainParameters this_ptr_conv;
39185         this_ptr_conv.inner = untag_ptr(this_ptr);
39186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39188         this_ptr_conv.is_owned = false;
39189         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
39190         int64_t ret_ref = 0;
39191         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39192         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39193         return ret_ref;
39194 }
39195
39196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39197         LDKChainParameters this_ptr_conv;
39198         this_ptr_conv.inner = untag_ptr(this_ptr);
39199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39201         this_ptr_conv.is_owned = false;
39202         LDKBestBlock val_conv;
39203         val_conv.inner = untag_ptr(val);
39204         val_conv.is_owned = ptr_is_owned(val);
39205         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39206         val_conv = BestBlock_clone(&val_conv);
39207         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
39208 }
39209
39210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
39211         LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
39212         LDKBestBlock best_block_arg_conv;
39213         best_block_arg_conv.inner = untag_ptr(best_block_arg);
39214         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
39215         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
39216         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
39217         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
39218         int64_t ret_ref = 0;
39219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39221         return ret_ref;
39222 }
39223
39224 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
39225         LDKChainParameters ret_var = ChainParameters_clone(arg);
39226         int64_t ret_ref = 0;
39227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39229         return ret_ref;
39230 }
39231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39232         LDKChainParameters arg_conv;
39233         arg_conv.inner = untag_ptr(arg);
39234         arg_conv.is_owned = ptr_is_owned(arg);
39235         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39236         arg_conv.is_owned = false;
39237         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
39238         return ret_conv;
39239 }
39240
39241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39242         LDKChainParameters orig_conv;
39243         orig_conv.inner = untag_ptr(orig);
39244         orig_conv.is_owned = ptr_is_owned(orig);
39245         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39246         orig_conv.is_owned = false;
39247         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
39248         int64_t ret_ref = 0;
39249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39250         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39251         return ret_ref;
39252 }
39253
39254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39255         LDKCounterpartyForwardingInfo this_obj_conv;
39256         this_obj_conv.inner = untag_ptr(this_obj);
39257         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39259         CounterpartyForwardingInfo_free(this_obj_conv);
39260 }
39261
39262 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39263         LDKCounterpartyForwardingInfo this_ptr_conv;
39264         this_ptr_conv.inner = untag_ptr(this_ptr);
39265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39267         this_ptr_conv.is_owned = false;
39268         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
39269         return ret_conv;
39270 }
39271
39272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
39273         LDKCounterpartyForwardingInfo this_ptr_conv;
39274         this_ptr_conv.inner = untag_ptr(this_ptr);
39275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39277         this_ptr_conv.is_owned = false;
39278         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
39279 }
39280
39281 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
39282         LDKCounterpartyForwardingInfo 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         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
39288         return ret_conv;
39289 }
39290
39291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
39292         LDKCounterpartyForwardingInfo 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         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
39298 }
39299
39300 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
39301         LDKCounterpartyForwardingInfo 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         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
39307         return ret_conv;
39308 }
39309
39310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
39311         LDKCounterpartyForwardingInfo 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         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
39317 }
39318
39319 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) {
39320         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
39321         int64_t ret_ref = 0;
39322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39324         return ret_ref;
39325 }
39326
39327 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
39328         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
39329         int64_t ret_ref = 0;
39330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39332         return ret_ref;
39333 }
39334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39335         LDKCounterpartyForwardingInfo arg_conv;
39336         arg_conv.inner = untag_ptr(arg);
39337         arg_conv.is_owned = ptr_is_owned(arg);
39338         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39339         arg_conv.is_owned = false;
39340         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
39341         return ret_conv;
39342 }
39343
39344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39345         LDKCounterpartyForwardingInfo orig_conv;
39346         orig_conv.inner = untag_ptr(orig);
39347         orig_conv.is_owned = ptr_is_owned(orig);
39348         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39349         orig_conv.is_owned = false;
39350         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
39351         int64_t ret_ref = 0;
39352         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39353         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39354         return ret_ref;
39355 }
39356
39357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39358         LDKChannelCounterparty this_obj_conv;
39359         this_obj_conv.inner = untag_ptr(this_obj);
39360         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39362         ChannelCounterparty_free(this_obj_conv);
39363 }
39364
39365 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
39366         LDKChannelCounterparty this_ptr_conv;
39367         this_ptr_conv.inner = untag_ptr(this_ptr);
39368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39370         this_ptr_conv.is_owned = false;
39371         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39372         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
39373         return ret_arr;
39374 }
39375
39376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39377         LDKChannelCounterparty 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         LDKPublicKey val_ref;
39383         CHECK((*env)->GetArrayLength(env, val) == 33);
39384         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39385         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
39386 }
39387
39388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
39389         LDKChannelCounterparty 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         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
39395         int64_t ret_ref = 0;
39396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39398         return ret_ref;
39399 }
39400
39401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39402         LDKChannelCounterparty 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         LDKInitFeatures val_conv;
39408         val_conv.inner = untag_ptr(val);
39409         val_conv.is_owned = ptr_is_owned(val);
39410         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39411         val_conv = InitFeatures_clone(&val_conv);
39412         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
39413 }
39414
39415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
39416         LDKChannelCounterparty this_ptr_conv;
39417         this_ptr_conv.inner = untag_ptr(this_ptr);
39418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39420         this_ptr_conv.is_owned = false;
39421         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
39422         return ret_conv;
39423 }
39424
39425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39426         LDKChannelCounterparty this_ptr_conv;
39427         this_ptr_conv.inner = untag_ptr(this_ptr);
39428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39430         this_ptr_conv.is_owned = false;
39431         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
39432 }
39433
39434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
39435         LDKChannelCounterparty this_ptr_conv;
39436         this_ptr_conv.inner = untag_ptr(this_ptr);
39437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39439         this_ptr_conv.is_owned = false;
39440         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
39441         int64_t ret_ref = 0;
39442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39444         return ret_ref;
39445 }
39446
39447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39448         LDKChannelCounterparty this_ptr_conv;
39449         this_ptr_conv.inner = untag_ptr(this_ptr);
39450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39452         this_ptr_conv.is_owned = false;
39453         LDKCounterpartyForwardingInfo val_conv;
39454         val_conv.inner = untag_ptr(val);
39455         val_conv.is_owned = ptr_is_owned(val);
39456         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39457         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
39458         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
39459 }
39460
39461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39462         LDKChannelCounterparty 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         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39468         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
39469         int64_t ret_ref = tag_ptr(ret_copy, true);
39470         return ret_ref;
39471 }
39472
39473 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) {
39474         LDKChannelCounterparty this_ptr_conv;
39475         this_ptr_conv.inner = untag_ptr(this_ptr);
39476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39478         this_ptr_conv.is_owned = false;
39479         void* val_ptr = untag_ptr(val);
39480         CHECK_ACCESS(val_ptr);
39481         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39482         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39483         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
39484 }
39485
39486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39487         LDKChannelCounterparty this_ptr_conv;
39488         this_ptr_conv.inner = untag_ptr(this_ptr);
39489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39491         this_ptr_conv.is_owned = false;
39492         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39493         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
39494         int64_t ret_ref = tag_ptr(ret_copy, true);
39495         return ret_ref;
39496 }
39497
39498 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) {
39499         LDKChannelCounterparty this_ptr_conv;
39500         this_ptr_conv.inner = untag_ptr(this_ptr);
39501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39503         this_ptr_conv.is_owned = false;
39504         void* val_ptr = untag_ptr(val);
39505         CHECK_ACCESS(val_ptr);
39506         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39507         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39508         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
39509 }
39510
39511 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) {
39512         LDKPublicKey node_id_arg_ref;
39513         CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
39514         (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
39515         LDKInitFeatures features_arg_conv;
39516         features_arg_conv.inner = untag_ptr(features_arg);
39517         features_arg_conv.is_owned = ptr_is_owned(features_arg);
39518         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
39519         features_arg_conv = InitFeatures_clone(&features_arg_conv);
39520         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
39521         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
39522         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
39523         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
39524         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
39525         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
39526         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
39527         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
39528         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
39529         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
39530         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
39531         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
39532         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
39533         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);
39534         int64_t ret_ref = 0;
39535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39536         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39537         return ret_ref;
39538 }
39539
39540 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
39541         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
39542         int64_t ret_ref = 0;
39543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39545         return ret_ref;
39546 }
39547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39548         LDKChannelCounterparty arg_conv;
39549         arg_conv.inner = untag_ptr(arg);
39550         arg_conv.is_owned = ptr_is_owned(arg);
39551         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39552         arg_conv.is_owned = false;
39553         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
39554         return ret_conv;
39555 }
39556
39557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39558         LDKChannelCounterparty orig_conv;
39559         orig_conv.inner = untag_ptr(orig);
39560         orig_conv.is_owned = ptr_is_owned(orig);
39561         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39562         orig_conv.is_owned = false;
39563         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
39564         int64_t ret_ref = 0;
39565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39567         return ret_ref;
39568 }
39569
39570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39571         LDKChannelDetails this_obj_conv;
39572         this_obj_conv.inner = untag_ptr(this_obj);
39573         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39575         ChannelDetails_free(this_obj_conv);
39576 }
39577
39578 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
39579         LDKChannelDetails this_ptr_conv;
39580         this_ptr_conv.inner = untag_ptr(this_ptr);
39581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39583         this_ptr_conv.is_owned = false;
39584         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39585         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
39586         return ret_arr;
39587 }
39588
39589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray 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         LDKThirtyTwoBytes val_ref;
39596         CHECK((*env)->GetArrayLength(env, val) == 32);
39597         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
39598         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
39599 }
39600
39601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
39602         LDKChannelDetails this_ptr_conv;
39603         this_ptr_conv.inner = untag_ptr(this_ptr);
39604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39606         this_ptr_conv.is_owned = false;
39607         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
39608         int64_t ret_ref = 0;
39609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39611         return ret_ref;
39612 }
39613
39614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39615         LDKChannelDetails this_ptr_conv;
39616         this_ptr_conv.inner = untag_ptr(this_ptr);
39617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39619         this_ptr_conv.is_owned = false;
39620         LDKChannelCounterparty val_conv;
39621         val_conv.inner = untag_ptr(val);
39622         val_conv.is_owned = ptr_is_owned(val);
39623         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39624         val_conv = ChannelCounterparty_clone(&val_conv);
39625         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
39626 }
39627
39628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
39629         LDKChannelDetails this_ptr_conv;
39630         this_ptr_conv.inner = untag_ptr(this_ptr);
39631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39633         this_ptr_conv.is_owned = false;
39634         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
39635         int64_t ret_ref = 0;
39636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39638         return ret_ref;
39639 }
39640
39641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39642         LDKChannelDetails this_ptr_conv;
39643         this_ptr_conv.inner = untag_ptr(this_ptr);
39644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39646         this_ptr_conv.is_owned = false;
39647         LDKOutPoint val_conv;
39648         val_conv.inner = untag_ptr(val);
39649         val_conv.is_owned = ptr_is_owned(val);
39650         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39651         val_conv = OutPoint_clone(&val_conv);
39652         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
39653 }
39654
39655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
39656         LDKChannelDetails this_ptr_conv;
39657         this_ptr_conv.inner = untag_ptr(this_ptr);
39658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39660         this_ptr_conv.is_owned = false;
39661         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
39662         int64_t ret_ref = 0;
39663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39665         return ret_ref;
39666 }
39667
39668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39669         LDKChannelDetails this_ptr_conv;
39670         this_ptr_conv.inner = untag_ptr(this_ptr);
39671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39673         this_ptr_conv.is_owned = false;
39674         LDKChannelTypeFeatures val_conv;
39675         val_conv.inner = untag_ptr(val);
39676         val_conv.is_owned = ptr_is_owned(val);
39677         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39678         val_conv = ChannelTypeFeatures_clone(&val_conv);
39679         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
39680 }
39681
39682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
39683         LDKChannelDetails this_ptr_conv;
39684         this_ptr_conv.inner = untag_ptr(this_ptr);
39685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39687         this_ptr_conv.is_owned = false;
39688         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39689         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
39690         int64_t ret_ref = tag_ptr(ret_copy, true);
39691         return ret_ref;
39692 }
39693
39694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39695         LDKChannelDetails this_ptr_conv;
39696         this_ptr_conv.inner = untag_ptr(this_ptr);
39697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39699         this_ptr_conv.is_owned = false;
39700         void* val_ptr = untag_ptr(val);
39701         CHECK_ACCESS(val_ptr);
39702         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39703         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39704         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
39705 }
39706
39707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
39708         LDKChannelDetails this_ptr_conv;
39709         this_ptr_conv.inner = untag_ptr(this_ptr);
39710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39712         this_ptr_conv.is_owned = false;
39713         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39714         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
39715         int64_t ret_ref = tag_ptr(ret_copy, true);
39716         return ret_ref;
39717 }
39718
39719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39720         LDKChannelDetails this_ptr_conv;
39721         this_ptr_conv.inner = untag_ptr(this_ptr);
39722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39724         this_ptr_conv.is_owned = false;
39725         void* val_ptr = untag_ptr(val);
39726         CHECK_ACCESS(val_ptr);
39727         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39728         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39729         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
39730 }
39731
39732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
39733         LDKChannelDetails this_ptr_conv;
39734         this_ptr_conv.inner = untag_ptr(this_ptr);
39735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39737         this_ptr_conv.is_owned = false;
39738         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39739         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
39740         int64_t ret_ref = tag_ptr(ret_copy, true);
39741         return ret_ref;
39742 }
39743
39744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39745         LDKChannelDetails this_ptr_conv;
39746         this_ptr_conv.inner = untag_ptr(this_ptr);
39747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39749         this_ptr_conv.is_owned = false;
39750         void* val_ptr = untag_ptr(val);
39751         CHECK_ACCESS(val_ptr);
39752         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39753         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39754         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
39755 }
39756
39757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
39758         LDKChannelDetails this_ptr_conv;
39759         this_ptr_conv.inner = untag_ptr(this_ptr);
39760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39762         this_ptr_conv.is_owned = false;
39763         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
39764         return ret_conv;
39765 }
39766
39767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39768         LDKChannelDetails this_ptr_conv;
39769         this_ptr_conv.inner = untag_ptr(this_ptr);
39770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39772         this_ptr_conv.is_owned = false;
39773         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
39774 }
39775
39776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
39777         LDKChannelDetails this_ptr_conv;
39778         this_ptr_conv.inner = untag_ptr(this_ptr);
39779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39781         this_ptr_conv.is_owned = false;
39782         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39783         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
39784         int64_t ret_ref = tag_ptr(ret_copy, true);
39785         return ret_ref;
39786 }
39787
39788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39789         LDKChannelDetails this_ptr_conv;
39790         this_ptr_conv.inner = untag_ptr(this_ptr);
39791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39793         this_ptr_conv.is_owned = false;
39794         void* val_ptr = untag_ptr(val);
39795         CHECK_ACCESS(val_ptr);
39796         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39797         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39798         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
39799 }
39800
39801 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
39802         LDKChannelDetails this_ptr_conv;
39803         this_ptr_conv.inner = untag_ptr(this_ptr);
39804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39806         this_ptr_conv.is_owned = false;
39807         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
39808         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes);
39809         return ret_arr;
39810 }
39811
39812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39813         LDKChannelDetails this_ptr_conv;
39814         this_ptr_conv.inner = untag_ptr(this_ptr);
39815         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39817         this_ptr_conv.is_owned = false;
39818         LDKU128 val_ref;
39819         CHECK((*env)->GetArrayLength(env, val) == 16);
39820         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
39821         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
39822 }
39823
39824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
39825         LDKChannelDetails this_ptr_conv;
39826         this_ptr_conv.inner = untag_ptr(this_ptr);
39827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39829         this_ptr_conv.is_owned = false;
39830         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
39831         *ret_copy = ChannelDetails_get_feerate_sat_per_1000_weight(&this_ptr_conv);
39832         int64_t ret_ref = tag_ptr(ret_copy, true);
39833         return ret_ref;
39834 }
39835
39836 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) {
39837         LDKChannelDetails this_ptr_conv;
39838         this_ptr_conv.inner = untag_ptr(this_ptr);
39839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39841         this_ptr_conv.is_owned = false;
39842         void* val_ptr = untag_ptr(val);
39843         CHECK_ACCESS(val_ptr);
39844         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
39845         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
39846         ChannelDetails_set_feerate_sat_per_1000_weight(&this_ptr_conv, val_conv);
39847 }
39848
39849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39850         LDKChannelDetails this_ptr_conv;
39851         this_ptr_conv.inner = untag_ptr(this_ptr);
39852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39854         this_ptr_conv.is_owned = false;
39855         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
39856         return ret_conv;
39857 }
39858
39859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39860         LDKChannelDetails this_ptr_conv;
39861         this_ptr_conv.inner = untag_ptr(this_ptr);
39862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39864         this_ptr_conv.is_owned = false;
39865         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
39866 }
39867
39868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39869         LDKChannelDetails this_ptr_conv;
39870         this_ptr_conv.inner = untag_ptr(this_ptr);
39871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39873         this_ptr_conv.is_owned = false;
39874         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
39875         return ret_conv;
39876 }
39877
39878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39879         LDKChannelDetails this_ptr_conv;
39880         this_ptr_conv.inner = untag_ptr(this_ptr);
39881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39883         this_ptr_conv.is_owned = false;
39884         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
39885 }
39886
39887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1limit_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39888         LDKChannelDetails this_ptr_conv;
39889         this_ptr_conv.inner = untag_ptr(this_ptr);
39890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39892         this_ptr_conv.is_owned = false;
39893         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
39894         return ret_conv;
39895 }
39896
39897 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) {
39898         LDKChannelDetails this_ptr_conv;
39899         this_ptr_conv.inner = untag_ptr(this_ptr);
39900         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39902         this_ptr_conv.is_owned = false;
39903         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
39904 }
39905
39906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39907         LDKChannelDetails this_ptr_conv;
39908         this_ptr_conv.inner = untag_ptr(this_ptr);
39909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39911         this_ptr_conv.is_owned = false;
39912         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_minimum_msat(&this_ptr_conv);
39913         return ret_conv;
39914 }
39915
39916 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) {
39917         LDKChannelDetails this_ptr_conv;
39918         this_ptr_conv.inner = untag_ptr(this_ptr);
39919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39921         this_ptr_conv.is_owned = false;
39922         ChannelDetails_set_next_outbound_htlc_minimum_msat(&this_ptr_conv, val);
39923 }
39924
39925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39926         LDKChannelDetails this_ptr_conv;
39927         this_ptr_conv.inner = untag_ptr(this_ptr);
39928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39930         this_ptr_conv.is_owned = false;
39931         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
39932         return ret_conv;
39933 }
39934
39935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39936         LDKChannelDetails this_ptr_conv;
39937         this_ptr_conv.inner = untag_ptr(this_ptr);
39938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39940         this_ptr_conv.is_owned = false;
39941         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
39942 }
39943
39944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
39945         LDKChannelDetails this_ptr_conv;
39946         this_ptr_conv.inner = untag_ptr(this_ptr);
39947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39949         this_ptr_conv.is_owned = false;
39950         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
39951         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
39952         int64_t ret_ref = tag_ptr(ret_copy, true);
39953         return ret_ref;
39954 }
39955
39956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39957         LDKChannelDetails this_ptr_conv;
39958         this_ptr_conv.inner = untag_ptr(this_ptr);
39959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39961         this_ptr_conv.is_owned = false;
39962         void* val_ptr = untag_ptr(val);
39963         CHECK_ACCESS(val_ptr);
39964         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
39965         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
39966         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
39967 }
39968
39969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations(JNIEnv *env, jclass clz, int64_t this_ptr) {
39970         LDKChannelDetails this_ptr_conv;
39971         this_ptr_conv.inner = untag_ptr(this_ptr);
39972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39974         this_ptr_conv.is_owned = false;
39975         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
39976         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
39977         int64_t ret_ref = tag_ptr(ret_copy, true);
39978         return ret_ref;
39979 }
39980
39981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39982         LDKChannelDetails this_ptr_conv;
39983         this_ptr_conv.inner = untag_ptr(this_ptr);
39984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39986         this_ptr_conv.is_owned = false;
39987         void* val_ptr = untag_ptr(val);
39988         CHECK_ACCESS(val_ptr);
39989         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
39990         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
39991         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
39992 }
39993
39994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
39995         LDKChannelDetails this_ptr_conv;
39996         this_ptr_conv.inner = untag_ptr(this_ptr);
39997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39999         this_ptr_conv.is_owned = false;
40000         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
40001         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
40002         int64_t ret_ref = tag_ptr(ret_copy, true);
40003         return ret_ref;
40004 }
40005
40006 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) {
40007         LDKChannelDetails this_ptr_conv;
40008         this_ptr_conv.inner = untag_ptr(this_ptr);
40009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40011         this_ptr_conv.is_owned = false;
40012         void* val_ptr = untag_ptr(val);
40013         CHECK_ACCESS(val_ptr);
40014         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
40015         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
40016         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
40017 }
40018
40019 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
40020         LDKChannelDetails this_ptr_conv;
40021         this_ptr_conv.inner = untag_ptr(this_ptr);
40022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40024         this_ptr_conv.is_owned = false;
40025         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
40026         return ret_conv;
40027 }
40028
40029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
40030         LDKChannelDetails this_ptr_conv;
40031         this_ptr_conv.inner = untag_ptr(this_ptr);
40032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40034         this_ptr_conv.is_owned = false;
40035         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
40036 }
40037
40038 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr) {
40039         LDKChannelDetails this_ptr_conv;
40040         this_ptr_conv.inner = untag_ptr(this_ptr);
40041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40043         this_ptr_conv.is_owned = false;
40044         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
40045         return ret_conv;
40046 }
40047
40048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
40049         LDKChannelDetails this_ptr_conv;
40050         this_ptr_conv.inner = untag_ptr(this_ptr);
40051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40053         this_ptr_conv.is_owned = false;
40054         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
40055 }
40056
40057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1shutdown_1state(JNIEnv *env, jclass clz, int64_t this_ptr) {
40058         LDKChannelDetails this_ptr_conv;
40059         this_ptr_conv.inner = untag_ptr(this_ptr);
40060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40062         this_ptr_conv.is_owned = false;
40063         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
40064         *ret_copy = ChannelDetails_get_channel_shutdown_state(&this_ptr_conv);
40065         int64_t ret_ref = tag_ptr(ret_copy, true);
40066         return ret_ref;
40067 }
40068
40069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1shutdown_1state(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40070         LDKChannelDetails this_ptr_conv;
40071         this_ptr_conv.inner = untag_ptr(this_ptr);
40072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40074         this_ptr_conv.is_owned = false;
40075         void* val_ptr = untag_ptr(val);
40076         CHECK_ACCESS(val_ptr);
40077         LDKCOption_ChannelShutdownStateZ val_conv = *(LDKCOption_ChannelShutdownStateZ*)(val_ptr);
40078         val_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(val));
40079         ChannelDetails_set_channel_shutdown_state(&this_ptr_conv, val_conv);
40080 }
40081
40082 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
40083         LDKChannelDetails this_ptr_conv;
40084         this_ptr_conv.inner = untag_ptr(this_ptr);
40085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40087         this_ptr_conv.is_owned = false;
40088         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
40089         return ret_conv;
40090 }
40091
40092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
40093         LDKChannelDetails this_ptr_conv;
40094         this_ptr_conv.inner = untag_ptr(this_ptr);
40095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40097         this_ptr_conv.is_owned = false;
40098         ChannelDetails_set_is_usable(&this_ptr_conv, val);
40099 }
40100
40101 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
40102         LDKChannelDetails this_ptr_conv;
40103         this_ptr_conv.inner = untag_ptr(this_ptr);
40104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40106         this_ptr_conv.is_owned = false;
40107         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
40108         return ret_conv;
40109 }
40110
40111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
40112         LDKChannelDetails this_ptr_conv;
40113         this_ptr_conv.inner = untag_ptr(this_ptr);
40114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40116         this_ptr_conv.is_owned = false;
40117         ChannelDetails_set_is_public(&this_ptr_conv, val);
40118 }
40119
40120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
40121         LDKChannelDetails this_ptr_conv;
40122         this_ptr_conv.inner = untag_ptr(this_ptr);
40123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40125         this_ptr_conv.is_owned = false;
40126         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40127         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
40128         int64_t ret_ref = tag_ptr(ret_copy, true);
40129         return ret_ref;
40130 }
40131
40132 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) {
40133         LDKChannelDetails this_ptr_conv;
40134         this_ptr_conv.inner = untag_ptr(this_ptr);
40135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40137         this_ptr_conv.is_owned = false;
40138         void* val_ptr = untag_ptr(val);
40139         CHECK_ACCESS(val_ptr);
40140         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40141         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
40142         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
40143 }
40144
40145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
40146         LDKChannelDetails this_ptr_conv;
40147         this_ptr_conv.inner = untag_ptr(this_ptr);
40148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40150         this_ptr_conv.is_owned = false;
40151         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40152         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
40153         int64_t ret_ref = tag_ptr(ret_copy, true);
40154         return ret_ref;
40155 }
40156
40157 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) {
40158         LDKChannelDetails this_ptr_conv;
40159         this_ptr_conv.inner = untag_ptr(this_ptr);
40160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40162         this_ptr_conv.is_owned = false;
40163         void* val_ptr = untag_ptr(val);
40164         CHECK_ACCESS(val_ptr);
40165         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40166         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
40167         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
40168 }
40169
40170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
40171         LDKChannelDetails this_ptr_conv;
40172         this_ptr_conv.inner = untag_ptr(this_ptr);
40173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40175         this_ptr_conv.is_owned = false;
40176         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
40177         int64_t ret_ref = 0;
40178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40180         return ret_ref;
40181 }
40182
40183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40184         LDKChannelDetails this_ptr_conv;
40185         this_ptr_conv.inner = untag_ptr(this_ptr);
40186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40188         this_ptr_conv.is_owned = false;
40189         LDKChannelConfig val_conv;
40190         val_conv.inner = untag_ptr(val);
40191         val_conv.is_owned = ptr_is_owned(val);
40192         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40193         val_conv = ChannelConfig_clone(&val_conv);
40194         ChannelDetails_set_config(&this_ptr_conv, val_conv);
40195 }
40196
40197 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) {
40198         LDKThirtyTwoBytes channel_id_arg_ref;
40199         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
40200         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
40201         LDKChannelCounterparty counterparty_arg_conv;
40202         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
40203         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
40204         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
40205         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
40206         LDKOutPoint funding_txo_arg_conv;
40207         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
40208         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
40209         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
40210         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
40211         LDKChannelTypeFeatures channel_type_arg_conv;
40212         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
40213         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
40214         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
40215         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
40216         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
40217         CHECK_ACCESS(short_channel_id_arg_ptr);
40218         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
40219         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
40220         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
40221         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
40222         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
40223         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
40224         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
40225         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
40226         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
40227         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
40228         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
40229         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
40230         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
40231         LDKU128 user_channel_id_arg_ref;
40232         CHECK((*env)->GetArrayLength(env, user_channel_id_arg) == 16);
40233         (*env)->GetByteArrayRegion(env, user_channel_id_arg, 0, 16, user_channel_id_arg_ref.le_bytes);
40234         void* feerate_sat_per_1000_weight_arg_ptr = untag_ptr(feerate_sat_per_1000_weight_arg);
40235         CHECK_ACCESS(feerate_sat_per_1000_weight_arg_ptr);
40236         LDKCOption_u32Z feerate_sat_per_1000_weight_arg_conv = *(LDKCOption_u32Z*)(feerate_sat_per_1000_weight_arg_ptr);
40237         feerate_sat_per_1000_weight_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(feerate_sat_per_1000_weight_arg));
40238         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
40239         CHECK_ACCESS(confirmations_required_arg_ptr);
40240         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
40241         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
40242         void* confirmations_arg_ptr = untag_ptr(confirmations_arg);
40243         CHECK_ACCESS(confirmations_arg_ptr);
40244         LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr);
40245         confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg));
40246         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
40247         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
40248         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
40249         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
40250         void* channel_shutdown_state_arg_ptr = untag_ptr(channel_shutdown_state_arg);
40251         CHECK_ACCESS(channel_shutdown_state_arg_ptr);
40252         LDKCOption_ChannelShutdownStateZ channel_shutdown_state_arg_conv = *(LDKCOption_ChannelShutdownStateZ*)(channel_shutdown_state_arg_ptr);
40253         channel_shutdown_state_arg_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(channel_shutdown_state_arg));
40254         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
40255         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
40256         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
40257         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
40258         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
40259         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
40260         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
40261         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
40262         LDKChannelConfig config_arg_conv;
40263         config_arg_conv.inner = untag_ptr(config_arg);
40264         config_arg_conv.is_owned = ptr_is_owned(config_arg);
40265         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
40266         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
40267         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);
40268         int64_t ret_ref = 0;
40269         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40270         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40271         return ret_ref;
40272 }
40273
40274 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
40275         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
40276         int64_t ret_ref = 0;
40277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40279         return ret_ref;
40280 }
40281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40282         LDKChannelDetails arg_conv;
40283         arg_conv.inner = untag_ptr(arg);
40284         arg_conv.is_owned = ptr_is_owned(arg);
40285         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40286         arg_conv.is_owned = false;
40287         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
40288         return ret_conv;
40289 }
40290
40291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40292         LDKChannelDetails orig_conv;
40293         orig_conv.inner = untag_ptr(orig);
40294         orig_conv.is_owned = ptr_is_owned(orig);
40295         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40296         orig_conv.is_owned = false;
40297         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
40298         int64_t ret_ref = 0;
40299         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40300         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40301         return ret_ref;
40302 }
40303
40304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
40305         LDKChannelDetails this_arg_conv;
40306         this_arg_conv.inner = untag_ptr(this_arg);
40307         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40309         this_arg_conv.is_owned = false;
40310         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40311         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
40312         int64_t ret_ref = tag_ptr(ret_copy, true);
40313         return ret_ref;
40314 }
40315
40316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
40317         LDKChannelDetails this_arg_conv;
40318         this_arg_conv.inner = untag_ptr(this_arg);
40319         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40321         this_arg_conv.is_owned = false;
40322         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40323         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
40324         int64_t ret_ref = tag_ptr(ret_copy, true);
40325         return ret_ref;
40326 }
40327
40328 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40329         LDKChannelShutdownState* orig_conv = (LDKChannelShutdownState*)untag_ptr(orig);
40330         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_clone(orig_conv));
40331         return ret_conv;
40332 }
40333
40334 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1not_1shutting_1down(JNIEnv *env, jclass clz) {
40335         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_not_shutting_down());
40336         return ret_conv;
40337 }
40338
40339 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1shutdown_1initiated(JNIEnv *env, jclass clz) {
40340         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_shutdown_initiated());
40341         return ret_conv;
40342 }
40343
40344 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1resolving_1htlcs(JNIEnv *env, jclass clz) {
40345         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_resolving_htlcs());
40346         return ret_conv;
40347 }
40348
40349 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1negotiating_1closing_1fee(JNIEnv *env, jclass clz) {
40350         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_negotiating_closing_fee());
40351         return ret_conv;
40352 }
40353
40354 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1shutdown_1complete(JNIEnv *env, jclass clz) {
40355         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_shutdown_complete());
40356         return ret_conv;
40357 }
40358
40359 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40360         LDKChannelShutdownState* a_conv = (LDKChannelShutdownState*)untag_ptr(a);
40361         LDKChannelShutdownState* b_conv = (LDKChannelShutdownState*)untag_ptr(b);
40362         jboolean ret_conv = ChannelShutdownState_eq(a_conv, b_conv);
40363         return ret_conv;
40364 }
40365
40366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
40367         if (!ptr_is_owned(this_ptr)) return;
40368         void* this_ptr_ptr = untag_ptr(this_ptr);
40369         CHECK_ACCESS(this_ptr_ptr);
40370         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
40371         FREE(untag_ptr(this_ptr));
40372         RecentPaymentDetails_free(this_ptr_conv);
40373 }
40374
40375 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
40376         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
40377         *ret_copy = RecentPaymentDetails_clone(arg);
40378         int64_t ret_ref = tag_ptr(ret_copy, true);
40379         return ret_ref;
40380 }
40381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40382         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
40383         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
40384         return ret_conv;
40385 }
40386
40387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40388         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
40389         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
40390         *ret_copy = RecentPaymentDetails_clone(orig_conv);
40391         int64_t ret_ref = tag_ptr(ret_copy, true);
40392         return ret_ref;
40393 }
40394
40395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1awaiting_1invoice(JNIEnv *env, jclass clz, int8_tArray payment_id) {
40396         LDKThirtyTwoBytes payment_id_ref;
40397         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
40398         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
40399         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
40400         *ret_copy = RecentPaymentDetails_awaiting_invoice(payment_id_ref);
40401         int64_t ret_ref = tag_ptr(ret_copy, true);
40402         return ret_ref;
40403 }
40404
40405 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) {
40406         LDKThirtyTwoBytes payment_id_ref;
40407         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
40408         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
40409         LDKThirtyTwoBytes payment_hash_ref;
40410         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
40411         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
40412         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
40413         *ret_copy = RecentPaymentDetails_pending(payment_id_ref, payment_hash_ref, total_msat);
40414         int64_t ret_ref = tag_ptr(ret_copy, true);
40415         return ret_ref;
40416 }
40417
40418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1fulfilled(JNIEnv *env, jclass clz, int8_tArray payment_id, int64_t payment_hash) {
40419         LDKThirtyTwoBytes payment_id_ref;
40420         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
40421         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
40422         void* payment_hash_ptr = untag_ptr(payment_hash);
40423         CHECK_ACCESS(payment_hash_ptr);
40424         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
40425         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
40426         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
40427         *ret_copy = RecentPaymentDetails_fulfilled(payment_id_ref, payment_hash_conv);
40428         int64_t ret_ref = tag_ptr(ret_copy, true);
40429         return ret_ref;
40430 }
40431
40432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1abandoned(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash) {
40433         LDKThirtyTwoBytes payment_id_ref;
40434         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
40435         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
40436         LDKThirtyTwoBytes payment_hash_ref;
40437         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
40438         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
40439         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
40440         *ret_copy = RecentPaymentDetails_abandoned(payment_id_ref, payment_hash_ref);
40441         int64_t ret_ref = tag_ptr(ret_copy, true);
40442         return ret_ref;
40443 }
40444
40445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40446         LDKPhantomRouteHints this_obj_conv;
40447         this_obj_conv.inner = untag_ptr(this_obj);
40448         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40450         PhantomRouteHints_free(this_obj_conv);
40451 }
40452
40453 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
40454         LDKPhantomRouteHints this_ptr_conv;
40455         this_ptr_conv.inner = untag_ptr(this_ptr);
40456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40458         this_ptr_conv.is_owned = false;
40459         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
40460         int64_tArray ret_arr = NULL;
40461         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40462         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40463         for (size_t q = 0; q < ret_var.datalen; q++) {
40464                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
40465                 int64_t ret_conv_16_ref = 0;
40466                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
40467                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
40468                 ret_arr_ptr[q] = ret_conv_16_ref;
40469         }
40470         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40471         FREE(ret_var.data);
40472         return ret_arr;
40473 }
40474
40475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
40476         LDKPhantomRouteHints this_ptr_conv;
40477         this_ptr_conv.inner = untag_ptr(this_ptr);
40478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40480         this_ptr_conv.is_owned = false;
40481         LDKCVec_ChannelDetailsZ val_constr;
40482         val_constr.datalen = (*env)->GetArrayLength(env, val);
40483         if (val_constr.datalen > 0)
40484                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
40485         else
40486                 val_constr.data = NULL;
40487         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
40488         for (size_t q = 0; q < val_constr.datalen; q++) {
40489                 int64_t val_conv_16 = val_vals[q];
40490                 LDKChannelDetails val_conv_16_conv;
40491                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
40492                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
40493                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
40494                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
40495                 val_constr.data[q] = val_conv_16_conv;
40496         }
40497         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
40498         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
40499 }
40500
40501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr) {
40502         LDKPhantomRouteHints this_ptr_conv;
40503         this_ptr_conv.inner = untag_ptr(this_ptr);
40504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40506         this_ptr_conv.is_owned = false;
40507         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
40508         return ret_conv;
40509 }
40510
40511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40512         LDKPhantomRouteHints this_ptr_conv;
40513         this_ptr_conv.inner = untag_ptr(this_ptr);
40514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40516         this_ptr_conv.is_owned = false;
40517         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
40518 }
40519
40520 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
40521         LDKPhantomRouteHints this_ptr_conv;
40522         this_ptr_conv.inner = untag_ptr(this_ptr);
40523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40525         this_ptr_conv.is_owned = false;
40526         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40527         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form);
40528         return ret_arr;
40529 }
40530
40531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40532         LDKPhantomRouteHints this_ptr_conv;
40533         this_ptr_conv.inner = untag_ptr(this_ptr);
40534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40536         this_ptr_conv.is_owned = false;
40537         LDKPublicKey val_ref;
40538         CHECK((*env)->GetArrayLength(env, val) == 33);
40539         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
40540         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
40541 }
40542
40543 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) {
40544         LDKCVec_ChannelDetailsZ channels_arg_constr;
40545         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
40546         if (channels_arg_constr.datalen > 0)
40547                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
40548         else
40549                 channels_arg_constr.data = NULL;
40550         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
40551         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
40552                 int64_t channels_arg_conv_16 = channels_arg_vals[q];
40553                 LDKChannelDetails channels_arg_conv_16_conv;
40554                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
40555                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
40556                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
40557                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
40558                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
40559         }
40560         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
40561         LDKPublicKey real_node_pubkey_arg_ref;
40562         CHECK((*env)->GetArrayLength(env, real_node_pubkey_arg) == 33);
40563         (*env)->GetByteArrayRegion(env, real_node_pubkey_arg, 0, 33, real_node_pubkey_arg_ref.compressed_form);
40564         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
40565         int64_t ret_ref = 0;
40566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40568         return ret_ref;
40569 }
40570
40571 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
40572         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
40573         int64_t ret_ref = 0;
40574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40576         return ret_ref;
40577 }
40578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40579         LDKPhantomRouteHints arg_conv;
40580         arg_conv.inner = untag_ptr(arg);
40581         arg_conv.is_owned = ptr_is_owned(arg);
40582         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40583         arg_conv.is_owned = false;
40584         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
40585         return ret_conv;
40586 }
40587
40588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40589         LDKPhantomRouteHints orig_conv;
40590         orig_conv.inner = untag_ptr(orig);
40591         orig_conv.is_owned = ptr_is_owned(orig);
40592         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40593         orig_conv.is_owned = false;
40594         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
40595         int64_t ret_ref = 0;
40596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40598         return ret_ref;
40599 }
40600
40601 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) {
40602         void* fee_est_ptr = untag_ptr(fee_est);
40603         CHECK_ACCESS(fee_est_ptr);
40604         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
40605         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
40606                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40607                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
40608         }
40609         void* chain_monitor_ptr = untag_ptr(chain_monitor);
40610         CHECK_ACCESS(chain_monitor_ptr);
40611         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
40612         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
40613                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40614                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
40615         }
40616         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
40617         CHECK_ACCESS(tx_broadcaster_ptr);
40618         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
40619         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
40620                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40621                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
40622         }
40623         void* router_ptr = untag_ptr(router);
40624         CHECK_ACCESS(router_ptr);
40625         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
40626         if (router_conv.free == LDKRouter_JCalls_free) {
40627                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40628                 LDKRouter_JCalls_cloned(&router_conv);
40629         }
40630         void* logger_ptr = untag_ptr(logger);
40631         CHECK_ACCESS(logger_ptr);
40632         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
40633         if (logger_conv.free == LDKLogger_JCalls_free) {
40634                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40635                 LDKLogger_JCalls_cloned(&logger_conv);
40636         }
40637         void* entropy_source_ptr = untag_ptr(entropy_source);
40638         CHECK_ACCESS(entropy_source_ptr);
40639         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
40640         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
40641                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40642                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
40643         }
40644         void* node_signer_ptr = untag_ptr(node_signer);
40645         CHECK_ACCESS(node_signer_ptr);
40646         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
40647         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
40648                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40649                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
40650         }
40651         void* signer_provider_ptr = untag_ptr(signer_provider);
40652         CHECK_ACCESS(signer_provider_ptr);
40653         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
40654         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
40655                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40656                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
40657         }
40658         LDKUserConfig config_conv;
40659         config_conv.inner = untag_ptr(config);
40660         config_conv.is_owned = ptr_is_owned(config);
40661         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
40662         config_conv = UserConfig_clone(&config_conv);
40663         LDKChainParameters params_conv;
40664         params_conv.inner = untag_ptr(params);
40665         params_conv.is_owned = ptr_is_owned(params);
40666         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
40667         params_conv = ChainParameters_clone(&params_conv);
40668         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);
40669         int64_t ret_ref = 0;
40670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40672         return ret_ref;
40673 }
40674
40675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
40676         LDKChannelManager this_arg_conv;
40677         this_arg_conv.inner = untag_ptr(this_arg);
40678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40680         this_arg_conv.is_owned = false;
40681         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
40682         int64_t ret_ref = 0;
40683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40685         return ret_ref;
40686 }
40687
40688 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) {
40689         LDKChannelManager this_arg_conv;
40690         this_arg_conv.inner = untag_ptr(this_arg);
40691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40693         this_arg_conv.is_owned = false;
40694         LDKPublicKey their_network_key_ref;
40695         CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
40696         (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
40697         LDKU128 user_channel_id_ref;
40698         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
40699         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
40700         LDKUserConfig override_config_conv;
40701         override_config_conv.inner = untag_ptr(override_config);
40702         override_config_conv.is_owned = ptr_is_owned(override_config);
40703         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
40704         override_config_conv = UserConfig_clone(&override_config_conv);
40705         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
40706         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id_ref, override_config_conv);
40707         return tag_ptr(ret_conv, true);
40708 }
40709
40710 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
40711         LDKChannelManager this_arg_conv;
40712         this_arg_conv.inner = untag_ptr(this_arg);
40713         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40715         this_arg_conv.is_owned = false;
40716         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
40717         int64_tArray ret_arr = NULL;
40718         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40719         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40720         for (size_t q = 0; q < ret_var.datalen; q++) {
40721                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
40722                 int64_t ret_conv_16_ref = 0;
40723                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
40724                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
40725                 ret_arr_ptr[q] = ret_conv_16_ref;
40726         }
40727         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40728         FREE(ret_var.data);
40729         return ret_arr;
40730 }
40731
40732 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
40733         LDKChannelManager this_arg_conv;
40734         this_arg_conv.inner = untag_ptr(this_arg);
40735         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40737         this_arg_conv.is_owned = false;
40738         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
40739         int64_tArray ret_arr = NULL;
40740         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40741         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40742         for (size_t q = 0; q < ret_var.datalen; q++) {
40743                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
40744                 int64_t ret_conv_16_ref = 0;
40745                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
40746                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
40747                 ret_arr_ptr[q] = ret_conv_16_ref;
40748         }
40749         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40750         FREE(ret_var.data);
40751         return ret_arr;
40752 }
40753
40754 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) {
40755         LDKChannelManager this_arg_conv;
40756         this_arg_conv.inner = untag_ptr(this_arg);
40757         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40759         this_arg_conv.is_owned = false;
40760         LDKPublicKey counterparty_node_id_ref;
40761         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
40762         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
40763         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels_with_counterparty(&this_arg_conv, counterparty_node_id_ref);
40764         int64_tArray ret_arr = NULL;
40765         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40766         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40767         for (size_t q = 0; q < ret_var.datalen; q++) {
40768                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
40769                 int64_t ret_conv_16_ref = 0;
40770                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
40771                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
40772                 ret_arr_ptr[q] = ret_conv_16_ref;
40773         }
40774         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40775         FREE(ret_var.data);
40776         return ret_arr;
40777 }
40778
40779 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1recent_1payments(JNIEnv *env, jclass clz, int64_t this_arg) {
40780         LDKChannelManager this_arg_conv;
40781         this_arg_conv.inner = untag_ptr(this_arg);
40782         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40784         this_arg_conv.is_owned = false;
40785         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
40786         int64_tArray ret_arr = NULL;
40787         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40788         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40789         for (size_t w = 0; w < ret_var.datalen; w++) {
40790                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
40791                 *ret_conv_22_copy = ret_var.data[w];
40792                 int64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
40793                 ret_arr_ptr[w] = ret_conv_22_ref;
40794         }
40795         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40796         FREE(ret_var.data);
40797         return ret_arr;
40798 }
40799
40800 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) {
40801         LDKChannelManager this_arg_conv;
40802         this_arg_conv.inner = untag_ptr(this_arg);
40803         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40805         this_arg_conv.is_owned = false;
40806         uint8_t channel_id_arr[32];
40807         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
40808         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
40809         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
40810         LDKPublicKey counterparty_node_id_ref;
40811         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
40812         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
40813         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40814         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
40815         return tag_ptr(ret_conv, true);
40816 }
40817
40818 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) {
40819         LDKChannelManager this_arg_conv;
40820         this_arg_conv.inner = untag_ptr(this_arg);
40821         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40823         this_arg_conv.is_owned = false;
40824         uint8_t channel_id_arr[32];
40825         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
40826         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
40827         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
40828         LDKPublicKey counterparty_node_id_ref;
40829         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
40830         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
40831         void* target_feerate_sats_per_1000_weight_ptr = untag_ptr(target_feerate_sats_per_1000_weight);
40832         CHECK_ACCESS(target_feerate_sats_per_1000_weight_ptr);
40833         LDKCOption_u32Z target_feerate_sats_per_1000_weight_conv = *(LDKCOption_u32Z*)(target_feerate_sats_per_1000_weight_ptr);
40834         target_feerate_sats_per_1000_weight_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(target_feerate_sats_per_1000_weight));
40835         LDKShutdownScript shutdown_script_conv;
40836         shutdown_script_conv.inner = untag_ptr(shutdown_script);
40837         shutdown_script_conv.is_owned = ptr_is_owned(shutdown_script);
40838         CHECK_INNER_FIELD_ACCESS_OR_NULL(shutdown_script_conv);
40839         shutdown_script_conv = ShutdownScript_clone(&shutdown_script_conv);
40840         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40841         *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);
40842         return tag_ptr(ret_conv, true);
40843 }
40844
40845 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) {
40846         LDKChannelManager this_arg_conv;
40847         this_arg_conv.inner = untag_ptr(this_arg);
40848         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40850         this_arg_conv.is_owned = false;
40851         uint8_t channel_id_arr[32];
40852         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
40853         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
40854         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
40855         LDKPublicKey counterparty_node_id_ref;
40856         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
40857         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
40858         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40859         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
40860         return tag_ptr(ret_conv, true);
40861 }
40862
40863 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) {
40864         LDKChannelManager this_arg_conv;
40865         this_arg_conv.inner = untag_ptr(this_arg);
40866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40868         this_arg_conv.is_owned = false;
40869         uint8_t channel_id_arr[32];
40870         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
40871         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
40872         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
40873         LDKPublicKey counterparty_node_id_ref;
40874         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
40875         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
40876         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40877         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
40878         return tag_ptr(ret_conv, true);
40879 }
40880
40881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1broadcasting_1latest_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
40882         LDKChannelManager this_arg_conv;
40883         this_arg_conv.inner = untag_ptr(this_arg);
40884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40886         this_arg_conv.is_owned = false;
40887         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
40888 }
40889
40890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1without_1broadcasting_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
40891         LDKChannelManager this_arg_conv;
40892         this_arg_conv.inner = untag_ptr(this_arg);
40893         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40895         this_arg_conv.is_owned = false;
40896         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
40897 }
40898
40899 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) {
40900         LDKChannelManager this_arg_conv;
40901         this_arg_conv.inner = untag_ptr(this_arg);
40902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40904         this_arg_conv.is_owned = false;
40905         LDKRoute route_conv;
40906         route_conv.inner = untag_ptr(route);
40907         route_conv.is_owned = ptr_is_owned(route);
40908         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
40909         route_conv.is_owned = false;
40910         LDKThirtyTwoBytes payment_hash_ref;
40911         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
40912         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
40913         LDKRecipientOnionFields recipient_onion_conv;
40914         recipient_onion_conv.inner = untag_ptr(recipient_onion);
40915         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
40916         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
40917         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
40918         LDKThirtyTwoBytes payment_id_ref;
40919         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
40920         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
40921         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
40922         *ret_conv = ChannelManager_send_payment_with_route(&this_arg_conv, &route_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref);
40923         return tag_ptr(ret_conv, true);
40924 }
40925
40926 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) {
40927         LDKChannelManager this_arg_conv;
40928         this_arg_conv.inner = untag_ptr(this_arg);
40929         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40931         this_arg_conv.is_owned = false;
40932         LDKThirtyTwoBytes payment_hash_ref;
40933         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
40934         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
40935         LDKRecipientOnionFields recipient_onion_conv;
40936         recipient_onion_conv.inner = untag_ptr(recipient_onion);
40937         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
40938         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
40939         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
40940         LDKThirtyTwoBytes payment_id_ref;
40941         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
40942         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
40943         LDKRouteParameters route_params_conv;
40944         route_params_conv.inner = untag_ptr(route_params);
40945         route_params_conv.is_owned = ptr_is_owned(route_params);
40946         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
40947         route_params_conv = RouteParameters_clone(&route_params_conv);
40948         void* retry_strategy_ptr = untag_ptr(retry_strategy);
40949         CHECK_ACCESS(retry_strategy_ptr);
40950         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
40951         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
40952         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
40953         *ret_conv = ChannelManager_send_payment(&this_arg_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
40954         return tag_ptr(ret_conv, true);
40955 }
40956
40957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
40958         LDKChannelManager this_arg_conv;
40959         this_arg_conv.inner = untag_ptr(this_arg);
40960         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40962         this_arg_conv.is_owned = false;
40963         LDKThirtyTwoBytes payment_id_ref;
40964         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
40965         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
40966         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
40967 }
40968
40969 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) {
40970         LDKChannelManager this_arg_conv;
40971         this_arg_conv.inner = untag_ptr(this_arg);
40972         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40974         this_arg_conv.is_owned = false;
40975         LDKRoute route_conv;
40976         route_conv.inner = untag_ptr(route);
40977         route_conv.is_owned = ptr_is_owned(route);
40978         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
40979         route_conv.is_owned = false;
40980         void* payment_preimage_ptr = untag_ptr(payment_preimage);
40981         CHECK_ACCESS(payment_preimage_ptr);
40982         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
40983         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
40984         LDKRecipientOnionFields recipient_onion_conv;
40985         recipient_onion_conv.inner = untag_ptr(recipient_onion);
40986         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
40987         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
40988         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
40989         LDKThirtyTwoBytes payment_id_ref;
40990         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
40991         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
40992         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
40993         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref);
40994         return tag_ptr(ret_conv, true);
40995 }
40996
40997 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) {
40998         LDKChannelManager this_arg_conv;
40999         this_arg_conv.inner = untag_ptr(this_arg);
41000         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41002         this_arg_conv.is_owned = false;
41003         void* payment_preimage_ptr = untag_ptr(payment_preimage);
41004         CHECK_ACCESS(payment_preimage_ptr);
41005         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
41006         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
41007         LDKRecipientOnionFields recipient_onion_conv;
41008         recipient_onion_conv.inner = untag_ptr(recipient_onion);
41009         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
41010         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
41011         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
41012         LDKThirtyTwoBytes payment_id_ref;
41013         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
41014         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
41015         LDKRouteParameters route_params_conv;
41016         route_params_conv.inner = untag_ptr(route_params);
41017         route_params_conv.is_owned = ptr_is_owned(route_params);
41018         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
41019         route_params_conv = RouteParameters_clone(&route_params_conv);
41020         void* retry_strategy_ptr = untag_ptr(retry_strategy);
41021         CHECK_ACCESS(retry_strategy_ptr);
41022         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
41023         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
41024         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
41025         *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);
41026         return tag_ptr(ret_conv, true);
41027 }
41028
41029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1probe(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
41030         LDKChannelManager this_arg_conv;
41031         this_arg_conv.inner = untag_ptr(this_arg);
41032         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41034         this_arg_conv.is_owned = false;
41035         LDKPath path_conv;
41036         path_conv.inner = untag_ptr(path);
41037         path_conv.is_owned = ptr_is_owned(path);
41038         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
41039         path_conv = Path_clone(&path_conv);
41040         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
41041         *ret_conv = ChannelManager_send_probe(&this_arg_conv, path_conv);
41042         return tag_ptr(ret_conv, true);
41043 }
41044
41045 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) {
41046         LDKChannelManager this_arg_conv;
41047         this_arg_conv.inner = untag_ptr(this_arg);
41048         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41050         this_arg_conv.is_owned = false;
41051         LDKPublicKey node_id_ref;
41052         CHECK((*env)->GetArrayLength(env, node_id) == 33);
41053         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
41054         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
41055         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
41056         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
41057         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
41058         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
41059         *ret_conv = ChannelManager_send_spontaneous_preflight_probes(&this_arg_conv, node_id_ref, amount_msat, final_cltv_expiry_delta, liquidity_limit_multiplier_conv);
41060         return tag_ptr(ret_conv, true);
41061 }
41062
41063 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) {
41064         LDKChannelManager this_arg_conv;
41065         this_arg_conv.inner = untag_ptr(this_arg);
41066         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41068         this_arg_conv.is_owned = false;
41069         LDKRouteParameters route_params_conv;
41070         route_params_conv.inner = untag_ptr(route_params);
41071         route_params_conv.is_owned = ptr_is_owned(route_params);
41072         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
41073         route_params_conv = RouteParameters_clone(&route_params_conv);
41074         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
41075         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
41076         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
41077         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
41078         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
41079         *ret_conv = ChannelManager_send_preflight_probes(&this_arg_conv, route_params_conv, liquidity_limit_multiplier_conv);
41080         return tag_ptr(ret_conv, true);
41081 }
41082
41083 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) {
41084         LDKChannelManager this_arg_conv;
41085         this_arg_conv.inner = untag_ptr(this_arg);
41086         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41088         this_arg_conv.is_owned = false;
41089         uint8_t temporary_channel_id_arr[32];
41090         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
41091         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
41092         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
41093         LDKPublicKey counterparty_node_id_ref;
41094         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
41095         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
41096         LDKTransaction funding_transaction_ref;
41097         funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
41098         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
41099         (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
41100         funding_transaction_ref.data_is_owned = true;
41101         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
41102         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
41103         return tag_ptr(ret_conv, true);
41104 }
41105
41106 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) {
41107         LDKChannelManager this_arg_conv;
41108         this_arg_conv.inner = untag_ptr(this_arg);
41109         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41111         this_arg_conv.is_owned = false;
41112         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ temporary_channels_constr;
41113         temporary_channels_constr.datalen = (*env)->GetArrayLength(env, temporary_channels);
41114         if (temporary_channels_constr.datalen > 0)
41115                 temporary_channels_constr.data = MALLOC(temporary_channels_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ Elements");
41116         else
41117                 temporary_channels_constr.data = NULL;
41118         int64_t* temporary_channels_vals = (*env)->GetLongArrayElements (env, temporary_channels, NULL);
41119         for (size_t j = 0; j < temporary_channels_constr.datalen; j++) {
41120                 int64_t temporary_channels_conv_35 = temporary_channels_vals[j];
41121                 void* temporary_channels_conv_35_ptr = untag_ptr(temporary_channels_conv_35);
41122                 CHECK_ACCESS(temporary_channels_conv_35_ptr);
41123                 LDKC2Tuple_ThirtyTwoBytesPublicKeyZ temporary_channels_conv_35_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(temporary_channels_conv_35_ptr);
41124                 temporary_channels_conv_35_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone((LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(temporary_channels_conv_35));
41125                 temporary_channels_constr.data[j] = temporary_channels_conv_35_conv;
41126         }
41127         (*env)->ReleaseLongArrayElements(env, temporary_channels, temporary_channels_vals, 0);
41128         LDKTransaction funding_transaction_ref;
41129         funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
41130         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
41131         (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
41132         funding_transaction_ref.data_is_owned = true;
41133         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
41134         *ret_conv = ChannelManager_batch_funding_transaction_generated(&this_arg_conv, temporary_channels_constr, funding_transaction_ref);
41135         return tag_ptr(ret_conv, true);
41136 }
41137
41138 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) {
41139         LDKChannelManager this_arg_conv;
41140         this_arg_conv.inner = untag_ptr(this_arg);
41141         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41143         this_arg_conv.is_owned = false;
41144         LDKPublicKey counterparty_node_id_ref;
41145         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
41146         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
41147         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
41148         channel_ids_constr.datalen = (*env)->GetArrayLength(env, channel_ids);
41149         if (channel_ids_constr.datalen > 0)
41150                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
41151         else
41152                 channel_ids_constr.data = NULL;
41153         for (size_t i = 0; i < channel_ids_constr.datalen; i++) {
41154                 int8_tArray channel_ids_conv_8 = (*env)->GetObjectArrayElement(env, channel_ids, i);
41155                 LDKThirtyTwoBytes channel_ids_conv_8_ref;
41156                 CHECK((*env)->GetArrayLength(env, channel_ids_conv_8) == 32);
41157                 (*env)->GetByteArrayRegion(env, channel_ids_conv_8, 0, 32, channel_ids_conv_8_ref.data);
41158                 channel_ids_constr.data[i] = channel_ids_conv_8_ref;
41159         }
41160         LDKChannelConfigUpdate config_update_conv;
41161         config_update_conv.inner = untag_ptr(config_update);
41162         config_update_conv.is_owned = ptr_is_owned(config_update);
41163         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_update_conv);
41164         config_update_conv.is_owned = false;
41165         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
41166         *ret_conv = ChannelManager_update_partial_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_update_conv);
41167         return tag_ptr(ret_conv, true);
41168 }
41169
41170 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) {
41171         LDKChannelManager this_arg_conv;
41172         this_arg_conv.inner = untag_ptr(this_arg);
41173         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41175         this_arg_conv.is_owned = false;
41176         LDKPublicKey counterparty_node_id_ref;
41177         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
41178         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
41179         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
41180         channel_ids_constr.datalen = (*env)->GetArrayLength(env, channel_ids);
41181         if (channel_ids_constr.datalen > 0)
41182                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
41183         else
41184                 channel_ids_constr.data = NULL;
41185         for (size_t i = 0; i < channel_ids_constr.datalen; i++) {
41186                 int8_tArray channel_ids_conv_8 = (*env)->GetObjectArrayElement(env, channel_ids, i);
41187                 LDKThirtyTwoBytes channel_ids_conv_8_ref;
41188                 CHECK((*env)->GetArrayLength(env, channel_ids_conv_8) == 32);
41189                 (*env)->GetByteArrayRegion(env, channel_ids_conv_8, 0, 32, channel_ids_conv_8_ref.data);
41190                 channel_ids_constr.data[i] = channel_ids_conv_8_ref;
41191         }
41192         LDKChannelConfig config_conv;
41193         config_conv.inner = untag_ptr(config);
41194         config_conv.is_owned = ptr_is_owned(config);
41195         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
41196         config_conv.is_owned = false;
41197         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
41198         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
41199         return tag_ptr(ret_conv, true);
41200 }
41201
41202 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) {
41203         LDKChannelManager this_arg_conv;
41204         this_arg_conv.inner = untag_ptr(this_arg);
41205         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41207         this_arg_conv.is_owned = false;
41208         LDKThirtyTwoBytes intercept_id_ref;
41209         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
41210         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
41211         uint8_t next_hop_channel_id_arr[32];
41212         CHECK((*env)->GetArrayLength(env, next_hop_channel_id) == 32);
41213         (*env)->GetByteArrayRegion(env, next_hop_channel_id, 0, 32, next_hop_channel_id_arr);
41214         uint8_t (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr;
41215         LDKPublicKey next_node_id_ref;
41216         CHECK((*env)->GetArrayLength(env, next_node_id) == 33);
41217         (*env)->GetByteArrayRegion(env, next_node_id, 0, 33, next_node_id_ref.compressed_form);
41218         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
41219         *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);
41220         return tag_ptr(ret_conv, true);
41221 }
41222
41223 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) {
41224         LDKChannelManager this_arg_conv;
41225         this_arg_conv.inner = untag_ptr(this_arg);
41226         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41228         this_arg_conv.is_owned = false;
41229         LDKThirtyTwoBytes intercept_id_ref;
41230         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
41231         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
41232         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
41233         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
41234         return tag_ptr(ret_conv, true);
41235 }
41236
41237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
41238         LDKChannelManager this_arg_conv;
41239         this_arg_conv.inner = untag_ptr(this_arg);
41240         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41242         this_arg_conv.is_owned = false;
41243         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
41244 }
41245
41246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
41247         LDKChannelManager this_arg_conv;
41248         this_arg_conv.inner = untag_ptr(this_arg);
41249         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41251         this_arg_conv.is_owned = false;
41252         ChannelManager_timer_tick_occurred(&this_arg_conv);
41253 }
41254
41255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
41256         LDKChannelManager this_arg_conv;
41257         this_arg_conv.inner = untag_ptr(this_arg);
41258         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41260         this_arg_conv.is_owned = false;
41261         uint8_t payment_hash_arr[32];
41262         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
41263         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
41264         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
41265         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
41266 }
41267
41268 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) {
41269         LDKChannelManager this_arg_conv;
41270         this_arg_conv.inner = untag_ptr(this_arg);
41271         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41273         this_arg_conv.is_owned = false;
41274         uint8_t payment_hash_arr[32];
41275         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
41276         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
41277         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
41278         void* failure_code_ptr = untag_ptr(failure_code);
41279         CHECK_ACCESS(failure_code_ptr);
41280         LDKFailureCode failure_code_conv = *(LDKFailureCode*)(failure_code_ptr);
41281         failure_code_conv = FailureCode_clone((LDKFailureCode*)untag_ptr(failure_code));
41282         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
41283 }
41284
41285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
41286         LDKChannelManager this_arg_conv;
41287         this_arg_conv.inner = untag_ptr(this_arg);
41288         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41290         this_arg_conv.is_owned = false;
41291         LDKThirtyTwoBytes payment_preimage_ref;
41292         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
41293         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
41294         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
41295 }
41296
41297 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) {
41298         LDKChannelManager this_arg_conv;
41299         this_arg_conv.inner = untag_ptr(this_arg);
41300         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41302         this_arg_conv.is_owned = false;
41303         LDKThirtyTwoBytes payment_preimage_ref;
41304         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
41305         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
41306         ChannelManager_claim_funds_with_known_custom_tlvs(&this_arg_conv, payment_preimage_ref);
41307 }
41308
41309 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
41310         LDKChannelManager this_arg_conv;
41311         this_arg_conv.inner = untag_ptr(this_arg);
41312         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41314         this_arg_conv.is_owned = false;
41315         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41316         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
41317         return ret_arr;
41318 }
41319
41320 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) {
41321         LDKChannelManager this_arg_conv;
41322         this_arg_conv.inner = untag_ptr(this_arg);
41323         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41325         this_arg_conv.is_owned = false;
41326         uint8_t temporary_channel_id_arr[32];
41327         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
41328         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
41329         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
41330         LDKPublicKey counterparty_node_id_ref;
41331         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
41332         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
41333         LDKU128 user_channel_id_ref;
41334         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
41335         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
41336         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
41337         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
41338         return tag_ptr(ret_conv, true);
41339 }
41340
41341 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) {
41342         LDKChannelManager this_arg_conv;
41343         this_arg_conv.inner = untag_ptr(this_arg);
41344         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41346         this_arg_conv.is_owned = false;
41347         uint8_t temporary_channel_id_arr[32];
41348         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
41349         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
41350         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
41351         LDKPublicKey counterparty_node_id_ref;
41352         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
41353         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
41354         LDKU128 user_channel_id_ref;
41355         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
41356         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
41357         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
41358         *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);
41359         return tag_ptr(ret_conv, true);
41360 }
41361
41362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1pay_1for_1offer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t offer, int64_t quantity, int64_t amount_msats, int64_t payer_note, int8_tArray payment_id, int64_t retry_strategy, int64_t max_total_routing_fee_msat) {
41363         LDKChannelManager this_arg_conv;
41364         this_arg_conv.inner = untag_ptr(this_arg);
41365         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41367         this_arg_conv.is_owned = false;
41368         LDKOffer offer_conv;
41369         offer_conv.inner = untag_ptr(offer);
41370         offer_conv.is_owned = ptr_is_owned(offer);
41371         CHECK_INNER_FIELD_ACCESS_OR_NULL(offer_conv);
41372         offer_conv.is_owned = false;
41373         void* quantity_ptr = untag_ptr(quantity);
41374         CHECK_ACCESS(quantity_ptr);
41375         LDKCOption_u64Z quantity_conv = *(LDKCOption_u64Z*)(quantity_ptr);
41376         quantity_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(quantity));
41377         void* amount_msats_ptr = untag_ptr(amount_msats);
41378         CHECK_ACCESS(amount_msats_ptr);
41379         LDKCOption_u64Z amount_msats_conv = *(LDKCOption_u64Z*)(amount_msats_ptr);
41380         amount_msats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amount_msats));
41381         void* payer_note_ptr = untag_ptr(payer_note);
41382         CHECK_ACCESS(payer_note_ptr);
41383         LDKCOption_StrZ payer_note_conv = *(LDKCOption_StrZ*)(payer_note_ptr);
41384         payer_note_conv = COption_StrZ_clone((LDKCOption_StrZ*)untag_ptr(payer_note));
41385         LDKThirtyTwoBytes payment_id_ref;
41386         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
41387         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
41388         void* retry_strategy_ptr = untag_ptr(retry_strategy);
41389         CHECK_ACCESS(retry_strategy_ptr);
41390         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
41391         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
41392         void* max_total_routing_fee_msat_ptr = untag_ptr(max_total_routing_fee_msat);
41393         CHECK_ACCESS(max_total_routing_fee_msat_ptr);
41394         LDKCOption_u64Z max_total_routing_fee_msat_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_ptr);
41395         max_total_routing_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat));
41396         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
41397         *ret_conv = ChannelManager_pay_for_offer(&this_arg_conv, &offer_conv, quantity_conv, amount_msats_conv, payer_note_conv, payment_id_ref, retry_strategy_conv, max_total_routing_fee_msat_conv);
41398         return tag_ptr(ret_conv, true);
41399 }
41400
41401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1request_1refund_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t refund) {
41402         LDKChannelManager this_arg_conv;
41403         this_arg_conv.inner = untag_ptr(this_arg);
41404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41406         this_arg_conv.is_owned = false;
41407         LDKRefund refund_conv;
41408         refund_conv.inner = untag_ptr(refund);
41409         refund_conv.is_owned = ptr_is_owned(refund);
41410         CHECK_INNER_FIELD_ACCESS_OR_NULL(refund_conv);
41411         refund_conv.is_owned = false;
41412         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
41413         *ret_conv = ChannelManager_request_refund_payment(&this_arg_conv, &refund_conv);
41414         return tag_ptr(ret_conv, true);
41415 }
41416
41417 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) {
41418         LDKChannelManager this_arg_conv;
41419         this_arg_conv.inner = untag_ptr(this_arg);
41420         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41422         this_arg_conv.is_owned = false;
41423         void* min_value_msat_ptr = untag_ptr(min_value_msat);
41424         CHECK_ACCESS(min_value_msat_ptr);
41425         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
41426         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
41427         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
41428         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
41429         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
41430         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
41431         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
41432         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
41433         return tag_ptr(ret_conv, true);
41434 }
41435
41436 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) {
41437         LDKChannelManager this_arg_conv;
41438         this_arg_conv.inner = untag_ptr(this_arg);
41439         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41441         this_arg_conv.is_owned = false;
41442         LDKThirtyTwoBytes payment_hash_ref;
41443         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
41444         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
41445         void* min_value_msat_ptr = untag_ptr(min_value_msat);
41446         CHECK_ACCESS(min_value_msat_ptr);
41447         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
41448         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
41449         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
41450         CHECK_ACCESS(min_final_cltv_expiry_ptr);
41451         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
41452         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
41453         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
41454         *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);
41455         return tag_ptr(ret_conv, true);
41456 }
41457
41458 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) {
41459         LDKChannelManager this_arg_conv;
41460         this_arg_conv.inner = untag_ptr(this_arg);
41461         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41463         this_arg_conv.is_owned = false;
41464         LDKThirtyTwoBytes payment_hash_ref;
41465         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
41466         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
41467         LDKThirtyTwoBytes payment_secret_ref;
41468         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
41469         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
41470         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
41471         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
41472         return tag_ptr(ret_conv, true);
41473 }
41474
41475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
41476         LDKChannelManager this_arg_conv;
41477         this_arg_conv.inner = untag_ptr(this_arg);
41478         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41480         this_arg_conv.is_owned = false;
41481         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
41482         return ret_conv;
41483 }
41484
41485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
41486         LDKChannelManager this_arg_conv;
41487         this_arg_conv.inner = untag_ptr(this_arg);
41488         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41490         this_arg_conv.is_owned = false;
41491         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
41492         int64_t ret_ref = 0;
41493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41495         return ret_ref;
41496 }
41497
41498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1intercept_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
41499         LDKChannelManager this_arg_conv;
41500         this_arg_conv.inner = untag_ptr(this_arg);
41501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41503         this_arg_conv.is_owned = false;
41504         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
41505         return ret_conv;
41506 }
41507
41508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1compute_1inflight_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg) {
41509         LDKChannelManager this_arg_conv;
41510         this_arg_conv.inner = untag_ptr(this_arg);
41511         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41513         this_arg_conv.is_owned = false;
41514         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
41515         int64_t ret_ref = 0;
41516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41518         return ret_ref;
41519 }
41520
41521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
41522         LDKChannelManager this_arg_conv;
41523         this_arg_conv.inner = untag_ptr(this_arg);
41524         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41526         this_arg_conv.is_owned = false;
41527         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
41528         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
41529         return tag_ptr(ret_ret, true);
41530 }
41531
41532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
41533         LDKChannelManager this_arg_conv;
41534         this_arg_conv.inner = untag_ptr(this_arg);
41535         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41537         this_arg_conv.is_owned = false;
41538         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
41539         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
41540         return tag_ptr(ret_ret, true);
41541 }
41542
41543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
41544         LDKChannelManager this_arg_conv;
41545         this_arg_conv.inner = untag_ptr(this_arg);
41546         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41548         this_arg_conv.is_owned = false;
41549         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
41550         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
41551         return tag_ptr(ret_ret, true);
41552 }
41553
41554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
41555         LDKChannelManager this_arg_conv;
41556         this_arg_conv.inner = untag_ptr(this_arg);
41557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41559         this_arg_conv.is_owned = false;
41560         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
41561         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
41562         return tag_ptr(ret_ret, true);
41563 }
41564
41565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1event_1or_1persistence_1needed_1future(JNIEnv *env, jclass clz, int64_t this_arg) {
41566         LDKChannelManager this_arg_conv;
41567         this_arg_conv.inner = untag_ptr(this_arg);
41568         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41570         this_arg_conv.is_owned = false;
41571         LDKFuture ret_var = ChannelManager_get_event_or_persistence_needed_future(&this_arg_conv);
41572         int64_t ret_ref = 0;
41573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41575         return ret_ref;
41576 }
41577
41578 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1and_1clear_1needs_1persistence(JNIEnv *env, jclass clz, int64_t this_arg) {
41579         LDKChannelManager this_arg_conv;
41580         this_arg_conv.inner = untag_ptr(this_arg);
41581         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41583         this_arg_conv.is_owned = false;
41584         jboolean ret_conv = ChannelManager_get_and_clear_needs_persistence(&this_arg_conv);
41585         return ret_conv;
41586 }
41587
41588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
41589         LDKChannelManager this_arg_conv;
41590         this_arg_conv.inner = untag_ptr(this_arg);
41591         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41593         this_arg_conv.is_owned = false;
41594         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
41595         int64_t ret_ref = 0;
41596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41598         return ret_ref;
41599 }
41600
41601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
41602         LDKChannelManager this_arg_conv;
41603         this_arg_conv.inner = untag_ptr(this_arg);
41604         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41606         this_arg_conv.is_owned = false;
41607         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
41608         int64_t ret_ref = 0;
41609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41611         return ret_ref;
41612 }
41613
41614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
41615         LDKChannelManager this_arg_conv;
41616         this_arg_conv.inner = untag_ptr(this_arg);
41617         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41619         this_arg_conv.is_owned = false;
41620         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
41621         int64_t ret_ref = 0;
41622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41624         return ret_ref;
41625 }
41626
41627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
41628         LDKChannelManager this_arg_conv;
41629         this_arg_conv.inner = untag_ptr(this_arg);
41630         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41632         this_arg_conv.is_owned = false;
41633         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
41634         int64_t ret_ref = 0;
41635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41637         return ret_ref;
41638 }
41639
41640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1init_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
41641         LDKChannelManager this_arg_conv;
41642         this_arg_conv.inner = untag_ptr(this_arg);
41643         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41645         this_arg_conv.is_owned = false;
41646         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
41647         int64_t ret_ref = 0;
41648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41650         return ret_ref;
41651 }
41652
41653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
41654         LDKChannelManager this_arg_conv;
41655         this_arg_conv.inner = untag_ptr(this_arg);
41656         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41658         this_arg_conv.is_owned = false;
41659         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
41660         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
41661         return tag_ptr(ret_ret, true);
41662 }
41663
41664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1OffersMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
41665         LDKChannelManager this_arg_conv;
41666         this_arg_conv.inner = untag_ptr(this_arg);
41667         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41669         this_arg_conv.is_owned = false;
41670         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
41671         *ret_ret = ChannelManager_as_OffersMessageHandler(&this_arg_conv);
41672         return tag_ptr(ret_ret, true);
41673 }
41674
41675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_provided_1init_1features(JNIEnv *env, jclass clz, int64_t config) {
41676         LDKUserConfig config_conv;
41677         config_conv.inner = untag_ptr(config);
41678         config_conv.is_owned = ptr_is_owned(config);
41679         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
41680         config_conv.is_owned = false;
41681         LDKInitFeatures ret_var = provided_init_features(&config_conv);
41682         int64_t ret_ref = 0;
41683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41685         return ret_ref;
41686 }
41687
41688 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
41689         LDKCounterpartyForwardingInfo obj_conv;
41690         obj_conv.inner = untag_ptr(obj);
41691         obj_conv.is_owned = ptr_is_owned(obj);
41692         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41693         obj_conv.is_owned = false;
41694         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
41695         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41696         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41697         CVec_u8Z_free(ret_var);
41698         return ret_arr;
41699 }
41700
41701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41702         LDKu8slice ser_ref;
41703         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41704         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41705         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
41706         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
41707         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41708         return tag_ptr(ret_conv, true);
41709 }
41710
41711 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1write(JNIEnv *env, jclass clz, int64_t obj) {
41712         LDKChannelCounterparty obj_conv;
41713         obj_conv.inner = untag_ptr(obj);
41714         obj_conv.is_owned = ptr_is_owned(obj);
41715         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41716         obj_conv.is_owned = false;
41717         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
41718         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41719         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41720         CVec_u8Z_free(ret_var);
41721         return ret_arr;
41722 }
41723
41724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41725         LDKu8slice ser_ref;
41726         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41727         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41728         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
41729         *ret_conv = ChannelCounterparty_read(ser_ref);
41730         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41731         return tag_ptr(ret_conv, true);
41732 }
41733
41734 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1write(JNIEnv *env, jclass clz, int64_t obj) {
41735         LDKChannelDetails obj_conv;
41736         obj_conv.inner = untag_ptr(obj);
41737         obj_conv.is_owned = ptr_is_owned(obj);
41738         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41739         obj_conv.is_owned = false;
41740         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
41741         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41742         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41743         CVec_u8Z_free(ret_var);
41744         return ret_arr;
41745 }
41746
41747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41748         LDKu8slice ser_ref;
41749         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41750         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41751         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
41752         *ret_conv = ChannelDetails_read(ser_ref);
41753         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41754         return tag_ptr(ret_conv, true);
41755 }
41756
41757 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1write(JNIEnv *env, jclass clz, int64_t obj) {
41758         LDKPhantomRouteHints obj_conv;
41759         obj_conv.inner = untag_ptr(obj);
41760         obj_conv.is_owned = ptr_is_owned(obj);
41761         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41762         obj_conv.is_owned = false;
41763         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
41764         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41765         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41766         CVec_u8Z_free(ret_var);
41767         return ret_arr;
41768 }
41769
41770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41771         LDKu8slice ser_ref;
41772         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41773         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41774         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
41775         *ret_conv = PhantomRouteHints_read(ser_ref);
41776         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41777         return tag_ptr(ret_conv, true);
41778 }
41779
41780 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
41781         LDKChannelManager obj_conv;
41782         obj_conv.inner = untag_ptr(obj);
41783         obj_conv.is_owned = ptr_is_owned(obj);
41784         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41785         obj_conv.is_owned = false;
41786         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
41787         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41788         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41789         CVec_u8Z_free(ret_var);
41790         return ret_arr;
41791 }
41792
41793 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1write(JNIEnv *env, jclass clz, int64_t obj) {
41794         LDKChannelShutdownState* obj_conv = (LDKChannelShutdownState*)untag_ptr(obj);
41795         LDKCVec_u8Z ret_var = ChannelShutdownState_write(obj_conv);
41796         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41797         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41798         CVec_u8Z_free(ret_var);
41799         return ret_arr;
41800 }
41801
41802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41803         LDKu8slice ser_ref;
41804         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41805         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41806         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
41807         *ret_conv = ChannelShutdownState_read(ser_ref);
41808         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41809         return tag_ptr(ret_conv, true);
41810 }
41811
41812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41813         LDKChannelManagerReadArgs this_obj_conv;
41814         this_obj_conv.inner = untag_ptr(this_obj);
41815         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41817         ChannelManagerReadArgs_free(this_obj_conv);
41818 }
41819
41820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1entropy_1source(JNIEnv *env, jclass clz, int64_t this_ptr) {
41821         LDKChannelManagerReadArgs this_ptr_conv;
41822         this_ptr_conv.inner = untag_ptr(this_ptr);
41823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41825         this_ptr_conv.is_owned = false;
41826         // WARNING: This object doesn't live past this scope, needs clone!
41827         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
41828         return ret_ret;
41829 }
41830
41831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1entropy_1source(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41832         LDKChannelManagerReadArgs this_ptr_conv;
41833         this_ptr_conv.inner = untag_ptr(this_ptr);
41834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41836         this_ptr_conv.is_owned = false;
41837         void* val_ptr = untag_ptr(val);
41838         CHECK_ACCESS(val_ptr);
41839         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
41840         if (val_conv.free == LDKEntropySource_JCalls_free) {
41841                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41842                 LDKEntropySource_JCalls_cloned(&val_conv);
41843         }
41844         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
41845 }
41846
41847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1node_1signer(JNIEnv *env, jclass clz, int64_t this_ptr) {
41848         LDKChannelManagerReadArgs this_ptr_conv;
41849         this_ptr_conv.inner = untag_ptr(this_ptr);
41850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41852         this_ptr_conv.is_owned = false;
41853         // WARNING: This object doesn't live past this scope, needs clone!
41854         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
41855         return ret_ret;
41856 }
41857
41858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1node_1signer(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41859         LDKChannelManagerReadArgs this_ptr_conv;
41860         this_ptr_conv.inner = untag_ptr(this_ptr);
41861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41863         this_ptr_conv.is_owned = false;
41864         void* val_ptr = untag_ptr(val);
41865         CHECK_ACCESS(val_ptr);
41866         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
41867         if (val_conv.free == LDKNodeSigner_JCalls_free) {
41868                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41869                 LDKNodeSigner_JCalls_cloned(&val_conv);
41870         }
41871         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
41872 }
41873
41874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1signer_1provider(JNIEnv *env, jclass clz, int64_t this_ptr) {
41875         LDKChannelManagerReadArgs 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         // WARNING: This object doesn't live past this scope, needs clone!
41881         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
41882         return ret_ret;
41883 }
41884
41885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1signer_1provider(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41886         LDKChannelManagerReadArgs this_ptr_conv;
41887         this_ptr_conv.inner = untag_ptr(this_ptr);
41888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41890         this_ptr_conv.is_owned = false;
41891         void* val_ptr = untag_ptr(val);
41892         CHECK_ACCESS(val_ptr);
41893         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
41894         if (val_conv.free == LDKSignerProvider_JCalls_free) {
41895                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41896                 LDKSignerProvider_JCalls_cloned(&val_conv);
41897         }
41898         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
41899 }
41900
41901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
41902         LDKChannelManagerReadArgs this_ptr_conv;
41903         this_ptr_conv.inner = untag_ptr(this_ptr);
41904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41906         this_ptr_conv.is_owned = false;
41907         // WARNING: This object doesn't live past this scope, needs clone!
41908         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
41909         return ret_ret;
41910 }
41911
41912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41913         LDKChannelManagerReadArgs this_ptr_conv;
41914         this_ptr_conv.inner = untag_ptr(this_ptr);
41915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41917         this_ptr_conv.is_owned = false;
41918         void* val_ptr = untag_ptr(val);
41919         CHECK_ACCESS(val_ptr);
41920         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
41921         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
41922                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41923                 LDKFeeEstimator_JCalls_cloned(&val_conv);
41924         }
41925         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
41926 }
41927
41928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
41929         LDKChannelManagerReadArgs this_ptr_conv;
41930         this_ptr_conv.inner = untag_ptr(this_ptr);
41931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41933         this_ptr_conv.is_owned = false;
41934         // WARNING: This object doesn't live past this scope, needs clone!
41935         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
41936         return ret_ret;
41937 }
41938
41939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41940         LDKChannelManagerReadArgs this_ptr_conv;
41941         this_ptr_conv.inner = untag_ptr(this_ptr);
41942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41944         this_ptr_conv.is_owned = false;
41945         void* val_ptr = untag_ptr(val);
41946         CHECK_ACCESS(val_ptr);
41947         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
41948         if (val_conv.free == LDKWatch_JCalls_free) {
41949                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41950                 LDKWatch_JCalls_cloned(&val_conv);
41951         }
41952         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
41953 }
41954
41955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
41956         LDKChannelManagerReadArgs this_ptr_conv;
41957         this_ptr_conv.inner = untag_ptr(this_ptr);
41958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41960         this_ptr_conv.is_owned = false;
41961         // WARNING: This object doesn't live past this scope, needs clone!
41962         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
41963         return ret_ret;
41964 }
41965
41966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41967         LDKChannelManagerReadArgs this_ptr_conv;
41968         this_ptr_conv.inner = untag_ptr(this_ptr);
41969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41971         this_ptr_conv.is_owned = false;
41972         void* val_ptr = untag_ptr(val);
41973         CHECK_ACCESS(val_ptr);
41974         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
41975         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
41976                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41977                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
41978         }
41979         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
41980 }
41981
41982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1router(JNIEnv *env, jclass clz, int64_t this_ptr) {
41983         LDKChannelManagerReadArgs this_ptr_conv;
41984         this_ptr_conv.inner = untag_ptr(this_ptr);
41985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41987         this_ptr_conv.is_owned = false;
41988         // WARNING: This object doesn't live past this scope, needs clone!
41989         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
41990         return ret_ret;
41991 }
41992
41993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1router(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41994         LDKChannelManagerReadArgs this_ptr_conv;
41995         this_ptr_conv.inner = untag_ptr(this_ptr);
41996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41998         this_ptr_conv.is_owned = false;
41999         void* val_ptr = untag_ptr(val);
42000         CHECK_ACCESS(val_ptr);
42001         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
42002         if (val_conv.free == LDKRouter_JCalls_free) {
42003                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42004                 LDKRouter_JCalls_cloned(&val_conv);
42005         }
42006         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
42007 }
42008
42009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
42010         LDKChannelManagerReadArgs this_ptr_conv;
42011         this_ptr_conv.inner = untag_ptr(this_ptr);
42012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42014         this_ptr_conv.is_owned = false;
42015         // WARNING: This object doesn't live past this scope, needs clone!
42016         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
42017         return ret_ret;
42018 }
42019
42020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42021         LDKChannelManagerReadArgs this_ptr_conv;
42022         this_ptr_conv.inner = untag_ptr(this_ptr);
42023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42025         this_ptr_conv.is_owned = false;
42026         void* val_ptr = untag_ptr(val);
42027         CHECK_ACCESS(val_ptr);
42028         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
42029         if (val_conv.free == LDKLogger_JCalls_free) {
42030                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42031                 LDKLogger_JCalls_cloned(&val_conv);
42032         }
42033         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
42034 }
42035
42036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
42037         LDKChannelManagerReadArgs this_ptr_conv;
42038         this_ptr_conv.inner = untag_ptr(this_ptr);
42039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42041         this_ptr_conv.is_owned = false;
42042         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
42043         int64_t ret_ref = 0;
42044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42046         return ret_ref;
42047 }
42048
42049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42050         LDKChannelManagerReadArgs this_ptr_conv;
42051         this_ptr_conv.inner = untag_ptr(this_ptr);
42052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42054         this_ptr_conv.is_owned = false;
42055         LDKUserConfig val_conv;
42056         val_conv.inner = untag_ptr(val);
42057         val_conv.is_owned = ptr_is_owned(val);
42058         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42059         val_conv = UserConfig_clone(&val_conv);
42060         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
42061 }
42062
42063 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) {
42064         void* entropy_source_ptr = untag_ptr(entropy_source);
42065         CHECK_ACCESS(entropy_source_ptr);
42066         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
42067         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
42068                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42069                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
42070         }
42071         void* node_signer_ptr = untag_ptr(node_signer);
42072         CHECK_ACCESS(node_signer_ptr);
42073         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
42074         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
42075                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42076                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
42077         }
42078         void* signer_provider_ptr = untag_ptr(signer_provider);
42079         CHECK_ACCESS(signer_provider_ptr);
42080         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
42081         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
42082                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42083                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
42084         }
42085         void* fee_estimator_ptr = untag_ptr(fee_estimator);
42086         CHECK_ACCESS(fee_estimator_ptr);
42087         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
42088         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
42089                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42090                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
42091         }
42092         void* chain_monitor_ptr = untag_ptr(chain_monitor);
42093         CHECK_ACCESS(chain_monitor_ptr);
42094         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
42095         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
42096                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42097                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
42098         }
42099         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
42100         CHECK_ACCESS(tx_broadcaster_ptr);
42101         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
42102         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
42103                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42104                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
42105         }
42106         void* router_ptr = untag_ptr(router);
42107         CHECK_ACCESS(router_ptr);
42108         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
42109         if (router_conv.free == LDKRouter_JCalls_free) {
42110                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42111                 LDKRouter_JCalls_cloned(&router_conv);
42112         }
42113         void* logger_ptr = untag_ptr(logger);
42114         CHECK_ACCESS(logger_ptr);
42115         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
42116         if (logger_conv.free == LDKLogger_JCalls_free) {
42117                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42118                 LDKLogger_JCalls_cloned(&logger_conv);
42119         }
42120         LDKUserConfig default_config_conv;
42121         default_config_conv.inner = untag_ptr(default_config);
42122         default_config_conv.is_owned = ptr_is_owned(default_config);
42123         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
42124         default_config_conv = UserConfig_clone(&default_config_conv);
42125         LDKCVec_ChannelMonitorZ channel_monitors_constr;
42126         channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
42127         if (channel_monitors_constr.datalen > 0)
42128                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
42129         else
42130                 channel_monitors_constr.data = NULL;
42131         int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
42132         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
42133                 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
42134                 LDKChannelMonitor channel_monitors_conv_16_conv;
42135                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
42136                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
42137                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
42138                 channel_monitors_conv_16_conv.is_owned = false;
42139                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
42140         }
42141         (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
42142         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);
42143         int64_t ret_ref = 0;
42144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42146         return ret_ref;
42147 }
42148
42149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
42150         LDKu8slice ser_ref;
42151         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42152         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42153         LDKChannelManagerReadArgs arg_conv;
42154         arg_conv.inner = untag_ptr(arg);
42155         arg_conv.is_owned = ptr_is_owned(arg);
42156         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42157         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
42158         
42159         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
42160         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_read(ser_ref, arg_conv);
42161         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42162         return tag_ptr(ret_conv, true);
42163 }
42164
42165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42166         LDKExpandedKey this_obj_conv;
42167         this_obj_conv.inner = untag_ptr(this_obj);
42168         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42170         ExpandedKey_free(this_obj_conv);
42171 }
42172
42173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1new(JNIEnv *env, jclass clz, int8_tArray key_material) {
42174         uint8_t key_material_arr[32];
42175         CHECK((*env)->GetArrayLength(env, key_material) == 32);
42176         (*env)->GetByteArrayRegion(env, key_material, 0, 32, key_material_arr);
42177         uint8_t (*key_material_ref)[32] = &key_material_arr;
42178         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
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 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) {
42186         LDKExpandedKey keys_conv;
42187         keys_conv.inner = untag_ptr(keys);
42188         keys_conv.is_owned = ptr_is_owned(keys);
42189         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
42190         keys_conv.is_owned = false;
42191         void* min_value_msat_ptr = untag_ptr(min_value_msat);
42192         CHECK_ACCESS(min_value_msat_ptr);
42193         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
42194         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
42195         void* entropy_source_ptr = untag_ptr(entropy_source);
42196         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
42197         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
42198         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
42199         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
42200         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
42201         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
42202         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
42203         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
42204         return tag_ptr(ret_conv, true);
42205 }
42206
42207 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) {
42208         LDKExpandedKey keys_conv;
42209         keys_conv.inner = untag_ptr(keys);
42210         keys_conv.is_owned = ptr_is_owned(keys);
42211         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
42212         keys_conv.is_owned = false;
42213         void* min_value_msat_ptr = untag_ptr(min_value_msat);
42214         CHECK_ACCESS(min_value_msat_ptr);
42215         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
42216         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
42217         LDKThirtyTwoBytes payment_hash_ref;
42218         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
42219         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
42220         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
42221         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
42222         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
42223         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
42224         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
42225         *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);
42226         return tag_ptr(ret_conv, true);
42227 }
42228
42229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42230         if (!ptr_is_owned(this_ptr)) return;
42231         void* this_ptr_ptr = untag_ptr(this_ptr);
42232         CHECK_ACCESS(this_ptr_ptr);
42233         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
42234         FREE(untag_ptr(this_ptr));
42235         DecodeError_free(this_ptr_conv);
42236 }
42237
42238 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
42239         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
42240         *ret_copy = DecodeError_clone(arg);
42241         int64_t ret_ref = tag_ptr(ret_copy, true);
42242         return ret_ref;
42243 }
42244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42245         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
42246         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
42247         return ret_conv;
42248 }
42249
42250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42251         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
42252         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
42253         *ret_copy = DecodeError_clone(orig_conv);
42254         int64_t ret_ref = tag_ptr(ret_copy, true);
42255         return ret_ref;
42256 }
42257
42258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unknown_1version(JNIEnv *env, jclass clz) {
42259         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
42260         *ret_copy = DecodeError_unknown_version();
42261         int64_t ret_ref = tag_ptr(ret_copy, true);
42262         return ret_ref;
42263 }
42264
42265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unknown_1required_1feature(JNIEnv *env, jclass clz) {
42266         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
42267         *ret_copy = DecodeError_unknown_required_feature();
42268         int64_t ret_ref = tag_ptr(ret_copy, true);
42269         return ret_ref;
42270 }
42271
42272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1invalid_1value(JNIEnv *env, jclass clz) {
42273         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
42274         *ret_copy = DecodeError_invalid_value();
42275         int64_t ret_ref = tag_ptr(ret_copy, true);
42276         return ret_ref;
42277 }
42278
42279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1short_1read(JNIEnv *env, jclass clz) {
42280         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
42281         *ret_copy = DecodeError_short_read();
42282         int64_t ret_ref = tag_ptr(ret_copy, true);
42283         return ret_ref;
42284 }
42285
42286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1bad_1length_1descriptor(JNIEnv *env, jclass clz) {
42287         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
42288         *ret_copy = DecodeError_bad_length_descriptor();
42289         int64_t ret_ref = tag_ptr(ret_copy, true);
42290         return ret_ref;
42291 }
42292
42293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1io(JNIEnv *env, jclass clz, jclass a) {
42294         LDKIOError a_conv = LDKIOError_from_java(env, a);
42295         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
42296         *ret_copy = DecodeError_io(a_conv);
42297         int64_t ret_ref = tag_ptr(ret_copy, true);
42298         return ret_ref;
42299 }
42300
42301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unsupported_1compression(JNIEnv *env, jclass clz) {
42302         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
42303         *ret_copy = DecodeError_unsupported_compression();
42304         int64_t ret_ref = tag_ptr(ret_copy, true);
42305         return ret_ref;
42306 }
42307
42308 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DecodeError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42309         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
42310         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
42311         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
42312         return ret_conv;
42313 }
42314
42315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42316         LDKInit this_obj_conv;
42317         this_obj_conv.inner = untag_ptr(this_obj);
42318         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42320         Init_free(this_obj_conv);
42321 }
42322
42323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
42324         LDKInit this_ptr_conv;
42325         this_ptr_conv.inner = untag_ptr(this_ptr);
42326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42328         this_ptr_conv.is_owned = false;
42329         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
42330         int64_t ret_ref = 0;
42331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42333         return ret_ref;
42334 }
42335
42336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42337         LDKInit this_ptr_conv;
42338         this_ptr_conv.inner = untag_ptr(this_ptr);
42339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42341         this_ptr_conv.is_owned = false;
42342         LDKInitFeatures val_conv;
42343         val_conv.inner = untag_ptr(val);
42344         val_conv.is_owned = ptr_is_owned(val);
42345         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42346         val_conv = InitFeatures_clone(&val_conv);
42347         Init_set_features(&this_ptr_conv, val_conv);
42348 }
42349
42350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1networks(JNIEnv *env, jclass clz, int64_t this_ptr) {
42351         LDKInit this_ptr_conv;
42352         this_ptr_conv.inner = untag_ptr(this_ptr);
42353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42355         this_ptr_conv.is_owned = false;
42356         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
42357         *ret_copy = Init_get_networks(&this_ptr_conv);
42358         int64_t ret_ref = tag_ptr(ret_copy, true);
42359         return ret_ref;
42360 }
42361
42362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1networks(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42363         LDKInit this_ptr_conv;
42364         this_ptr_conv.inner = untag_ptr(this_ptr);
42365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42367         this_ptr_conv.is_owned = false;
42368         void* val_ptr = untag_ptr(val);
42369         CHECK_ACCESS(val_ptr);
42370         LDKCOption_CVec_ThirtyTwoBytesZZ val_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(val_ptr);
42371         val_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(val));
42372         Init_set_networks(&this_ptr_conv, val_conv);
42373 }
42374
42375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr) {
42376         LDKInit this_ptr_conv;
42377         this_ptr_conv.inner = untag_ptr(this_ptr);
42378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42380         this_ptr_conv.is_owned = false;
42381         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
42382         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
42383         int64_t ret_ref = tag_ptr(ret_copy, true);
42384         return ret_ref;
42385 }
42386
42387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42388         LDKInit this_ptr_conv;
42389         this_ptr_conv.inner = untag_ptr(this_ptr);
42390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42392         this_ptr_conv.is_owned = false;
42393         void* val_ptr = untag_ptr(val);
42394         CHECK_ACCESS(val_ptr);
42395         LDKCOption_SocketAddressZ val_conv = *(LDKCOption_SocketAddressZ*)(val_ptr);
42396         val_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(val));
42397         Init_set_remote_network_address(&this_ptr_conv, val_conv);
42398 }
42399
42400 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) {
42401         LDKInitFeatures features_arg_conv;
42402         features_arg_conv.inner = untag_ptr(features_arg);
42403         features_arg_conv.is_owned = ptr_is_owned(features_arg);
42404         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
42405         features_arg_conv = InitFeatures_clone(&features_arg_conv);
42406         void* networks_arg_ptr = untag_ptr(networks_arg);
42407         CHECK_ACCESS(networks_arg_ptr);
42408         LDKCOption_CVec_ThirtyTwoBytesZZ networks_arg_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(networks_arg_ptr);
42409         networks_arg_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(networks_arg));
42410         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
42411         CHECK_ACCESS(remote_network_address_arg_ptr);
42412         LDKCOption_SocketAddressZ remote_network_address_arg_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_arg_ptr);
42413         LDKInit ret_var = Init_new(features_arg_conv, networks_arg_conv, remote_network_address_arg_conv);
42414         int64_t ret_ref = 0;
42415         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42416         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42417         return ret_ref;
42418 }
42419
42420 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
42421         LDKInit ret_var = Init_clone(arg);
42422         int64_t ret_ref = 0;
42423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42425         return ret_ref;
42426 }
42427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42428         LDKInit arg_conv;
42429         arg_conv.inner = untag_ptr(arg);
42430         arg_conv.is_owned = ptr_is_owned(arg);
42431         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42432         arg_conv.is_owned = false;
42433         int64_t ret_conv = Init_clone_ptr(&arg_conv);
42434         return ret_conv;
42435 }
42436
42437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42438         LDKInit orig_conv;
42439         orig_conv.inner = untag_ptr(orig);
42440         orig_conv.is_owned = ptr_is_owned(orig);
42441         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42442         orig_conv.is_owned = false;
42443         LDKInit ret_var = Init_clone(&orig_conv);
42444         int64_t ret_ref = 0;
42445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42447         return ret_ref;
42448 }
42449
42450 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Init_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42451         LDKInit a_conv;
42452         a_conv.inner = untag_ptr(a);
42453         a_conv.is_owned = ptr_is_owned(a);
42454         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42455         a_conv.is_owned = false;
42456         LDKInit b_conv;
42457         b_conv.inner = untag_ptr(b);
42458         b_conv.is_owned = ptr_is_owned(b);
42459         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42460         b_conv.is_owned = false;
42461         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
42462         return ret_conv;
42463 }
42464
42465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42466         LDKErrorMessage this_obj_conv;
42467         this_obj_conv.inner = untag_ptr(this_obj);
42468         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42470         ErrorMessage_free(this_obj_conv);
42471 }
42472
42473 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42474         LDKErrorMessage this_ptr_conv;
42475         this_ptr_conv.inner = untag_ptr(this_ptr);
42476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42478         this_ptr_conv.is_owned = false;
42479         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42480         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
42481         return ret_arr;
42482 }
42483
42484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42485         LDKErrorMessage this_ptr_conv;
42486         this_ptr_conv.inner = untag_ptr(this_ptr);
42487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42489         this_ptr_conv.is_owned = false;
42490         LDKThirtyTwoBytes val_ref;
42491         CHECK((*env)->GetArrayLength(env, val) == 32);
42492         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42493         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
42494 }
42495
42496 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
42497         LDKErrorMessage this_ptr_conv;
42498         this_ptr_conv.inner = untag_ptr(this_ptr);
42499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42501         this_ptr_conv.is_owned = false;
42502         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
42503         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
42504         Str_free(ret_str);
42505         return ret_conv;
42506 }
42507
42508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
42509         LDKErrorMessage this_ptr_conv;
42510         this_ptr_conv.inner = untag_ptr(this_ptr);
42511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42513         this_ptr_conv.is_owned = false;
42514         LDKStr val_conv = java_to_owned_str(env, val);
42515         ErrorMessage_set_data(&this_ptr_conv, val_conv);
42516 }
42517
42518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
42519         LDKThirtyTwoBytes channel_id_arg_ref;
42520         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
42521         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
42522         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
42523         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
42524         int64_t ret_ref = 0;
42525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42527         return ret_ref;
42528 }
42529
42530 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
42531         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
42532         int64_t ret_ref = 0;
42533         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42534         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42535         return ret_ref;
42536 }
42537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42538         LDKErrorMessage arg_conv;
42539         arg_conv.inner = untag_ptr(arg);
42540         arg_conv.is_owned = ptr_is_owned(arg);
42541         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42542         arg_conv.is_owned = false;
42543         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
42544         return ret_conv;
42545 }
42546
42547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42548         LDKErrorMessage orig_conv;
42549         orig_conv.inner = untag_ptr(orig);
42550         orig_conv.is_owned = ptr_is_owned(orig);
42551         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42552         orig_conv.is_owned = false;
42553         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
42554         int64_t ret_ref = 0;
42555         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42556         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42557         return ret_ref;
42558 }
42559
42560 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42561         LDKErrorMessage a_conv;
42562         a_conv.inner = untag_ptr(a);
42563         a_conv.is_owned = ptr_is_owned(a);
42564         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42565         a_conv.is_owned = false;
42566         LDKErrorMessage b_conv;
42567         b_conv.inner = untag_ptr(b);
42568         b_conv.is_owned = ptr_is_owned(b);
42569         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42570         b_conv.is_owned = false;
42571         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
42572         return ret_conv;
42573 }
42574
42575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42576         LDKWarningMessage this_obj_conv;
42577         this_obj_conv.inner = untag_ptr(this_obj);
42578         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42580         WarningMessage_free(this_obj_conv);
42581 }
42582
42583 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42584         LDKWarningMessage this_ptr_conv;
42585         this_ptr_conv.inner = untag_ptr(this_ptr);
42586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42588         this_ptr_conv.is_owned = false;
42589         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42590         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *WarningMessage_get_channel_id(&this_ptr_conv));
42591         return ret_arr;
42592 }
42593
42594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42595         LDKWarningMessage this_ptr_conv;
42596         this_ptr_conv.inner = untag_ptr(this_ptr);
42597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42599         this_ptr_conv.is_owned = false;
42600         LDKThirtyTwoBytes val_ref;
42601         CHECK((*env)->GetArrayLength(env, val) == 32);
42602         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42603         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
42604 }
42605
42606 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
42607         LDKWarningMessage this_ptr_conv;
42608         this_ptr_conv.inner = untag_ptr(this_ptr);
42609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42611         this_ptr_conv.is_owned = false;
42612         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
42613         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
42614         Str_free(ret_str);
42615         return ret_conv;
42616 }
42617
42618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
42619         LDKWarningMessage this_ptr_conv;
42620         this_ptr_conv.inner = untag_ptr(this_ptr);
42621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42623         this_ptr_conv.is_owned = false;
42624         LDKStr val_conv = java_to_owned_str(env, val);
42625         WarningMessage_set_data(&this_ptr_conv, val_conv);
42626 }
42627
42628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
42629         LDKThirtyTwoBytes channel_id_arg_ref;
42630         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
42631         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
42632         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
42633         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
42634         int64_t ret_ref = 0;
42635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42637         return ret_ref;
42638 }
42639
42640 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
42641         LDKWarningMessage ret_var = WarningMessage_clone(arg);
42642         int64_t ret_ref = 0;
42643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42645         return ret_ref;
42646 }
42647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42648         LDKWarningMessage arg_conv;
42649         arg_conv.inner = untag_ptr(arg);
42650         arg_conv.is_owned = ptr_is_owned(arg);
42651         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42652         arg_conv.is_owned = false;
42653         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
42654         return ret_conv;
42655 }
42656
42657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42658         LDKWarningMessage orig_conv;
42659         orig_conv.inner = untag_ptr(orig);
42660         orig_conv.is_owned = ptr_is_owned(orig);
42661         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42662         orig_conv.is_owned = false;
42663         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
42664         int64_t ret_ref = 0;
42665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42667         return ret_ref;
42668 }
42669
42670 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_WarningMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42671         LDKWarningMessage a_conv;
42672         a_conv.inner = untag_ptr(a);
42673         a_conv.is_owned = ptr_is_owned(a);
42674         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42675         a_conv.is_owned = false;
42676         LDKWarningMessage b_conv;
42677         b_conv.inner = untag_ptr(b);
42678         b_conv.is_owned = ptr_is_owned(b);
42679         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42680         b_conv.is_owned = false;
42681         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
42682         return ret_conv;
42683 }
42684
42685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42686         LDKPing this_obj_conv;
42687         this_obj_conv.inner = untag_ptr(this_obj);
42688         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42690         Ping_free(this_obj_conv);
42691 }
42692
42693 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
42694         LDKPing this_ptr_conv;
42695         this_ptr_conv.inner = untag_ptr(this_ptr);
42696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42698         this_ptr_conv.is_owned = false;
42699         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
42700         return ret_conv;
42701 }
42702
42703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
42704         LDKPing this_ptr_conv;
42705         this_ptr_conv.inner = untag_ptr(this_ptr);
42706         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42708         this_ptr_conv.is_owned = false;
42709         Ping_set_ponglen(&this_ptr_conv, val);
42710 }
42711
42712 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
42713         LDKPing this_ptr_conv;
42714         this_ptr_conv.inner = untag_ptr(this_ptr);
42715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42717         this_ptr_conv.is_owned = false;
42718         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
42719         return ret_conv;
42720 }
42721
42722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
42723         LDKPing this_ptr_conv;
42724         this_ptr_conv.inner = untag_ptr(this_ptr);
42725         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42727         this_ptr_conv.is_owned = false;
42728         Ping_set_byteslen(&this_ptr_conv, val);
42729 }
42730
42731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
42732         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
42733         int64_t ret_ref = 0;
42734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42736         return ret_ref;
42737 }
42738
42739 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
42740         LDKPing ret_var = Ping_clone(arg);
42741         int64_t ret_ref = 0;
42742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42744         return ret_ref;
42745 }
42746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42747         LDKPing arg_conv;
42748         arg_conv.inner = untag_ptr(arg);
42749         arg_conv.is_owned = ptr_is_owned(arg);
42750         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42751         arg_conv.is_owned = false;
42752         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
42753         return ret_conv;
42754 }
42755
42756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42757         LDKPing orig_conv;
42758         orig_conv.inner = untag_ptr(orig);
42759         orig_conv.is_owned = ptr_is_owned(orig);
42760         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42761         orig_conv.is_owned = false;
42762         LDKPing ret_var = Ping_clone(&orig_conv);
42763         int64_t ret_ref = 0;
42764         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42765         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42766         return ret_ref;
42767 }
42768
42769 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Ping_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42770         LDKPing a_conv;
42771         a_conv.inner = untag_ptr(a);
42772         a_conv.is_owned = ptr_is_owned(a);
42773         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42774         a_conv.is_owned = false;
42775         LDKPing b_conv;
42776         b_conv.inner = untag_ptr(b);
42777         b_conv.is_owned = ptr_is_owned(b);
42778         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42779         b_conv.is_owned = false;
42780         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
42781         return ret_conv;
42782 }
42783
42784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42785         LDKPong this_obj_conv;
42786         this_obj_conv.inner = untag_ptr(this_obj);
42787         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42789         Pong_free(this_obj_conv);
42790 }
42791
42792 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
42793         LDKPong 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         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
42799         return ret_conv;
42800 }
42801
42802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
42803         LDKPong this_ptr_conv;
42804         this_ptr_conv.inner = untag_ptr(this_ptr);
42805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42807         this_ptr_conv.is_owned = false;
42808         Pong_set_byteslen(&this_ptr_conv, val);
42809 }
42810
42811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
42812         LDKPong ret_var = Pong_new(byteslen_arg);
42813         int64_t ret_ref = 0;
42814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42816         return ret_ref;
42817 }
42818
42819 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
42820         LDKPong ret_var = Pong_clone(arg);
42821         int64_t ret_ref = 0;
42822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42824         return ret_ref;
42825 }
42826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42827         LDKPong arg_conv;
42828         arg_conv.inner = untag_ptr(arg);
42829         arg_conv.is_owned = ptr_is_owned(arg);
42830         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42831         arg_conv.is_owned = false;
42832         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
42833         return ret_conv;
42834 }
42835
42836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42837         LDKPong orig_conv;
42838         orig_conv.inner = untag_ptr(orig);
42839         orig_conv.is_owned = ptr_is_owned(orig);
42840         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42841         orig_conv.is_owned = false;
42842         LDKPong ret_var = Pong_clone(&orig_conv);
42843         int64_t ret_ref = 0;
42844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42846         return ret_ref;
42847 }
42848
42849 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Pong_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42850         LDKPong a_conv;
42851         a_conv.inner = untag_ptr(a);
42852         a_conv.is_owned = ptr_is_owned(a);
42853         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42854         a_conv.is_owned = false;
42855         LDKPong b_conv;
42856         b_conv.inner = untag_ptr(b);
42857         b_conv.is_owned = ptr_is_owned(b);
42858         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42859         b_conv.is_owned = false;
42860         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
42861         return ret_conv;
42862 }
42863
42864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42865         LDKOpenChannel this_obj_conv;
42866         this_obj_conv.inner = untag_ptr(this_obj);
42867         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42869         OpenChannel_free(this_obj_conv);
42870 }
42871
42872 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
42873         LDKOpenChannel this_ptr_conv;
42874         this_ptr_conv.inner = untag_ptr(this_ptr);
42875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42877         this_ptr_conv.is_owned = false;
42878         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42879         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
42880         return ret_arr;
42881 }
42882
42883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42884         LDKOpenChannel this_ptr_conv;
42885         this_ptr_conv.inner = untag_ptr(this_ptr);
42886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42888         this_ptr_conv.is_owned = false;
42889         LDKThirtyTwoBytes val_ref;
42890         CHECK((*env)->GetArrayLength(env, val) == 32);
42891         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42892         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
42893 }
42894
42895 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42896         LDKOpenChannel this_ptr_conv;
42897         this_ptr_conv.inner = untag_ptr(this_ptr);
42898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42900         this_ptr_conv.is_owned = false;
42901         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42902         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
42903         return ret_arr;
42904 }
42905
42906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42907         LDKOpenChannel this_ptr_conv;
42908         this_ptr_conv.inner = untag_ptr(this_ptr);
42909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42911         this_ptr_conv.is_owned = false;
42912         LDKThirtyTwoBytes val_ref;
42913         CHECK((*env)->GetArrayLength(env, val) == 32);
42914         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42915         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
42916 }
42917
42918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
42919         LDKOpenChannel 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         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
42925         return ret_conv;
42926 }
42927
42928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42929         LDKOpenChannel 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         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
42935 }
42936
42937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42938         LDKOpenChannel 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         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
42944         return ret_conv;
42945 }
42946
42947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42948         LDKOpenChannel 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         OpenChannel_set_push_msat(&this_ptr_conv, val);
42954 }
42955
42956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
42957         LDKOpenChannel 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         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
42963         return ret_conv;
42964 }
42965
42966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42967         LDKOpenChannel 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         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
42973 }
42974
42975 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) {
42976         LDKOpenChannel 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         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
42982         return ret_conv;
42983 }
42984
42985 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) {
42986         LDKOpenChannel this_ptr_conv;
42987         this_ptr_conv.inner = untag_ptr(this_ptr);
42988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42990         this_ptr_conv.is_owned = false;
42991         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
42992 }
42993
42994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
42995         LDKOpenChannel this_ptr_conv;
42996         this_ptr_conv.inner = untag_ptr(this_ptr);
42997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42999         this_ptr_conv.is_owned = false;
43000         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
43001         return ret_conv;
43002 }
43003
43004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43005         LDKOpenChannel this_ptr_conv;
43006         this_ptr_conv.inner = untag_ptr(this_ptr);
43007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43009         this_ptr_conv.is_owned = false;
43010         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
43011 }
43012
43013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43014         LDKOpenChannel this_ptr_conv;
43015         this_ptr_conv.inner = untag_ptr(this_ptr);
43016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43018         this_ptr_conv.is_owned = false;
43019         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
43020         return ret_conv;
43021 }
43022
43023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43024         LDKOpenChannel this_ptr_conv;
43025         this_ptr_conv.inner = untag_ptr(this_ptr);
43026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43028         this_ptr_conv.is_owned = false;
43029         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
43030 }
43031
43032 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
43033         LDKOpenChannel 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         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
43039         return ret_conv;
43040 }
43041
43042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43043         LDKOpenChannel this_ptr_conv;
43044         this_ptr_conv.inner = untag_ptr(this_ptr);
43045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43047         this_ptr_conv.is_owned = false;
43048         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
43049 }
43050
43051 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
43052         LDKOpenChannel this_ptr_conv;
43053         this_ptr_conv.inner = untag_ptr(this_ptr);
43054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43056         this_ptr_conv.is_owned = false;
43057         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
43058         return ret_conv;
43059 }
43060
43061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
43062         LDKOpenChannel this_ptr_conv;
43063         this_ptr_conv.inner = untag_ptr(this_ptr);
43064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43066         this_ptr_conv.is_owned = false;
43067         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
43068 }
43069
43070 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
43071         LDKOpenChannel this_ptr_conv;
43072         this_ptr_conv.inner = untag_ptr(this_ptr);
43073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43075         this_ptr_conv.is_owned = false;
43076         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
43077         return ret_conv;
43078 }
43079
43080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
43081         LDKOpenChannel this_ptr_conv;
43082         this_ptr_conv.inner = untag_ptr(this_ptr);
43083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43085         this_ptr_conv.is_owned = false;
43086         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
43087 }
43088
43089 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43090         LDKOpenChannel this_ptr_conv;
43091         this_ptr_conv.inner = untag_ptr(this_ptr);
43092         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43094         this_ptr_conv.is_owned = false;
43095         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43096         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
43097         return ret_arr;
43098 }
43099
43100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43101         LDKOpenChannel this_ptr_conv;
43102         this_ptr_conv.inner = untag_ptr(this_ptr);
43103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43105         this_ptr_conv.is_owned = false;
43106         LDKPublicKey val_ref;
43107         CHECK((*env)->GetArrayLength(env, val) == 33);
43108         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43109         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
43110 }
43111
43112 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43113         LDKOpenChannel this_ptr_conv;
43114         this_ptr_conv.inner = untag_ptr(this_ptr);
43115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43117         this_ptr_conv.is_owned = false;
43118         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43119         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
43120         return ret_arr;
43121 }
43122
43123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43124         LDKOpenChannel this_ptr_conv;
43125         this_ptr_conv.inner = untag_ptr(this_ptr);
43126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43128         this_ptr_conv.is_owned = false;
43129         LDKPublicKey val_ref;
43130         CHECK((*env)->GetArrayLength(env, val) == 33);
43131         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43132         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
43133 }
43134
43135 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
43136         LDKOpenChannel this_ptr_conv;
43137         this_ptr_conv.inner = untag_ptr(this_ptr);
43138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43140         this_ptr_conv.is_owned = false;
43141         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43142         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
43143         return ret_arr;
43144 }
43145
43146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43147         LDKOpenChannel 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         LDKPublicKey val_ref;
43153         CHECK((*env)->GetArrayLength(env, val) == 33);
43154         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43155         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
43156 }
43157
43158 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43159         LDKOpenChannel this_ptr_conv;
43160         this_ptr_conv.inner = untag_ptr(this_ptr);
43161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43163         this_ptr_conv.is_owned = false;
43164         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43165         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
43166         return ret_arr;
43167 }
43168
43169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43170         LDKOpenChannel this_ptr_conv;
43171         this_ptr_conv.inner = untag_ptr(this_ptr);
43172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43174         this_ptr_conv.is_owned = false;
43175         LDKPublicKey val_ref;
43176         CHECK((*env)->GetArrayLength(env, val) == 33);
43177         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43178         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
43179 }
43180
43181 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43182         LDKOpenChannel this_ptr_conv;
43183         this_ptr_conv.inner = untag_ptr(this_ptr);
43184         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43186         this_ptr_conv.is_owned = false;
43187         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43188         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
43189         return ret_arr;
43190 }
43191
43192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43193         LDKOpenChannel this_ptr_conv;
43194         this_ptr_conv.inner = untag_ptr(this_ptr);
43195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43197         this_ptr_conv.is_owned = false;
43198         LDKPublicKey val_ref;
43199         CHECK((*env)->GetArrayLength(env, val) == 33);
43200         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43201         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
43202 }
43203
43204 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
43205         LDKOpenChannel this_ptr_conv;
43206         this_ptr_conv.inner = untag_ptr(this_ptr);
43207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43209         this_ptr_conv.is_owned = false;
43210         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43211         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
43212         return ret_arr;
43213 }
43214
43215 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) {
43216         LDKOpenChannel this_ptr_conv;
43217         this_ptr_conv.inner = untag_ptr(this_ptr);
43218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43220         this_ptr_conv.is_owned = false;
43221         LDKPublicKey val_ref;
43222         CHECK((*env)->GetArrayLength(env, val) == 33);
43223         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43224         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
43225 }
43226
43227 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
43228         LDKOpenChannel this_ptr_conv;
43229         this_ptr_conv.inner = untag_ptr(this_ptr);
43230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43232         this_ptr_conv.is_owned = false;
43233         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
43234         return ret_conv;
43235 }
43236
43237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
43238         LDKOpenChannel this_ptr_conv;
43239         this_ptr_conv.inner = untag_ptr(this_ptr);
43240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43242         this_ptr_conv.is_owned = false;
43243         OpenChannel_set_channel_flags(&this_ptr_conv, val);
43244 }
43245
43246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43247         LDKOpenChannel this_ptr_conv;
43248         this_ptr_conv.inner = untag_ptr(this_ptr);
43249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43251         this_ptr_conv.is_owned = false;
43252         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
43253         *ret_copy = OpenChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
43254         int64_t ret_ref = tag_ptr(ret_copy, true);
43255         return ret_ref;
43256 }
43257
43258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43259         LDKOpenChannel this_ptr_conv;
43260         this_ptr_conv.inner = untag_ptr(this_ptr);
43261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43263         this_ptr_conv.is_owned = false;
43264         void* val_ptr = untag_ptr(val);
43265         CHECK_ACCESS(val_ptr);
43266         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
43267         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
43268         OpenChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
43269 }
43270
43271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
43272         LDKOpenChannel this_ptr_conv;
43273         this_ptr_conv.inner = untag_ptr(this_ptr);
43274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43276         this_ptr_conv.is_owned = false;
43277         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
43278         int64_t ret_ref = 0;
43279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43281         return ret_ref;
43282 }
43283
43284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43285         LDKOpenChannel this_ptr_conv;
43286         this_ptr_conv.inner = untag_ptr(this_ptr);
43287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43289         this_ptr_conv.is_owned = false;
43290         LDKChannelTypeFeatures val_conv;
43291         val_conv.inner = untag_ptr(val);
43292         val_conv.is_owned = ptr_is_owned(val);
43293         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43294         val_conv = ChannelTypeFeatures_clone(&val_conv);
43295         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
43296 }
43297
43298 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) {
43299         LDKThirtyTwoBytes chain_hash_arg_ref;
43300         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
43301         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
43302         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
43303         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
43304         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
43305         LDKPublicKey funding_pubkey_arg_ref;
43306         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
43307         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
43308         LDKPublicKey revocation_basepoint_arg_ref;
43309         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
43310         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
43311         LDKPublicKey payment_point_arg_ref;
43312         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
43313         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
43314         LDKPublicKey delayed_payment_basepoint_arg_ref;
43315         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
43316         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
43317         LDKPublicKey htlc_basepoint_arg_ref;
43318         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
43319         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
43320         LDKPublicKey first_per_commitment_point_arg_ref;
43321         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
43322         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
43323         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
43324         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
43325         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
43326         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
43327         LDKChannelTypeFeatures channel_type_arg_conv;
43328         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
43329         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
43330         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
43331         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
43332         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);
43333         int64_t ret_ref = 0;
43334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43336         return ret_ref;
43337 }
43338
43339 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
43340         LDKOpenChannel ret_var = OpenChannel_clone(arg);
43341         int64_t ret_ref = 0;
43342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43344         return ret_ref;
43345 }
43346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43347         LDKOpenChannel arg_conv;
43348         arg_conv.inner = untag_ptr(arg);
43349         arg_conv.is_owned = ptr_is_owned(arg);
43350         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43351         arg_conv.is_owned = false;
43352         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
43353         return ret_conv;
43354 }
43355
43356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43357         LDKOpenChannel orig_conv;
43358         orig_conv.inner = untag_ptr(orig);
43359         orig_conv.is_owned = ptr_is_owned(orig);
43360         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43361         orig_conv.is_owned = false;
43362         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
43363         int64_t ret_ref = 0;
43364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43366         return ret_ref;
43367 }
43368
43369 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OpenChannel_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43370         LDKOpenChannel a_conv;
43371         a_conv.inner = untag_ptr(a);
43372         a_conv.is_owned = ptr_is_owned(a);
43373         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43374         a_conv.is_owned = false;
43375         LDKOpenChannel b_conv;
43376         b_conv.inner = untag_ptr(b);
43377         b_conv.is_owned = ptr_is_owned(b);
43378         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43379         b_conv.is_owned = false;
43380         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
43381         return ret_conv;
43382 }
43383
43384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43385         LDKOpenChannelV2 this_obj_conv;
43386         this_obj_conv.inner = untag_ptr(this_obj);
43387         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43389         OpenChannelV2_free(this_obj_conv);
43390 }
43391
43392 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
43393         LDKOpenChannelV2 this_ptr_conv;
43394         this_ptr_conv.inner = untag_ptr(this_ptr);
43395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43397         this_ptr_conv.is_owned = false;
43398         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43399         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannelV2_get_chain_hash(&this_ptr_conv));
43400         return ret_arr;
43401 }
43402
43403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43404         LDKOpenChannelV2 this_ptr_conv;
43405         this_ptr_conv.inner = untag_ptr(this_ptr);
43406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43408         this_ptr_conv.is_owned = false;
43409         LDKThirtyTwoBytes val_ref;
43410         CHECK((*env)->GetArrayLength(env, val) == 32);
43411         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
43412         OpenChannelV2_set_chain_hash(&this_ptr_conv, val_ref);
43413 }
43414
43415 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
43416         LDKOpenChannelV2 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43422         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannelV2_get_temporary_channel_id(&this_ptr_conv));
43423         return ret_arr;
43424 }
43425
43426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43427         LDKOpenChannelV2 this_ptr_conv;
43428         this_ptr_conv.inner = untag_ptr(this_ptr);
43429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43431         this_ptr_conv.is_owned = false;
43432         LDKThirtyTwoBytes val_ref;
43433         CHECK((*env)->GetArrayLength(env, val) == 32);
43434         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
43435         OpenChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
43436 }
43437
43438 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) {
43439         LDKOpenChannelV2 this_ptr_conv;
43440         this_ptr_conv.inner = untag_ptr(this_ptr);
43441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43443         this_ptr_conv.is_owned = false;
43444         int32_t ret_conv = OpenChannelV2_get_funding_feerate_sat_per_1000_weight(&this_ptr_conv);
43445         return ret_conv;
43446 }
43447
43448 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) {
43449         LDKOpenChannelV2 this_ptr_conv;
43450         this_ptr_conv.inner = untag_ptr(this_ptr);
43451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43453         this_ptr_conv.is_owned = false;
43454         OpenChannelV2_set_funding_feerate_sat_per_1000_weight(&this_ptr_conv, val);
43455 }
43456
43457 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) {
43458         LDKOpenChannelV2 this_ptr_conv;
43459         this_ptr_conv.inner = untag_ptr(this_ptr);
43460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43462         this_ptr_conv.is_owned = false;
43463         int32_t ret_conv = OpenChannelV2_get_commitment_feerate_sat_per_1000_weight(&this_ptr_conv);
43464         return ret_conv;
43465 }
43466
43467 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) {
43468         LDKOpenChannelV2 this_ptr_conv;
43469         this_ptr_conv.inner = untag_ptr(this_ptr);
43470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43472         this_ptr_conv.is_owned = false;
43473         OpenChannelV2_set_commitment_feerate_sat_per_1000_weight(&this_ptr_conv, val);
43474 }
43475
43476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
43477         LDKOpenChannelV2 this_ptr_conv;
43478         this_ptr_conv.inner = untag_ptr(this_ptr);
43479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43481         this_ptr_conv.is_owned = false;
43482         int64_t ret_conv = OpenChannelV2_get_funding_satoshis(&this_ptr_conv);
43483         return ret_conv;
43484 }
43485
43486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43487         LDKOpenChannelV2 this_ptr_conv;
43488         this_ptr_conv.inner = untag_ptr(this_ptr);
43489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43491         this_ptr_conv.is_owned = false;
43492         OpenChannelV2_set_funding_satoshis(&this_ptr_conv, val);
43493 }
43494
43495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
43496         LDKOpenChannelV2 this_ptr_conv;
43497         this_ptr_conv.inner = untag_ptr(this_ptr);
43498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43500         this_ptr_conv.is_owned = false;
43501         int64_t ret_conv = OpenChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
43502         return ret_conv;
43503 }
43504
43505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43506         LDKOpenChannelV2 this_ptr_conv;
43507         this_ptr_conv.inner = untag_ptr(this_ptr);
43508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43510         this_ptr_conv.is_owned = false;
43511         OpenChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
43512 }
43513
43514 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) {
43515         LDKOpenChannelV2 this_ptr_conv;
43516         this_ptr_conv.inner = untag_ptr(this_ptr);
43517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43519         this_ptr_conv.is_owned = false;
43520         int64_t ret_conv = OpenChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
43521         return ret_conv;
43522 }
43523
43524 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) {
43525         LDKOpenChannelV2 this_ptr_conv;
43526         this_ptr_conv.inner = untag_ptr(this_ptr);
43527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43529         this_ptr_conv.is_owned = false;
43530         OpenChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
43531 }
43532
43533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43534         LDKOpenChannelV2 this_ptr_conv;
43535         this_ptr_conv.inner = untag_ptr(this_ptr);
43536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43538         this_ptr_conv.is_owned = false;
43539         int64_t ret_conv = OpenChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
43540         return ret_conv;
43541 }
43542
43543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43544         LDKOpenChannelV2 this_ptr_conv;
43545         this_ptr_conv.inner = untag_ptr(this_ptr);
43546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43548         this_ptr_conv.is_owned = false;
43549         OpenChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
43550 }
43551
43552 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
43553         LDKOpenChannelV2 this_ptr_conv;
43554         this_ptr_conv.inner = untag_ptr(this_ptr);
43555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43557         this_ptr_conv.is_owned = false;
43558         int16_t ret_conv = OpenChannelV2_get_to_self_delay(&this_ptr_conv);
43559         return ret_conv;
43560 }
43561
43562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
43563         LDKOpenChannelV2 this_ptr_conv;
43564         this_ptr_conv.inner = untag_ptr(this_ptr);
43565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43567         this_ptr_conv.is_owned = false;
43568         OpenChannelV2_set_to_self_delay(&this_ptr_conv, val);
43569 }
43570
43571 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
43572         LDKOpenChannelV2 this_ptr_conv;
43573         this_ptr_conv.inner = untag_ptr(this_ptr);
43574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43576         this_ptr_conv.is_owned = false;
43577         int16_t ret_conv = OpenChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
43578         return ret_conv;
43579 }
43580
43581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
43582         LDKOpenChannelV2 this_ptr_conv;
43583         this_ptr_conv.inner = untag_ptr(this_ptr);
43584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43586         this_ptr_conv.is_owned = false;
43587         OpenChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
43588 }
43589
43590 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr) {
43591         LDKOpenChannelV2 this_ptr_conv;
43592         this_ptr_conv.inner = untag_ptr(this_ptr);
43593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43595         this_ptr_conv.is_owned = false;
43596         int32_t ret_conv = OpenChannelV2_get_locktime(&this_ptr_conv);
43597         return ret_conv;
43598 }
43599
43600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43601         LDKOpenChannelV2 this_ptr_conv;
43602         this_ptr_conv.inner = untag_ptr(this_ptr);
43603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43605         this_ptr_conv.is_owned = false;
43606         OpenChannelV2_set_locktime(&this_ptr_conv, val);
43607 }
43608
43609 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43610         LDKOpenChannelV2 this_ptr_conv;
43611         this_ptr_conv.inner = untag_ptr(this_ptr);
43612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43614         this_ptr_conv.is_owned = false;
43615         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43616         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form);
43617         return ret_arr;
43618 }
43619
43620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43621         LDKOpenChannelV2 this_ptr_conv;
43622         this_ptr_conv.inner = untag_ptr(this_ptr);
43623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43625         this_ptr_conv.is_owned = false;
43626         LDKPublicKey val_ref;
43627         CHECK((*env)->GetArrayLength(env, val) == 33);
43628         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43629         OpenChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
43630 }
43631
43632 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43633         LDKOpenChannelV2 this_ptr_conv;
43634         this_ptr_conv.inner = untag_ptr(this_ptr);
43635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43637         this_ptr_conv.is_owned = false;
43638         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43639         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form);
43640         return ret_arr;
43641 }
43642
43643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43644         LDKOpenChannelV2 this_ptr_conv;
43645         this_ptr_conv.inner = untag_ptr(this_ptr);
43646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43648         this_ptr_conv.is_owned = false;
43649         LDKPublicKey val_ref;
43650         CHECK((*env)->GetArrayLength(env, val) == 33);
43651         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43652         OpenChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
43653 }
43654
43655 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43656         LDKOpenChannelV2 this_ptr_conv;
43657         this_ptr_conv.inner = untag_ptr(this_ptr);
43658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43660         this_ptr_conv.is_owned = false;
43661         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43662         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form);
43663         return ret_arr;
43664 }
43665
43666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43667         LDKOpenChannelV2 this_ptr_conv;
43668         this_ptr_conv.inner = untag_ptr(this_ptr);
43669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43671         this_ptr_conv.is_owned = false;
43672         LDKPublicKey val_ref;
43673         CHECK((*env)->GetArrayLength(env, val) == 33);
43674         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43675         OpenChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
43676 }
43677
43678 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43679         LDKOpenChannelV2 this_ptr_conv;
43680         this_ptr_conv.inner = untag_ptr(this_ptr);
43681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43683         this_ptr_conv.is_owned = false;
43684         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43685         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
43686         return ret_arr;
43687 }
43688
43689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43690         LDKOpenChannelV2 this_ptr_conv;
43691         this_ptr_conv.inner = untag_ptr(this_ptr);
43692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43694         this_ptr_conv.is_owned = false;
43695         LDKPublicKey val_ref;
43696         CHECK((*env)->GetArrayLength(env, val) == 33);
43697         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43698         OpenChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
43699 }
43700
43701 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43702         LDKOpenChannelV2 this_ptr_conv;
43703         this_ptr_conv.inner = untag_ptr(this_ptr);
43704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43706         this_ptr_conv.is_owned = false;
43707         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43708         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form);
43709         return ret_arr;
43710 }
43711
43712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43713         LDKOpenChannelV2 this_ptr_conv;
43714         this_ptr_conv.inner = untag_ptr(this_ptr);
43715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43717         this_ptr_conv.is_owned = false;
43718         LDKPublicKey val_ref;
43719         CHECK((*env)->GetArrayLength(env, val) == 33);
43720         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43721         OpenChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
43722 }
43723
43724 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
43725         LDKOpenChannelV2 this_ptr_conv;
43726         this_ptr_conv.inner = untag_ptr(this_ptr);
43727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43729         this_ptr_conv.is_owned = false;
43730         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43731         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
43732         return ret_arr;
43733 }
43734
43735 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) {
43736         LDKOpenChannelV2 this_ptr_conv;
43737         this_ptr_conv.inner = untag_ptr(this_ptr);
43738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43740         this_ptr_conv.is_owned = false;
43741         LDKPublicKey val_ref;
43742         CHECK((*env)->GetArrayLength(env, val) == 33);
43743         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43744         OpenChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
43745 }
43746
43747 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1second_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
43748         LDKOpenChannelV2 this_ptr_conv;
43749         this_ptr_conv.inner = untag_ptr(this_ptr);
43750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43752         this_ptr_conv.is_owned = false;
43753         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43754         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form);
43755         return ret_arr;
43756 }
43757
43758 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) {
43759         LDKOpenChannelV2 this_ptr_conv;
43760         this_ptr_conv.inner = untag_ptr(this_ptr);
43761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43763         this_ptr_conv.is_owned = false;
43764         LDKPublicKey val_ref;
43765         CHECK((*env)->GetArrayLength(env, val) == 33);
43766         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43767         OpenChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
43768 }
43769
43770 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
43771         LDKOpenChannelV2 this_ptr_conv;
43772         this_ptr_conv.inner = untag_ptr(this_ptr);
43773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43775         this_ptr_conv.is_owned = false;
43776         int8_t ret_conv = OpenChannelV2_get_channel_flags(&this_ptr_conv);
43777         return ret_conv;
43778 }
43779
43780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
43781         LDKOpenChannelV2 this_ptr_conv;
43782         this_ptr_conv.inner = untag_ptr(this_ptr);
43783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43785         this_ptr_conv.is_owned = false;
43786         OpenChannelV2_set_channel_flags(&this_ptr_conv, val);
43787 }
43788
43789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43790         LDKOpenChannelV2 this_ptr_conv;
43791         this_ptr_conv.inner = untag_ptr(this_ptr);
43792         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43794         this_ptr_conv.is_owned = false;
43795         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
43796         *ret_copy = OpenChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
43797         int64_t ret_ref = tag_ptr(ret_copy, true);
43798         return ret_ref;
43799 }
43800
43801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43802         LDKOpenChannelV2 this_ptr_conv;
43803         this_ptr_conv.inner = untag_ptr(this_ptr);
43804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43806         this_ptr_conv.is_owned = false;
43807         void* val_ptr = untag_ptr(val);
43808         CHECK_ACCESS(val_ptr);
43809         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
43810         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
43811         OpenChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
43812 }
43813
43814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
43815         LDKOpenChannelV2 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         LDKChannelTypeFeatures ret_var = OpenChannelV2_get_channel_type(&this_ptr_conv);
43821         int64_t ret_ref = 0;
43822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43824         return ret_ref;
43825 }
43826
43827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43828         LDKOpenChannelV2 this_ptr_conv;
43829         this_ptr_conv.inner = untag_ptr(this_ptr);
43830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43832         this_ptr_conv.is_owned = false;
43833         LDKChannelTypeFeatures val_conv;
43834         val_conv.inner = untag_ptr(val);
43835         val_conv.is_owned = ptr_is_owned(val);
43836         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43837         val_conv = ChannelTypeFeatures_clone(&val_conv);
43838         OpenChannelV2_set_channel_type(&this_ptr_conv, val_conv);
43839 }
43840
43841 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr) {
43842         LDKOpenChannelV2 this_ptr_conv;
43843         this_ptr_conv.inner = untag_ptr(this_ptr);
43844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43846         this_ptr_conv.is_owned = false;
43847         jclass ret_conv = LDKCOption_NoneZ_to_java(env, OpenChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
43848         return ret_conv;
43849 }
43850
43851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
43852         LDKOpenChannelV2 this_ptr_conv;
43853         this_ptr_conv.inner = untag_ptr(this_ptr);
43854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43856         this_ptr_conv.is_owned = false;
43857         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
43858         OpenChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
43859 }
43860
43861 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) {
43862         LDKThirtyTwoBytes chain_hash_arg_ref;
43863         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
43864         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
43865         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
43866         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
43867         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
43868         LDKPublicKey funding_pubkey_arg_ref;
43869         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
43870         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
43871         LDKPublicKey revocation_basepoint_arg_ref;
43872         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
43873         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
43874         LDKPublicKey payment_basepoint_arg_ref;
43875         CHECK((*env)->GetArrayLength(env, payment_basepoint_arg) == 33);
43876         (*env)->GetByteArrayRegion(env, payment_basepoint_arg, 0, 33, payment_basepoint_arg_ref.compressed_form);
43877         LDKPublicKey delayed_payment_basepoint_arg_ref;
43878         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
43879         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
43880         LDKPublicKey htlc_basepoint_arg_ref;
43881         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
43882         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
43883         LDKPublicKey first_per_commitment_point_arg_ref;
43884         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
43885         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
43886         LDKPublicKey second_per_commitment_point_arg_ref;
43887         CHECK((*env)->GetArrayLength(env, second_per_commitment_point_arg) == 33);
43888         (*env)->GetByteArrayRegion(env, second_per_commitment_point_arg, 0, 33, second_per_commitment_point_arg_ref.compressed_form);
43889         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
43890         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
43891         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
43892         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
43893         LDKChannelTypeFeatures channel_type_arg_conv;
43894         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
43895         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
43896         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
43897         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
43898         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_java(env, require_confirmed_inputs_arg);
43899         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);
43900         int64_t ret_ref = 0;
43901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43903         return ret_ref;
43904 }
43905
43906 static inline uint64_t OpenChannelV2_clone_ptr(LDKOpenChannelV2 *NONNULL_PTR arg) {
43907         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(arg);
43908         int64_t ret_ref = 0;
43909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43911         return ret_ref;
43912 }
43913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43914         LDKOpenChannelV2 arg_conv;
43915         arg_conv.inner = untag_ptr(arg);
43916         arg_conv.is_owned = ptr_is_owned(arg);
43917         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43918         arg_conv.is_owned = false;
43919         int64_t ret_conv = OpenChannelV2_clone_ptr(&arg_conv);
43920         return ret_conv;
43921 }
43922
43923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43924         LDKOpenChannelV2 orig_conv;
43925         orig_conv.inner = untag_ptr(orig);
43926         orig_conv.is_owned = ptr_is_owned(orig);
43927         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43928         orig_conv.is_owned = false;
43929         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(&orig_conv);
43930         int64_t ret_ref = 0;
43931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43933         return ret_ref;
43934 }
43935
43936 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43937         LDKOpenChannelV2 a_conv;
43938         a_conv.inner = untag_ptr(a);
43939         a_conv.is_owned = ptr_is_owned(a);
43940         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43941         a_conv.is_owned = false;
43942         LDKOpenChannelV2 b_conv;
43943         b_conv.inner = untag_ptr(b);
43944         b_conv.is_owned = ptr_is_owned(b);
43945         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43946         b_conv.is_owned = false;
43947         jboolean ret_conv = OpenChannelV2_eq(&a_conv, &b_conv);
43948         return ret_conv;
43949 }
43950
43951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43952         LDKAcceptChannel this_obj_conv;
43953         this_obj_conv.inner = untag_ptr(this_obj);
43954         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43956         AcceptChannel_free(this_obj_conv);
43957 }
43958
43959 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
43960         LDKAcceptChannel this_ptr_conv;
43961         this_ptr_conv.inner = untag_ptr(this_ptr);
43962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43964         this_ptr_conv.is_owned = false;
43965         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43966         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
43967         return ret_arr;
43968 }
43969
43970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43971         LDKAcceptChannel this_ptr_conv;
43972         this_ptr_conv.inner = untag_ptr(this_ptr);
43973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43975         this_ptr_conv.is_owned = false;
43976         LDKThirtyTwoBytes val_ref;
43977         CHECK((*env)->GetArrayLength(env, val) == 32);
43978         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
43979         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
43980 }
43981
43982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
43983         LDKAcceptChannel this_ptr_conv;
43984         this_ptr_conv.inner = untag_ptr(this_ptr);
43985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43987         this_ptr_conv.is_owned = false;
43988         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
43989         return ret_conv;
43990 }
43991
43992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43993         LDKAcceptChannel this_ptr_conv;
43994         this_ptr_conv.inner = untag_ptr(this_ptr);
43995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43997         this_ptr_conv.is_owned = false;
43998         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
43999 }
44000
44001 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) {
44002         LDKAcceptChannel this_ptr_conv;
44003         this_ptr_conv.inner = untag_ptr(this_ptr);
44004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44006         this_ptr_conv.is_owned = false;
44007         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
44008         return ret_conv;
44009 }
44010
44011 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) {
44012         LDKAcceptChannel this_ptr_conv;
44013         this_ptr_conv.inner = untag_ptr(this_ptr);
44014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44016         this_ptr_conv.is_owned = false;
44017         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
44018 }
44019
44020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
44021         LDKAcceptChannel this_ptr_conv;
44022         this_ptr_conv.inner = untag_ptr(this_ptr);
44023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44025         this_ptr_conv.is_owned = false;
44026         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
44027         return ret_conv;
44028 }
44029
44030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44031         LDKAcceptChannel this_ptr_conv;
44032         this_ptr_conv.inner = untag_ptr(this_ptr);
44033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44035         this_ptr_conv.is_owned = false;
44036         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
44037 }
44038
44039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44040         LDKAcceptChannel this_ptr_conv;
44041         this_ptr_conv.inner = untag_ptr(this_ptr);
44042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44044         this_ptr_conv.is_owned = false;
44045         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
44046         return ret_conv;
44047 }
44048
44049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44050         LDKAcceptChannel this_ptr_conv;
44051         this_ptr_conv.inner = untag_ptr(this_ptr);
44052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44054         this_ptr_conv.is_owned = false;
44055         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
44056 }
44057
44058 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
44059         LDKAcceptChannel this_ptr_conv;
44060         this_ptr_conv.inner = untag_ptr(this_ptr);
44061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44063         this_ptr_conv.is_owned = false;
44064         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
44065         return ret_conv;
44066 }
44067
44068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
44069         LDKAcceptChannel this_ptr_conv;
44070         this_ptr_conv.inner = untag_ptr(this_ptr);
44071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44073         this_ptr_conv.is_owned = false;
44074         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
44075 }
44076
44077 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
44078         LDKAcceptChannel this_ptr_conv;
44079         this_ptr_conv.inner = untag_ptr(this_ptr);
44080         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44082         this_ptr_conv.is_owned = false;
44083         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
44084         return ret_conv;
44085 }
44086
44087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
44088         LDKAcceptChannel this_ptr_conv;
44089         this_ptr_conv.inner = untag_ptr(this_ptr);
44090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44092         this_ptr_conv.is_owned = false;
44093         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
44094 }
44095
44096 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
44097         LDKAcceptChannel this_ptr_conv;
44098         this_ptr_conv.inner = untag_ptr(this_ptr);
44099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44101         this_ptr_conv.is_owned = false;
44102         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
44103         return ret_conv;
44104 }
44105
44106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
44107         LDKAcceptChannel this_ptr_conv;
44108         this_ptr_conv.inner = untag_ptr(this_ptr);
44109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44111         this_ptr_conv.is_owned = false;
44112         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
44113 }
44114
44115 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
44116         LDKAcceptChannel this_ptr_conv;
44117         this_ptr_conv.inner = untag_ptr(this_ptr);
44118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44120         this_ptr_conv.is_owned = false;
44121         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44122         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
44123         return ret_arr;
44124 }
44125
44126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44127         LDKAcceptChannel this_ptr_conv;
44128         this_ptr_conv.inner = untag_ptr(this_ptr);
44129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44131         this_ptr_conv.is_owned = false;
44132         LDKPublicKey val_ref;
44133         CHECK((*env)->GetArrayLength(env, val) == 33);
44134         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44135         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
44136 }
44137
44138 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
44139         LDKAcceptChannel this_ptr_conv;
44140         this_ptr_conv.inner = untag_ptr(this_ptr);
44141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44143         this_ptr_conv.is_owned = false;
44144         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44145         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
44146         return ret_arr;
44147 }
44148
44149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44150         LDKAcceptChannel this_ptr_conv;
44151         this_ptr_conv.inner = untag_ptr(this_ptr);
44152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44154         this_ptr_conv.is_owned = false;
44155         LDKPublicKey val_ref;
44156         CHECK((*env)->GetArrayLength(env, val) == 33);
44157         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44158         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
44159 }
44160
44161 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
44162         LDKAcceptChannel this_ptr_conv;
44163         this_ptr_conv.inner = untag_ptr(this_ptr);
44164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44166         this_ptr_conv.is_owned = false;
44167         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44168         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
44169         return ret_arr;
44170 }
44171
44172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44173         LDKAcceptChannel this_ptr_conv;
44174         this_ptr_conv.inner = untag_ptr(this_ptr);
44175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44177         this_ptr_conv.is_owned = false;
44178         LDKPublicKey val_ref;
44179         CHECK((*env)->GetArrayLength(env, val) == 33);
44180         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44181         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
44182 }
44183
44184 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
44185         LDKAcceptChannel this_ptr_conv;
44186         this_ptr_conv.inner = untag_ptr(this_ptr);
44187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44189         this_ptr_conv.is_owned = false;
44190         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44191         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
44192         return ret_arr;
44193 }
44194
44195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44196         LDKAcceptChannel this_ptr_conv;
44197         this_ptr_conv.inner = untag_ptr(this_ptr);
44198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44200         this_ptr_conv.is_owned = false;
44201         LDKPublicKey val_ref;
44202         CHECK((*env)->GetArrayLength(env, val) == 33);
44203         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44204         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
44205 }
44206
44207 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
44208         LDKAcceptChannel this_ptr_conv;
44209         this_ptr_conv.inner = untag_ptr(this_ptr);
44210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44212         this_ptr_conv.is_owned = false;
44213         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44214         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
44215         return ret_arr;
44216 }
44217
44218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44219         LDKAcceptChannel this_ptr_conv;
44220         this_ptr_conv.inner = untag_ptr(this_ptr);
44221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44223         this_ptr_conv.is_owned = false;
44224         LDKPublicKey val_ref;
44225         CHECK((*env)->GetArrayLength(env, val) == 33);
44226         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44227         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
44228 }
44229
44230 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
44231         LDKAcceptChannel this_ptr_conv;
44232         this_ptr_conv.inner = untag_ptr(this_ptr);
44233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44235         this_ptr_conv.is_owned = false;
44236         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44237         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
44238         return ret_arr;
44239 }
44240
44241 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) {
44242         LDKAcceptChannel this_ptr_conv;
44243         this_ptr_conv.inner = untag_ptr(this_ptr);
44244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44246         this_ptr_conv.is_owned = false;
44247         LDKPublicKey val_ref;
44248         CHECK((*env)->GetArrayLength(env, val) == 33);
44249         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44250         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
44251 }
44252
44253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
44254         LDKAcceptChannel this_ptr_conv;
44255         this_ptr_conv.inner = untag_ptr(this_ptr);
44256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44258         this_ptr_conv.is_owned = false;
44259         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
44260         *ret_copy = AcceptChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
44261         int64_t ret_ref = tag_ptr(ret_copy, true);
44262         return ret_ref;
44263 }
44264
44265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44266         LDKAcceptChannel this_ptr_conv;
44267         this_ptr_conv.inner = untag_ptr(this_ptr);
44268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44270         this_ptr_conv.is_owned = false;
44271         void* val_ptr = untag_ptr(val);
44272         CHECK_ACCESS(val_ptr);
44273         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
44274         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
44275         AcceptChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
44276 }
44277
44278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
44279         LDKAcceptChannel this_ptr_conv;
44280         this_ptr_conv.inner = untag_ptr(this_ptr);
44281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44283         this_ptr_conv.is_owned = false;
44284         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
44285         int64_t ret_ref = 0;
44286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44288         return ret_ref;
44289 }
44290
44291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44292         LDKAcceptChannel this_ptr_conv;
44293         this_ptr_conv.inner = untag_ptr(this_ptr);
44294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44296         this_ptr_conv.is_owned = false;
44297         LDKChannelTypeFeatures val_conv;
44298         val_conv.inner = untag_ptr(val);
44299         val_conv.is_owned = ptr_is_owned(val);
44300         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44301         val_conv = ChannelTypeFeatures_clone(&val_conv);
44302         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
44303 }
44304
44305 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) {
44306         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
44307         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
44308         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
44309         LDKPublicKey funding_pubkey_arg_ref;
44310         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
44311         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
44312         LDKPublicKey revocation_basepoint_arg_ref;
44313         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
44314         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
44315         LDKPublicKey payment_point_arg_ref;
44316         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
44317         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
44318         LDKPublicKey delayed_payment_basepoint_arg_ref;
44319         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
44320         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
44321         LDKPublicKey htlc_basepoint_arg_ref;
44322         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
44323         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
44324         LDKPublicKey first_per_commitment_point_arg_ref;
44325         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
44326         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
44327         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
44328         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
44329         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
44330         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
44331         LDKChannelTypeFeatures channel_type_arg_conv;
44332         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
44333         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
44334         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
44335         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
44336         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);
44337         int64_t ret_ref = 0;
44338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44340         return ret_ref;
44341 }
44342
44343 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
44344         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
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 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44351         LDKAcceptChannel arg_conv;
44352         arg_conv.inner = untag_ptr(arg);
44353         arg_conv.is_owned = ptr_is_owned(arg);
44354         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44355         arg_conv.is_owned = false;
44356         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
44357         return ret_conv;
44358 }
44359
44360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44361         LDKAcceptChannel orig_conv;
44362         orig_conv.inner = untag_ptr(orig);
44363         orig_conv.is_owned = ptr_is_owned(orig);
44364         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44365         orig_conv.is_owned = false;
44366         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
44367         int64_t ret_ref = 0;
44368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44370         return ret_ref;
44371 }
44372
44373 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44374         LDKAcceptChannel a_conv;
44375         a_conv.inner = untag_ptr(a);
44376         a_conv.is_owned = ptr_is_owned(a);
44377         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44378         a_conv.is_owned = false;
44379         LDKAcceptChannel b_conv;
44380         b_conv.inner = untag_ptr(b);
44381         b_conv.is_owned = ptr_is_owned(b);
44382         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44383         b_conv.is_owned = false;
44384         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
44385         return ret_conv;
44386 }
44387
44388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44389         LDKAcceptChannelV2 this_obj_conv;
44390         this_obj_conv.inner = untag_ptr(this_obj);
44391         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44393         AcceptChannelV2_free(this_obj_conv);
44394 }
44395
44396 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44397         LDKAcceptChannelV2 this_ptr_conv;
44398         this_ptr_conv.inner = untag_ptr(this_ptr);
44399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44401         this_ptr_conv.is_owned = false;
44402         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44403         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannelV2_get_temporary_channel_id(&this_ptr_conv));
44404         return ret_arr;
44405 }
44406
44407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44408         LDKAcceptChannelV2 this_ptr_conv;
44409         this_ptr_conv.inner = untag_ptr(this_ptr);
44410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44412         this_ptr_conv.is_owned = false;
44413         LDKThirtyTwoBytes val_ref;
44414         CHECK((*env)->GetArrayLength(env, val) == 32);
44415         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44416         AcceptChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
44417 }
44418
44419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
44420         LDKAcceptChannelV2 this_ptr_conv;
44421         this_ptr_conv.inner = untag_ptr(this_ptr);
44422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44424         this_ptr_conv.is_owned = false;
44425         int64_t ret_conv = AcceptChannelV2_get_funding_satoshis(&this_ptr_conv);
44426         return ret_conv;
44427 }
44428
44429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44430         LDKAcceptChannelV2 this_ptr_conv;
44431         this_ptr_conv.inner = untag_ptr(this_ptr);
44432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44434         this_ptr_conv.is_owned = false;
44435         AcceptChannelV2_set_funding_satoshis(&this_ptr_conv, val);
44436 }
44437
44438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
44439         LDKAcceptChannelV2 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         int64_t ret_conv = AcceptChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
44445         return ret_conv;
44446 }
44447
44448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44449         LDKAcceptChannelV2 this_ptr_conv;
44450         this_ptr_conv.inner = untag_ptr(this_ptr);
44451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44453         this_ptr_conv.is_owned = false;
44454         AcceptChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
44455 }
44456
44457 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) {
44458         LDKAcceptChannelV2 this_ptr_conv;
44459         this_ptr_conv.inner = untag_ptr(this_ptr);
44460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44462         this_ptr_conv.is_owned = false;
44463         int64_t ret_conv = AcceptChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
44464         return ret_conv;
44465 }
44466
44467 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) {
44468         LDKAcceptChannelV2 this_ptr_conv;
44469         this_ptr_conv.inner = untag_ptr(this_ptr);
44470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44472         this_ptr_conv.is_owned = false;
44473         AcceptChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
44474 }
44475
44476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44477         LDKAcceptChannelV2 this_ptr_conv;
44478         this_ptr_conv.inner = untag_ptr(this_ptr);
44479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44481         this_ptr_conv.is_owned = false;
44482         int64_t ret_conv = AcceptChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
44483         return ret_conv;
44484 }
44485
44486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44487         LDKAcceptChannelV2 this_ptr_conv;
44488         this_ptr_conv.inner = untag_ptr(this_ptr);
44489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44491         this_ptr_conv.is_owned = false;
44492         AcceptChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
44493 }
44494
44495 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
44496         LDKAcceptChannelV2 this_ptr_conv;
44497         this_ptr_conv.inner = untag_ptr(this_ptr);
44498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44500         this_ptr_conv.is_owned = false;
44501         int32_t ret_conv = AcceptChannelV2_get_minimum_depth(&this_ptr_conv);
44502         return ret_conv;
44503 }
44504
44505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
44506         LDKAcceptChannelV2 this_ptr_conv;
44507         this_ptr_conv.inner = untag_ptr(this_ptr);
44508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44510         this_ptr_conv.is_owned = false;
44511         AcceptChannelV2_set_minimum_depth(&this_ptr_conv, val);
44512 }
44513
44514 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
44515         LDKAcceptChannelV2 this_ptr_conv;
44516         this_ptr_conv.inner = untag_ptr(this_ptr);
44517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44519         this_ptr_conv.is_owned = false;
44520         int16_t ret_conv = AcceptChannelV2_get_to_self_delay(&this_ptr_conv);
44521         return ret_conv;
44522 }
44523
44524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
44525         LDKAcceptChannelV2 this_ptr_conv;
44526         this_ptr_conv.inner = untag_ptr(this_ptr);
44527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44529         this_ptr_conv.is_owned = false;
44530         AcceptChannelV2_set_to_self_delay(&this_ptr_conv, val);
44531 }
44532
44533 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
44534         LDKAcceptChannelV2 this_ptr_conv;
44535         this_ptr_conv.inner = untag_ptr(this_ptr);
44536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44538         this_ptr_conv.is_owned = false;
44539         int16_t ret_conv = AcceptChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
44540         return ret_conv;
44541 }
44542
44543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
44544         LDKAcceptChannelV2 this_ptr_conv;
44545         this_ptr_conv.inner = untag_ptr(this_ptr);
44546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44548         this_ptr_conv.is_owned = false;
44549         AcceptChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
44550 }
44551
44552 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
44553         LDKAcceptChannelV2 this_ptr_conv;
44554         this_ptr_conv.inner = untag_ptr(this_ptr);
44555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44557         this_ptr_conv.is_owned = false;
44558         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44559         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form);
44560         return ret_arr;
44561 }
44562
44563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44564         LDKAcceptChannelV2 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         LDKPublicKey val_ref;
44570         CHECK((*env)->GetArrayLength(env, val) == 33);
44571         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44572         AcceptChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
44573 }
44574
44575 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
44576         LDKAcceptChannelV2 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44582         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form);
44583         return ret_arr;
44584 }
44585
44586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44587         LDKAcceptChannelV2 this_ptr_conv;
44588         this_ptr_conv.inner = untag_ptr(this_ptr);
44589         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44591         this_ptr_conv.is_owned = false;
44592         LDKPublicKey val_ref;
44593         CHECK((*env)->GetArrayLength(env, val) == 33);
44594         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44595         AcceptChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
44596 }
44597
44598 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
44599         LDKAcceptChannelV2 this_ptr_conv;
44600         this_ptr_conv.inner = untag_ptr(this_ptr);
44601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44603         this_ptr_conv.is_owned = false;
44604         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44605         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form);
44606         return ret_arr;
44607 }
44608
44609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44610         LDKAcceptChannelV2 this_ptr_conv;
44611         this_ptr_conv.inner = untag_ptr(this_ptr);
44612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44614         this_ptr_conv.is_owned = false;
44615         LDKPublicKey val_ref;
44616         CHECK((*env)->GetArrayLength(env, val) == 33);
44617         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44618         AcceptChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
44619 }
44620
44621 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
44622         LDKAcceptChannelV2 this_ptr_conv;
44623         this_ptr_conv.inner = untag_ptr(this_ptr);
44624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44626         this_ptr_conv.is_owned = false;
44627         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44628         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
44629         return ret_arr;
44630 }
44631
44632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44633         LDKAcceptChannelV2 this_ptr_conv;
44634         this_ptr_conv.inner = untag_ptr(this_ptr);
44635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44637         this_ptr_conv.is_owned = false;
44638         LDKPublicKey val_ref;
44639         CHECK((*env)->GetArrayLength(env, val) == 33);
44640         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44641         AcceptChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
44642 }
44643
44644 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
44645         LDKAcceptChannelV2 this_ptr_conv;
44646         this_ptr_conv.inner = untag_ptr(this_ptr);
44647         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44649         this_ptr_conv.is_owned = false;
44650         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44651         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form);
44652         return ret_arr;
44653 }
44654
44655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44656         LDKAcceptChannelV2 this_ptr_conv;
44657         this_ptr_conv.inner = untag_ptr(this_ptr);
44658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44660         this_ptr_conv.is_owned = false;
44661         LDKPublicKey val_ref;
44662         CHECK((*env)->GetArrayLength(env, val) == 33);
44663         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44664         AcceptChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
44665 }
44666
44667 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
44668         LDKAcceptChannelV2 this_ptr_conv;
44669         this_ptr_conv.inner = untag_ptr(this_ptr);
44670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44672         this_ptr_conv.is_owned = false;
44673         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44674         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
44675         return ret_arr;
44676 }
44677
44678 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) {
44679         LDKAcceptChannelV2 this_ptr_conv;
44680         this_ptr_conv.inner = untag_ptr(this_ptr);
44681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44683         this_ptr_conv.is_owned = false;
44684         LDKPublicKey val_ref;
44685         CHECK((*env)->GetArrayLength(env, val) == 33);
44686         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44687         AcceptChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
44688 }
44689
44690 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1second_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
44691         LDKAcceptChannelV2 this_ptr_conv;
44692         this_ptr_conv.inner = untag_ptr(this_ptr);
44693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44695         this_ptr_conv.is_owned = false;
44696         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44697         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form);
44698         return ret_arr;
44699 }
44700
44701 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) {
44702         LDKAcceptChannelV2 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         LDKPublicKey val_ref;
44708         CHECK((*env)->GetArrayLength(env, val) == 33);
44709         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44710         AcceptChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
44711 }
44712
44713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
44714         LDKAcceptChannelV2 this_ptr_conv;
44715         this_ptr_conv.inner = untag_ptr(this_ptr);
44716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44718         this_ptr_conv.is_owned = false;
44719         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
44720         *ret_copy = AcceptChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
44721         int64_t ret_ref = tag_ptr(ret_copy, true);
44722         return ret_ref;
44723 }
44724
44725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44726         LDKAcceptChannelV2 this_ptr_conv;
44727         this_ptr_conv.inner = untag_ptr(this_ptr);
44728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44730         this_ptr_conv.is_owned = false;
44731         void* val_ptr = untag_ptr(val);
44732         CHECK_ACCESS(val_ptr);
44733         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
44734         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
44735         AcceptChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
44736 }
44737
44738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
44739         LDKAcceptChannelV2 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         LDKChannelTypeFeatures ret_var = AcceptChannelV2_get_channel_type(&this_ptr_conv);
44745         int64_t ret_ref = 0;
44746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44748         return ret_ref;
44749 }
44750
44751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44752         LDKAcceptChannelV2 this_ptr_conv;
44753         this_ptr_conv.inner = untag_ptr(this_ptr);
44754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44756         this_ptr_conv.is_owned = false;
44757         LDKChannelTypeFeatures val_conv;
44758         val_conv.inner = untag_ptr(val);
44759         val_conv.is_owned = ptr_is_owned(val);
44760         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44761         val_conv = ChannelTypeFeatures_clone(&val_conv);
44762         AcceptChannelV2_set_channel_type(&this_ptr_conv, val_conv);
44763 }
44764
44765 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr) {
44766         LDKAcceptChannelV2 this_ptr_conv;
44767         this_ptr_conv.inner = untag_ptr(this_ptr);
44768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44770         this_ptr_conv.is_owned = false;
44771         jclass ret_conv = LDKCOption_NoneZ_to_java(env, AcceptChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
44772         return ret_conv;
44773 }
44774
44775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
44776         LDKAcceptChannelV2 this_ptr_conv;
44777         this_ptr_conv.inner = untag_ptr(this_ptr);
44778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44780         this_ptr_conv.is_owned = false;
44781         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
44782         AcceptChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
44783 }
44784
44785 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) {
44786         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
44787         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
44788         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
44789         LDKPublicKey funding_pubkey_arg_ref;
44790         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
44791         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
44792         LDKPublicKey revocation_basepoint_arg_ref;
44793         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
44794         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
44795         LDKPublicKey payment_basepoint_arg_ref;
44796         CHECK((*env)->GetArrayLength(env, payment_basepoint_arg) == 33);
44797         (*env)->GetByteArrayRegion(env, payment_basepoint_arg, 0, 33, payment_basepoint_arg_ref.compressed_form);
44798         LDKPublicKey delayed_payment_basepoint_arg_ref;
44799         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
44800         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
44801         LDKPublicKey htlc_basepoint_arg_ref;
44802         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
44803         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
44804         LDKPublicKey first_per_commitment_point_arg_ref;
44805         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
44806         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
44807         LDKPublicKey second_per_commitment_point_arg_ref;
44808         CHECK((*env)->GetArrayLength(env, second_per_commitment_point_arg) == 33);
44809         (*env)->GetByteArrayRegion(env, second_per_commitment_point_arg, 0, 33, second_per_commitment_point_arg_ref.compressed_form);
44810         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
44811         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
44812         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
44813         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
44814         LDKChannelTypeFeatures channel_type_arg_conv;
44815         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
44816         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
44817         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
44818         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
44819         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_java(env, require_confirmed_inputs_arg);
44820         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);
44821         int64_t ret_ref = 0;
44822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44824         return ret_ref;
44825 }
44826
44827 static inline uint64_t AcceptChannelV2_clone_ptr(LDKAcceptChannelV2 *NONNULL_PTR arg) {
44828         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(arg);
44829         int64_t ret_ref = 0;
44830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44832         return ret_ref;
44833 }
44834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44835         LDKAcceptChannelV2 arg_conv;
44836         arg_conv.inner = untag_ptr(arg);
44837         arg_conv.is_owned = ptr_is_owned(arg);
44838         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44839         arg_conv.is_owned = false;
44840         int64_t ret_conv = AcceptChannelV2_clone_ptr(&arg_conv);
44841         return ret_conv;
44842 }
44843
44844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44845         LDKAcceptChannelV2 orig_conv;
44846         orig_conv.inner = untag_ptr(orig);
44847         orig_conv.is_owned = ptr_is_owned(orig);
44848         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44849         orig_conv.is_owned = false;
44850         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(&orig_conv);
44851         int64_t ret_ref = 0;
44852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44854         return ret_ref;
44855 }
44856
44857 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44858         LDKAcceptChannelV2 a_conv;
44859         a_conv.inner = untag_ptr(a);
44860         a_conv.is_owned = ptr_is_owned(a);
44861         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44862         a_conv.is_owned = false;
44863         LDKAcceptChannelV2 b_conv;
44864         b_conv.inner = untag_ptr(b);
44865         b_conv.is_owned = ptr_is_owned(b);
44866         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44867         b_conv.is_owned = false;
44868         jboolean ret_conv = AcceptChannelV2_eq(&a_conv, &b_conv);
44869         return ret_conv;
44870 }
44871
44872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44873         LDKFundingCreated this_obj_conv;
44874         this_obj_conv.inner = untag_ptr(this_obj);
44875         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44877         FundingCreated_free(this_obj_conv);
44878 }
44879
44880 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44881         LDKFundingCreated this_ptr_conv;
44882         this_ptr_conv.inner = untag_ptr(this_ptr);
44883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44885         this_ptr_conv.is_owned = false;
44886         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44887         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
44888         return ret_arr;
44889 }
44890
44891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44892         LDKFundingCreated this_ptr_conv;
44893         this_ptr_conv.inner = untag_ptr(this_ptr);
44894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44896         this_ptr_conv.is_owned = false;
44897         LDKThirtyTwoBytes val_ref;
44898         CHECK((*env)->GetArrayLength(env, val) == 32);
44899         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44900         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
44901 }
44902
44903 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
44904         LDKFundingCreated this_ptr_conv;
44905         this_ptr_conv.inner = untag_ptr(this_ptr);
44906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44908         this_ptr_conv.is_owned = false;
44909         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44910         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
44911         return ret_arr;
44912 }
44913
44914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44915         LDKFundingCreated this_ptr_conv;
44916         this_ptr_conv.inner = untag_ptr(this_ptr);
44917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44919         this_ptr_conv.is_owned = false;
44920         LDKThirtyTwoBytes val_ref;
44921         CHECK((*env)->GetArrayLength(env, val) == 32);
44922         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44923         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
44924 }
44925
44926 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
44927         LDKFundingCreated this_ptr_conv;
44928         this_ptr_conv.inner = untag_ptr(this_ptr);
44929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44931         this_ptr_conv.is_owned = false;
44932         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
44933         return ret_conv;
44934 }
44935
44936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
44937         LDKFundingCreated this_ptr_conv;
44938         this_ptr_conv.inner = untag_ptr(this_ptr);
44939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44941         this_ptr_conv.is_owned = false;
44942         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
44943 }
44944
44945 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
44946         LDKFundingCreated this_ptr_conv;
44947         this_ptr_conv.inner = untag_ptr(this_ptr);
44948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44950         this_ptr_conv.is_owned = false;
44951         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
44952         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
44953         return ret_arr;
44954 }
44955
44956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44957         LDKFundingCreated this_ptr_conv;
44958         this_ptr_conv.inner = untag_ptr(this_ptr);
44959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44961         this_ptr_conv.is_owned = false;
44962         LDKECDSASignature val_ref;
44963         CHECK((*env)->GetArrayLength(env, val) == 64);
44964         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
44965         FundingCreated_set_signature(&this_ptr_conv, val_ref);
44966 }
44967
44968 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) {
44969         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
44970         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
44971         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
44972         LDKThirtyTwoBytes funding_txid_arg_ref;
44973         CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
44974         (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
44975         LDKECDSASignature signature_arg_ref;
44976         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
44977         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
44978         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
44979         int64_t ret_ref = 0;
44980         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44981         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44982         return ret_ref;
44983 }
44984
44985 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
44986         LDKFundingCreated ret_var = FundingCreated_clone(arg);
44987         int64_t ret_ref = 0;
44988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44990         return ret_ref;
44991 }
44992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44993         LDKFundingCreated arg_conv;
44994         arg_conv.inner = untag_ptr(arg);
44995         arg_conv.is_owned = ptr_is_owned(arg);
44996         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44997         arg_conv.is_owned = false;
44998         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
44999         return ret_conv;
45000 }
45001
45002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45003         LDKFundingCreated orig_conv;
45004         orig_conv.inner = untag_ptr(orig);
45005         orig_conv.is_owned = ptr_is_owned(orig);
45006         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45007         orig_conv.is_owned = false;
45008         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
45009         int64_t ret_ref = 0;
45010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45012         return ret_ref;
45013 }
45014
45015 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_FundingCreated_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45016         LDKFundingCreated a_conv;
45017         a_conv.inner = untag_ptr(a);
45018         a_conv.is_owned = ptr_is_owned(a);
45019         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45020         a_conv.is_owned = false;
45021         LDKFundingCreated b_conv;
45022         b_conv.inner = untag_ptr(b);
45023         b_conv.is_owned = ptr_is_owned(b);
45024         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45025         b_conv.is_owned = false;
45026         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
45027         return ret_conv;
45028 }
45029
45030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45031         LDKFundingSigned this_obj_conv;
45032         this_obj_conv.inner = untag_ptr(this_obj);
45033         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45035         FundingSigned_free(this_obj_conv);
45036 }
45037
45038 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45039         LDKFundingSigned this_ptr_conv;
45040         this_ptr_conv.inner = untag_ptr(this_ptr);
45041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45043         this_ptr_conv.is_owned = false;
45044         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45045         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
45046         return ret_arr;
45047 }
45048
45049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45050         LDKFundingSigned this_ptr_conv;
45051         this_ptr_conv.inner = untag_ptr(this_ptr);
45052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45054         this_ptr_conv.is_owned = false;
45055         LDKThirtyTwoBytes val_ref;
45056         CHECK((*env)->GetArrayLength(env, val) == 32);
45057         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45058         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
45059 }
45060
45061 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
45062         LDKFundingSigned this_ptr_conv;
45063         this_ptr_conv.inner = untag_ptr(this_ptr);
45064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45066         this_ptr_conv.is_owned = false;
45067         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
45068         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
45069         return ret_arr;
45070 }
45071
45072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45073         LDKFundingSigned this_ptr_conv;
45074         this_ptr_conv.inner = untag_ptr(this_ptr);
45075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45077         this_ptr_conv.is_owned = false;
45078         LDKECDSASignature val_ref;
45079         CHECK((*env)->GetArrayLength(env, val) == 64);
45080         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
45081         FundingSigned_set_signature(&this_ptr_conv, val_ref);
45082 }
45083
45084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
45085         LDKThirtyTwoBytes channel_id_arg_ref;
45086         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45087         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45088         LDKECDSASignature signature_arg_ref;
45089         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
45090         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
45091         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
45092         int64_t ret_ref = 0;
45093         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45094         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45095         return ret_ref;
45096 }
45097
45098 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
45099         LDKFundingSigned ret_var = FundingSigned_clone(arg);
45100         int64_t ret_ref = 0;
45101         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45102         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45103         return ret_ref;
45104 }
45105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45106         LDKFundingSigned arg_conv;
45107         arg_conv.inner = untag_ptr(arg);
45108         arg_conv.is_owned = ptr_is_owned(arg);
45109         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45110         arg_conv.is_owned = false;
45111         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
45112         return ret_conv;
45113 }
45114
45115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45116         LDKFundingSigned orig_conv;
45117         orig_conv.inner = untag_ptr(orig);
45118         orig_conv.is_owned = ptr_is_owned(orig);
45119         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45120         orig_conv.is_owned = false;
45121         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
45122         int64_t ret_ref = 0;
45123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45125         return ret_ref;
45126 }
45127
45128 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_FundingSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45129         LDKFundingSigned a_conv;
45130         a_conv.inner = untag_ptr(a);
45131         a_conv.is_owned = ptr_is_owned(a);
45132         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45133         a_conv.is_owned = false;
45134         LDKFundingSigned b_conv;
45135         b_conv.inner = untag_ptr(b);
45136         b_conv.is_owned = ptr_is_owned(b);
45137         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45138         b_conv.is_owned = false;
45139         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
45140         return ret_conv;
45141 }
45142
45143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45144         LDKChannelReady this_obj_conv;
45145         this_obj_conv.inner = untag_ptr(this_obj);
45146         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45148         ChannelReady_free(this_obj_conv);
45149 }
45150
45151 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45152         LDKChannelReady this_ptr_conv;
45153         this_ptr_conv.inner = untag_ptr(this_ptr);
45154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45156         this_ptr_conv.is_owned = false;
45157         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45158         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReady_get_channel_id(&this_ptr_conv));
45159         return ret_arr;
45160 }
45161
45162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45163         LDKChannelReady this_ptr_conv;
45164         this_ptr_conv.inner = untag_ptr(this_ptr);
45165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45167         this_ptr_conv.is_owned = false;
45168         LDKThirtyTwoBytes val_ref;
45169         CHECK((*env)->GetArrayLength(env, val) == 32);
45170         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45171         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
45172 }
45173
45174 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
45175         LDKChannelReady this_ptr_conv;
45176         this_ptr_conv.inner = untag_ptr(this_ptr);
45177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45179         this_ptr_conv.is_owned = false;
45180         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45181         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
45182         return ret_arr;
45183 }
45184
45185 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) {
45186         LDKChannelReady this_ptr_conv;
45187         this_ptr_conv.inner = untag_ptr(this_ptr);
45188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45190         this_ptr_conv.is_owned = false;
45191         LDKPublicKey val_ref;
45192         CHECK((*env)->GetArrayLength(env, val) == 33);
45193         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
45194         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
45195 }
45196
45197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
45198         LDKChannelReady this_ptr_conv;
45199         this_ptr_conv.inner = untag_ptr(this_ptr);
45200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45202         this_ptr_conv.is_owned = false;
45203         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45204         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
45205         int64_t ret_ref = tag_ptr(ret_copy, true);
45206         return ret_ref;
45207 }
45208
45209 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) {
45210         LDKChannelReady this_ptr_conv;
45211         this_ptr_conv.inner = untag_ptr(this_ptr);
45212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45214         this_ptr_conv.is_owned = false;
45215         void* val_ptr = untag_ptr(val);
45216         CHECK_ACCESS(val_ptr);
45217         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
45218         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
45219         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
45220 }
45221
45222 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) {
45223         LDKThirtyTwoBytes channel_id_arg_ref;
45224         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45225         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45226         LDKPublicKey next_per_commitment_point_arg_ref;
45227         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
45228         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
45229         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
45230         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
45231         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
45232         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
45233         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
45234         int64_t ret_ref = 0;
45235         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45236         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45237         return ret_ref;
45238 }
45239
45240 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
45241         LDKChannelReady ret_var = ChannelReady_clone(arg);
45242         int64_t ret_ref = 0;
45243         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45244         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45245         return ret_ref;
45246 }
45247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45248         LDKChannelReady arg_conv;
45249         arg_conv.inner = untag_ptr(arg);
45250         arg_conv.is_owned = ptr_is_owned(arg);
45251         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45252         arg_conv.is_owned = false;
45253         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
45254         return ret_conv;
45255 }
45256
45257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45258         LDKChannelReady orig_conv;
45259         orig_conv.inner = untag_ptr(orig);
45260         orig_conv.is_owned = ptr_is_owned(orig);
45261         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45262         orig_conv.is_owned = false;
45263         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
45264         int64_t ret_ref = 0;
45265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45266         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45267         return ret_ref;
45268 }
45269
45270 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelReady_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45271         LDKChannelReady a_conv;
45272         a_conv.inner = untag_ptr(a);
45273         a_conv.is_owned = ptr_is_owned(a);
45274         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45275         a_conv.is_owned = false;
45276         LDKChannelReady b_conv;
45277         b_conv.inner = untag_ptr(b);
45278         b_conv.is_owned = ptr_is_owned(b);
45279         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45280         b_conv.is_owned = false;
45281         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
45282         return ret_conv;
45283 }
45284
45285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45286         LDKTxAddInput this_obj_conv;
45287         this_obj_conv.inner = untag_ptr(this_obj);
45288         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45290         TxAddInput_free(this_obj_conv);
45291 }
45292
45293 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45294         LDKTxAddInput this_ptr_conv;
45295         this_ptr_conv.inner = untag_ptr(this_ptr);
45296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45298         this_ptr_conv.is_owned = false;
45299         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45300         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAddInput_get_channel_id(&this_ptr_conv));
45301         return ret_arr;
45302 }
45303
45304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45305         LDKTxAddInput this_ptr_conv;
45306         this_ptr_conv.inner = untag_ptr(this_ptr);
45307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45309         this_ptr_conv.is_owned = false;
45310         LDKThirtyTwoBytes val_ref;
45311         CHECK((*env)->GetArrayLength(env, val) == 32);
45312         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45313         TxAddInput_set_channel_id(&this_ptr_conv, val_ref);
45314 }
45315
45316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45317         LDKTxAddInput this_ptr_conv;
45318         this_ptr_conv.inner = untag_ptr(this_ptr);
45319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45321         this_ptr_conv.is_owned = false;
45322         int64_t ret_conv = TxAddInput_get_serial_id(&this_ptr_conv);
45323         return ret_conv;
45324 }
45325
45326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45327         LDKTxAddInput this_ptr_conv;
45328         this_ptr_conv.inner = untag_ptr(this_ptr);
45329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45331         this_ptr_conv.is_owned = false;
45332         TxAddInput_set_serial_id(&this_ptr_conv, val);
45333 }
45334
45335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1prevtx(JNIEnv *env, jclass clz, int64_t this_ptr) {
45336         LDKTxAddInput this_ptr_conv;
45337         this_ptr_conv.inner = untag_ptr(this_ptr);
45338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45340         this_ptr_conv.is_owned = false;
45341         LDKTransactionU16LenLimited ret_var = TxAddInput_get_prevtx(&this_ptr_conv);
45342         int64_t ret_ref = 0;
45343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45345         return ret_ref;
45346 }
45347
45348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1prevtx(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45349         LDKTxAddInput this_ptr_conv;
45350         this_ptr_conv.inner = untag_ptr(this_ptr);
45351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45353         this_ptr_conv.is_owned = false;
45354         LDKTransactionU16LenLimited val_conv;
45355         val_conv.inner = untag_ptr(val);
45356         val_conv.is_owned = ptr_is_owned(val);
45357         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45358         val_conv = TransactionU16LenLimited_clone(&val_conv);
45359         TxAddInput_set_prevtx(&this_ptr_conv, val_conv);
45360 }
45361
45362 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1prevtx_1out(JNIEnv *env, jclass clz, int64_t this_ptr) {
45363         LDKTxAddInput this_ptr_conv;
45364         this_ptr_conv.inner = untag_ptr(this_ptr);
45365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45367         this_ptr_conv.is_owned = false;
45368         int32_t ret_conv = TxAddInput_get_prevtx_out(&this_ptr_conv);
45369         return ret_conv;
45370 }
45371
45372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1prevtx_1out(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
45373         LDKTxAddInput this_ptr_conv;
45374         this_ptr_conv.inner = untag_ptr(this_ptr);
45375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45377         this_ptr_conv.is_owned = false;
45378         TxAddInput_set_prevtx_out(&this_ptr_conv, val);
45379 }
45380
45381 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1sequence(JNIEnv *env, jclass clz, int64_t this_ptr) {
45382         LDKTxAddInput this_ptr_conv;
45383         this_ptr_conv.inner = untag_ptr(this_ptr);
45384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45386         this_ptr_conv.is_owned = false;
45387         int32_t ret_conv = TxAddInput_get_sequence(&this_ptr_conv);
45388         return ret_conv;
45389 }
45390
45391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1sequence(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
45392         LDKTxAddInput this_ptr_conv;
45393         this_ptr_conv.inner = untag_ptr(this_ptr);
45394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45396         this_ptr_conv.is_owned = false;
45397         TxAddInput_set_sequence(&this_ptr_conv, val);
45398 }
45399
45400 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) {
45401         LDKThirtyTwoBytes channel_id_arg_ref;
45402         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45403         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45404         LDKTransactionU16LenLimited prevtx_arg_conv;
45405         prevtx_arg_conv.inner = untag_ptr(prevtx_arg);
45406         prevtx_arg_conv.is_owned = ptr_is_owned(prevtx_arg);
45407         CHECK_INNER_FIELD_ACCESS_OR_NULL(prevtx_arg_conv);
45408         prevtx_arg_conv = TransactionU16LenLimited_clone(&prevtx_arg_conv);
45409         LDKTxAddInput ret_var = TxAddInput_new(channel_id_arg_ref, serial_id_arg, prevtx_arg_conv, prevtx_out_arg, sequence_arg);
45410         int64_t ret_ref = 0;
45411         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45412         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45413         return ret_ref;
45414 }
45415
45416 static inline uint64_t TxAddInput_clone_ptr(LDKTxAddInput *NONNULL_PTR arg) {
45417         LDKTxAddInput ret_var = TxAddInput_clone(arg);
45418         int64_t ret_ref = 0;
45419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45421         return ret_ref;
45422 }
45423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45424         LDKTxAddInput arg_conv;
45425         arg_conv.inner = untag_ptr(arg);
45426         arg_conv.is_owned = ptr_is_owned(arg);
45427         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45428         arg_conv.is_owned = false;
45429         int64_t ret_conv = TxAddInput_clone_ptr(&arg_conv);
45430         return ret_conv;
45431 }
45432
45433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45434         LDKTxAddInput orig_conv;
45435         orig_conv.inner = untag_ptr(orig);
45436         orig_conv.is_owned = ptr_is_owned(orig);
45437         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45438         orig_conv.is_owned = false;
45439         LDKTxAddInput ret_var = TxAddInput_clone(&orig_conv);
45440         int64_t ret_ref = 0;
45441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45443         return ret_ref;
45444 }
45445
45446 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAddInput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45447         LDKTxAddInput a_conv;
45448         a_conv.inner = untag_ptr(a);
45449         a_conv.is_owned = ptr_is_owned(a);
45450         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45451         a_conv.is_owned = false;
45452         LDKTxAddInput b_conv;
45453         b_conv.inner = untag_ptr(b);
45454         b_conv.is_owned = ptr_is_owned(b);
45455         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45456         b_conv.is_owned = false;
45457         jboolean ret_conv = TxAddInput_eq(&a_conv, &b_conv);
45458         return ret_conv;
45459 }
45460
45461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45462         LDKTxAddOutput this_obj_conv;
45463         this_obj_conv.inner = untag_ptr(this_obj);
45464         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45466         TxAddOutput_free(this_obj_conv);
45467 }
45468
45469 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45470         LDKTxAddOutput this_ptr_conv;
45471         this_ptr_conv.inner = untag_ptr(this_ptr);
45472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45474         this_ptr_conv.is_owned = false;
45475         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45476         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAddOutput_get_channel_id(&this_ptr_conv));
45477         return ret_arr;
45478 }
45479
45480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45481         LDKTxAddOutput this_ptr_conv;
45482         this_ptr_conv.inner = untag_ptr(this_ptr);
45483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45485         this_ptr_conv.is_owned = false;
45486         LDKThirtyTwoBytes val_ref;
45487         CHECK((*env)->GetArrayLength(env, val) == 32);
45488         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45489         TxAddOutput_set_channel_id(&this_ptr_conv, val_ref);
45490 }
45491
45492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45493         LDKTxAddOutput this_ptr_conv;
45494         this_ptr_conv.inner = untag_ptr(this_ptr);
45495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45497         this_ptr_conv.is_owned = false;
45498         int64_t ret_conv = TxAddOutput_get_serial_id(&this_ptr_conv);
45499         return ret_conv;
45500 }
45501
45502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45503         LDKTxAddOutput this_ptr_conv;
45504         this_ptr_conv.inner = untag_ptr(this_ptr);
45505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45507         this_ptr_conv.is_owned = false;
45508         TxAddOutput_set_serial_id(&this_ptr_conv, val);
45509 }
45510
45511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
45512         LDKTxAddOutput this_ptr_conv;
45513         this_ptr_conv.inner = untag_ptr(this_ptr);
45514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45516         this_ptr_conv.is_owned = false;
45517         int64_t ret_conv = TxAddOutput_get_sats(&this_ptr_conv);
45518         return ret_conv;
45519 }
45520
45521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45522         LDKTxAddOutput this_ptr_conv;
45523         this_ptr_conv.inner = untag_ptr(this_ptr);
45524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45526         this_ptr_conv.is_owned = false;
45527         TxAddOutput_set_sats(&this_ptr_conv, val);
45528 }
45529
45530 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
45531         LDKTxAddOutput this_ptr_conv;
45532         this_ptr_conv.inner = untag_ptr(this_ptr);
45533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45535         this_ptr_conv.is_owned = false;
45536         LDKu8slice ret_var = TxAddOutput_get_script(&this_ptr_conv);
45537         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45538         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45539         return ret_arr;
45540 }
45541
45542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45543         LDKTxAddOutput this_ptr_conv;
45544         this_ptr_conv.inner = untag_ptr(this_ptr);
45545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45547         this_ptr_conv.is_owned = false;
45548         LDKCVec_u8Z val_ref;
45549         val_ref.datalen = (*env)->GetArrayLength(env, val);
45550         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
45551         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
45552         TxAddOutput_set_script(&this_ptr_conv, val_ref);
45553 }
45554
45555 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) {
45556         LDKThirtyTwoBytes channel_id_arg_ref;
45557         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45558         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45559         LDKCVec_u8Z script_arg_ref;
45560         script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
45561         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
45562         (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
45563         LDKTxAddOutput ret_var = TxAddOutput_new(channel_id_arg_ref, serial_id_arg, sats_arg, script_arg_ref);
45564         int64_t ret_ref = 0;
45565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45567         return ret_ref;
45568 }
45569
45570 static inline uint64_t TxAddOutput_clone_ptr(LDKTxAddOutput *NONNULL_PTR arg) {
45571         LDKTxAddOutput ret_var = TxAddOutput_clone(arg);
45572         int64_t ret_ref = 0;
45573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45575         return ret_ref;
45576 }
45577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45578         LDKTxAddOutput arg_conv;
45579         arg_conv.inner = untag_ptr(arg);
45580         arg_conv.is_owned = ptr_is_owned(arg);
45581         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45582         arg_conv.is_owned = false;
45583         int64_t ret_conv = TxAddOutput_clone_ptr(&arg_conv);
45584         return ret_conv;
45585 }
45586
45587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45588         LDKTxAddOutput orig_conv;
45589         orig_conv.inner = untag_ptr(orig);
45590         orig_conv.is_owned = ptr_is_owned(orig);
45591         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45592         orig_conv.is_owned = false;
45593         LDKTxAddOutput ret_var = TxAddOutput_clone(&orig_conv);
45594         int64_t ret_ref = 0;
45595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45597         return ret_ref;
45598 }
45599
45600 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45601         LDKTxAddOutput a_conv;
45602         a_conv.inner = untag_ptr(a);
45603         a_conv.is_owned = ptr_is_owned(a);
45604         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45605         a_conv.is_owned = false;
45606         LDKTxAddOutput b_conv;
45607         b_conv.inner = untag_ptr(b);
45608         b_conv.is_owned = ptr_is_owned(b);
45609         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45610         b_conv.is_owned = false;
45611         jboolean ret_conv = TxAddOutput_eq(&a_conv, &b_conv);
45612         return ret_conv;
45613 }
45614
45615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45616         LDKTxRemoveInput this_obj_conv;
45617         this_obj_conv.inner = untag_ptr(this_obj);
45618         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45620         TxRemoveInput_free(this_obj_conv);
45621 }
45622
45623 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45624         LDKTxRemoveInput this_ptr_conv;
45625         this_ptr_conv.inner = untag_ptr(this_ptr);
45626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45628         this_ptr_conv.is_owned = false;
45629         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45630         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxRemoveInput_get_channel_id(&this_ptr_conv));
45631         return ret_arr;
45632 }
45633
45634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45635         LDKTxRemoveInput this_ptr_conv;
45636         this_ptr_conv.inner = untag_ptr(this_ptr);
45637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45639         this_ptr_conv.is_owned = false;
45640         LDKThirtyTwoBytes val_ref;
45641         CHECK((*env)->GetArrayLength(env, val) == 32);
45642         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45643         TxRemoveInput_set_channel_id(&this_ptr_conv, val_ref);
45644 }
45645
45646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45647         LDKTxRemoveInput this_ptr_conv;
45648         this_ptr_conv.inner = untag_ptr(this_ptr);
45649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45651         this_ptr_conv.is_owned = false;
45652         int64_t ret_conv = TxRemoveInput_get_serial_id(&this_ptr_conv);
45653         return ret_conv;
45654 }
45655
45656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45657         LDKTxRemoveInput this_ptr_conv;
45658         this_ptr_conv.inner = untag_ptr(this_ptr);
45659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45661         this_ptr_conv.is_owned = false;
45662         TxRemoveInput_set_serial_id(&this_ptr_conv, val);
45663 }
45664
45665 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) {
45666         LDKThirtyTwoBytes channel_id_arg_ref;
45667         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45668         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45669         LDKTxRemoveInput ret_var = TxRemoveInput_new(channel_id_arg_ref, serial_id_arg);
45670         int64_t ret_ref = 0;
45671         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45672         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45673         return ret_ref;
45674 }
45675
45676 static inline uint64_t TxRemoveInput_clone_ptr(LDKTxRemoveInput *NONNULL_PTR arg) {
45677         LDKTxRemoveInput ret_var = TxRemoveInput_clone(arg);
45678         int64_t ret_ref = 0;
45679         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45680         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45681         return ret_ref;
45682 }
45683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45684         LDKTxRemoveInput arg_conv;
45685         arg_conv.inner = untag_ptr(arg);
45686         arg_conv.is_owned = ptr_is_owned(arg);
45687         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45688         arg_conv.is_owned = false;
45689         int64_t ret_conv = TxRemoveInput_clone_ptr(&arg_conv);
45690         return ret_conv;
45691 }
45692
45693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45694         LDKTxRemoveInput orig_conv;
45695         orig_conv.inner = untag_ptr(orig);
45696         orig_conv.is_owned = ptr_is_owned(orig);
45697         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45698         orig_conv.is_owned = false;
45699         LDKTxRemoveInput ret_var = TxRemoveInput_clone(&orig_conv);
45700         int64_t ret_ref = 0;
45701         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45702         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45703         return ret_ref;
45704 }
45705
45706 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45707         LDKTxRemoveInput a_conv;
45708         a_conv.inner = untag_ptr(a);
45709         a_conv.is_owned = ptr_is_owned(a);
45710         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45711         a_conv.is_owned = false;
45712         LDKTxRemoveInput b_conv;
45713         b_conv.inner = untag_ptr(b);
45714         b_conv.is_owned = ptr_is_owned(b);
45715         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45716         b_conv.is_owned = false;
45717         jboolean ret_conv = TxRemoveInput_eq(&a_conv, &b_conv);
45718         return ret_conv;
45719 }
45720
45721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45722         LDKTxRemoveOutput this_obj_conv;
45723         this_obj_conv.inner = untag_ptr(this_obj);
45724         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45726         TxRemoveOutput_free(this_obj_conv);
45727 }
45728
45729 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45730         LDKTxRemoveOutput this_ptr_conv;
45731         this_ptr_conv.inner = untag_ptr(this_ptr);
45732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45734         this_ptr_conv.is_owned = false;
45735         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45736         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxRemoveOutput_get_channel_id(&this_ptr_conv));
45737         return ret_arr;
45738 }
45739
45740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45741         LDKTxRemoveOutput this_ptr_conv;
45742         this_ptr_conv.inner = untag_ptr(this_ptr);
45743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45745         this_ptr_conv.is_owned = false;
45746         LDKThirtyTwoBytes val_ref;
45747         CHECK((*env)->GetArrayLength(env, val) == 32);
45748         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45749         TxRemoveOutput_set_channel_id(&this_ptr_conv, val_ref);
45750 }
45751
45752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45753         LDKTxRemoveOutput this_ptr_conv;
45754         this_ptr_conv.inner = untag_ptr(this_ptr);
45755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45757         this_ptr_conv.is_owned = false;
45758         int64_t ret_conv = TxRemoveOutput_get_serial_id(&this_ptr_conv);
45759         return ret_conv;
45760 }
45761
45762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45763         LDKTxRemoveOutput this_ptr_conv;
45764         this_ptr_conv.inner = untag_ptr(this_ptr);
45765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45767         this_ptr_conv.is_owned = false;
45768         TxRemoveOutput_set_serial_id(&this_ptr_conv, val);
45769 }
45770
45771 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) {
45772         LDKThirtyTwoBytes channel_id_arg_ref;
45773         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45774         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45775         LDKTxRemoveOutput ret_var = TxRemoveOutput_new(channel_id_arg_ref, serial_id_arg);
45776         int64_t ret_ref = 0;
45777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45779         return ret_ref;
45780 }
45781
45782 static inline uint64_t TxRemoveOutput_clone_ptr(LDKTxRemoveOutput *NONNULL_PTR arg) {
45783         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(arg);
45784         int64_t ret_ref = 0;
45785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45787         return ret_ref;
45788 }
45789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45790         LDKTxRemoveOutput arg_conv;
45791         arg_conv.inner = untag_ptr(arg);
45792         arg_conv.is_owned = ptr_is_owned(arg);
45793         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45794         arg_conv.is_owned = false;
45795         int64_t ret_conv = TxRemoveOutput_clone_ptr(&arg_conv);
45796         return ret_conv;
45797 }
45798
45799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45800         LDKTxRemoveOutput orig_conv;
45801         orig_conv.inner = untag_ptr(orig);
45802         orig_conv.is_owned = ptr_is_owned(orig);
45803         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45804         orig_conv.is_owned = false;
45805         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(&orig_conv);
45806         int64_t ret_ref = 0;
45807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45809         return ret_ref;
45810 }
45811
45812 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45813         LDKTxRemoveOutput a_conv;
45814         a_conv.inner = untag_ptr(a);
45815         a_conv.is_owned = ptr_is_owned(a);
45816         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45817         a_conv.is_owned = false;
45818         LDKTxRemoveOutput b_conv;
45819         b_conv.inner = untag_ptr(b);
45820         b_conv.is_owned = ptr_is_owned(b);
45821         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45822         b_conv.is_owned = false;
45823         jboolean ret_conv = TxRemoveOutput_eq(&a_conv, &b_conv);
45824         return ret_conv;
45825 }
45826
45827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxComplete_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45828         LDKTxComplete this_obj_conv;
45829         this_obj_conv.inner = untag_ptr(this_obj);
45830         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45832         TxComplete_free(this_obj_conv);
45833 }
45834
45835 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxComplete_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45836         LDKTxComplete this_ptr_conv;
45837         this_ptr_conv.inner = untag_ptr(this_ptr);
45838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45840         this_ptr_conv.is_owned = false;
45841         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45842         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxComplete_get_channel_id(&this_ptr_conv));
45843         return ret_arr;
45844 }
45845
45846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxComplete_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45847         LDKTxComplete this_ptr_conv;
45848         this_ptr_conv.inner = untag_ptr(this_ptr);
45849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45851         this_ptr_conv.is_owned = false;
45852         LDKThirtyTwoBytes val_ref;
45853         CHECK((*env)->GetArrayLength(env, val) == 32);
45854         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45855         TxComplete_set_channel_id(&this_ptr_conv, val_ref);
45856 }
45857
45858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg) {
45859         LDKThirtyTwoBytes channel_id_arg_ref;
45860         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45861         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45862         LDKTxComplete ret_var = TxComplete_new(channel_id_arg_ref);
45863         int64_t ret_ref = 0;
45864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45866         return ret_ref;
45867 }
45868
45869 static inline uint64_t TxComplete_clone_ptr(LDKTxComplete *NONNULL_PTR arg) {
45870         LDKTxComplete ret_var = TxComplete_clone(arg);
45871         int64_t ret_ref = 0;
45872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45874         return ret_ref;
45875 }
45876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45877         LDKTxComplete arg_conv;
45878         arg_conv.inner = untag_ptr(arg);
45879         arg_conv.is_owned = ptr_is_owned(arg);
45880         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45881         arg_conv.is_owned = false;
45882         int64_t ret_conv = TxComplete_clone_ptr(&arg_conv);
45883         return ret_conv;
45884 }
45885
45886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45887         LDKTxComplete orig_conv;
45888         orig_conv.inner = untag_ptr(orig);
45889         orig_conv.is_owned = ptr_is_owned(orig);
45890         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45891         orig_conv.is_owned = false;
45892         LDKTxComplete ret_var = TxComplete_clone(&orig_conv);
45893         int64_t ret_ref = 0;
45894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45896         return ret_ref;
45897 }
45898
45899 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxComplete_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45900         LDKTxComplete a_conv;
45901         a_conv.inner = untag_ptr(a);
45902         a_conv.is_owned = ptr_is_owned(a);
45903         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45904         a_conv.is_owned = false;
45905         LDKTxComplete b_conv;
45906         b_conv.inner = untag_ptr(b);
45907         b_conv.is_owned = ptr_is_owned(b);
45908         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45909         b_conv.is_owned = false;
45910         jboolean ret_conv = TxComplete_eq(&a_conv, &b_conv);
45911         return ret_conv;
45912 }
45913
45914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45915         LDKTxSignatures this_obj_conv;
45916         this_obj_conv.inner = untag_ptr(this_obj);
45917         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45919         TxSignatures_free(this_obj_conv);
45920 }
45921
45922 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45923         LDKTxSignatures this_ptr_conv;
45924         this_ptr_conv.inner = untag_ptr(this_ptr);
45925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45927         this_ptr_conv.is_owned = false;
45928         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45929         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxSignatures_get_channel_id(&this_ptr_conv));
45930         return ret_arr;
45931 }
45932
45933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45934         LDKTxSignatures this_ptr_conv;
45935         this_ptr_conv.inner = untag_ptr(this_ptr);
45936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45938         this_ptr_conv.is_owned = false;
45939         LDKThirtyTwoBytes val_ref;
45940         CHECK((*env)->GetArrayLength(env, val) == 32);
45941         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45942         TxSignatures_set_channel_id(&this_ptr_conv, val_ref);
45943 }
45944
45945 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1tx_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
45946         LDKTxSignatures this_ptr_conv;
45947         this_ptr_conv.inner = untag_ptr(this_ptr);
45948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45950         this_ptr_conv.is_owned = false;
45951         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45952         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxSignatures_get_tx_hash(&this_ptr_conv));
45953         return ret_arr;
45954 }
45955
45956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1tx_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45957         LDKTxSignatures this_ptr_conv;
45958         this_ptr_conv.inner = untag_ptr(this_ptr);
45959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45961         this_ptr_conv.is_owned = false;
45962         LDKThirtyTwoBytes val_ref;
45963         CHECK((*env)->GetArrayLength(env, val) == 32);
45964         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45965         TxSignatures_set_tx_hash(&this_ptr_conv, val_ref);
45966 }
45967
45968 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1witnesses(JNIEnv *env, jclass clz, int64_t this_ptr) {
45969         LDKTxSignatures this_ptr_conv;
45970         this_ptr_conv.inner = untag_ptr(this_ptr);
45971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45973         this_ptr_conv.is_owned = false;
45974         LDKCVec_WitnessZ ret_var = TxSignatures_get_witnesses(&this_ptr_conv);
45975         jobjectArray ret_arr = NULL;
45976         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
45977         ;
45978         for (size_t i = 0; i < ret_var.datalen; i++) {
45979                 LDKWitness ret_conv_8_var = ret_var.data[i];
45980                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
45981                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
45982                 Witness_free(ret_conv_8_var);
45983                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
45984         }
45985         
45986         FREE(ret_var.data);
45987         return ret_arr;
45988 }
45989
45990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1witnesses(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
45991         LDKTxSignatures this_ptr_conv;
45992         this_ptr_conv.inner = untag_ptr(this_ptr);
45993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45995         this_ptr_conv.is_owned = false;
45996         LDKCVec_WitnessZ val_constr;
45997         val_constr.datalen = (*env)->GetArrayLength(env, val);
45998         if (val_constr.datalen > 0)
45999                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
46000         else
46001                 val_constr.data = NULL;
46002         for (size_t i = 0; i < val_constr.datalen; i++) {
46003                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
46004                 LDKWitness val_conv_8_ref;
46005                 val_conv_8_ref.datalen = (*env)->GetArrayLength(env, val_conv_8);
46006                 val_conv_8_ref.data = MALLOC(val_conv_8_ref.datalen, "LDKWitness Bytes");
46007                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, val_conv_8_ref.datalen, val_conv_8_ref.data);
46008                 val_conv_8_ref.data_is_owned = true;
46009                 val_constr.data[i] = val_conv_8_ref;
46010         }
46011         TxSignatures_set_witnesses(&this_ptr_conv, val_constr);
46012 }
46013
46014 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) {
46015         LDKThirtyTwoBytes channel_id_arg_ref;
46016         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
46017         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
46018         LDKThirtyTwoBytes tx_hash_arg_ref;
46019         CHECK((*env)->GetArrayLength(env, tx_hash_arg) == 32);
46020         (*env)->GetByteArrayRegion(env, tx_hash_arg, 0, 32, tx_hash_arg_ref.data);
46021         LDKCVec_WitnessZ witnesses_arg_constr;
46022         witnesses_arg_constr.datalen = (*env)->GetArrayLength(env, witnesses_arg);
46023         if (witnesses_arg_constr.datalen > 0)
46024                 witnesses_arg_constr.data = MALLOC(witnesses_arg_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
46025         else
46026                 witnesses_arg_constr.data = NULL;
46027         for (size_t i = 0; i < witnesses_arg_constr.datalen; i++) {
46028                 int8_tArray witnesses_arg_conv_8 = (*env)->GetObjectArrayElement(env, witnesses_arg, i);
46029                 LDKWitness witnesses_arg_conv_8_ref;
46030                 witnesses_arg_conv_8_ref.datalen = (*env)->GetArrayLength(env, witnesses_arg_conv_8);
46031                 witnesses_arg_conv_8_ref.data = MALLOC(witnesses_arg_conv_8_ref.datalen, "LDKWitness Bytes");
46032                 (*env)->GetByteArrayRegion(env, witnesses_arg_conv_8, 0, witnesses_arg_conv_8_ref.datalen, witnesses_arg_conv_8_ref.data);
46033                 witnesses_arg_conv_8_ref.data_is_owned = true;
46034                 witnesses_arg_constr.data[i] = witnesses_arg_conv_8_ref;
46035         }
46036         LDKTxSignatures ret_var = TxSignatures_new(channel_id_arg_ref, tx_hash_arg_ref, witnesses_arg_constr);
46037         int64_t ret_ref = 0;
46038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46039         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46040         return ret_ref;
46041 }
46042
46043 static inline uint64_t TxSignatures_clone_ptr(LDKTxSignatures *NONNULL_PTR arg) {
46044         LDKTxSignatures ret_var = TxSignatures_clone(arg);
46045         int64_t ret_ref = 0;
46046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46048         return ret_ref;
46049 }
46050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46051         LDKTxSignatures arg_conv;
46052         arg_conv.inner = untag_ptr(arg);
46053         arg_conv.is_owned = ptr_is_owned(arg);
46054         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46055         arg_conv.is_owned = false;
46056         int64_t ret_conv = TxSignatures_clone_ptr(&arg_conv);
46057         return ret_conv;
46058 }
46059
46060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46061         LDKTxSignatures orig_conv;
46062         orig_conv.inner = untag_ptr(orig);
46063         orig_conv.is_owned = ptr_is_owned(orig);
46064         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46065         orig_conv.is_owned = false;
46066         LDKTxSignatures ret_var = TxSignatures_clone(&orig_conv);
46067         int64_t ret_ref = 0;
46068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46070         return ret_ref;
46071 }
46072
46073 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxSignatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46074         LDKTxSignatures a_conv;
46075         a_conv.inner = untag_ptr(a);
46076         a_conv.is_owned = ptr_is_owned(a);
46077         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46078         a_conv.is_owned = false;
46079         LDKTxSignatures b_conv;
46080         b_conv.inner = untag_ptr(b);
46081         b_conv.is_owned = ptr_is_owned(b);
46082         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46083         b_conv.is_owned = false;
46084         jboolean ret_conv = TxSignatures_eq(&a_conv, &b_conv);
46085         return ret_conv;
46086 }
46087
46088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46089         LDKTxInitRbf this_obj_conv;
46090         this_obj_conv.inner = untag_ptr(this_obj);
46091         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46093         TxInitRbf_free(this_obj_conv);
46094 }
46095
46096 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46097         LDKTxInitRbf this_ptr_conv;
46098         this_ptr_conv.inner = untag_ptr(this_ptr);
46099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46101         this_ptr_conv.is_owned = false;
46102         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46103         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxInitRbf_get_channel_id(&this_ptr_conv));
46104         return ret_arr;
46105 }
46106
46107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46108         LDKTxInitRbf this_ptr_conv;
46109         this_ptr_conv.inner = untag_ptr(this_ptr);
46110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46112         this_ptr_conv.is_owned = false;
46113         LDKThirtyTwoBytes val_ref;
46114         CHECK((*env)->GetArrayLength(env, val) == 32);
46115         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46116         TxInitRbf_set_channel_id(&this_ptr_conv, val_ref);
46117 }
46118
46119 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr) {
46120         LDKTxInitRbf this_ptr_conv;
46121         this_ptr_conv.inner = untag_ptr(this_ptr);
46122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46124         this_ptr_conv.is_owned = false;
46125         int32_t ret_conv = TxInitRbf_get_locktime(&this_ptr_conv);
46126         return ret_conv;
46127 }
46128
46129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
46130         LDKTxInitRbf 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         TxInitRbf_set_locktime(&this_ptr_conv, val);
46136 }
46137
46138 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
46139         LDKTxInitRbf this_ptr_conv;
46140         this_ptr_conv.inner = untag_ptr(this_ptr);
46141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46143         this_ptr_conv.is_owned = false;
46144         int32_t ret_conv = TxInitRbf_get_feerate_sat_per_1000_weight(&this_ptr_conv);
46145         return ret_conv;
46146 }
46147
46148 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) {
46149         LDKTxInitRbf this_ptr_conv;
46150         this_ptr_conv.inner = untag_ptr(this_ptr);
46151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46153         this_ptr_conv.is_owned = false;
46154         TxInitRbf_set_feerate_sat_per_1000_weight(&this_ptr_conv, val);
46155 }
46156
46157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr) {
46158         LDKTxInitRbf this_ptr_conv;
46159         this_ptr_conv.inner = untag_ptr(this_ptr);
46160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46162         this_ptr_conv.is_owned = false;
46163         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
46164         *ret_copy = TxInitRbf_get_funding_output_contribution(&this_ptr_conv);
46165         int64_t ret_ref = tag_ptr(ret_copy, true);
46166         return ret_ref;
46167 }
46168
46169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46170         LDKTxInitRbf this_ptr_conv;
46171         this_ptr_conv.inner = untag_ptr(this_ptr);
46172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46174         this_ptr_conv.is_owned = false;
46175         void* val_ptr = untag_ptr(val);
46176         CHECK_ACCESS(val_ptr);
46177         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
46178         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
46179         TxInitRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
46180 }
46181
46182 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) {
46183         LDKThirtyTwoBytes channel_id_arg_ref;
46184         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
46185         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
46186         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
46187         CHECK_ACCESS(funding_output_contribution_arg_ptr);
46188         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
46189         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
46190         LDKTxInitRbf ret_var = TxInitRbf_new(channel_id_arg_ref, locktime_arg, feerate_sat_per_1000_weight_arg, funding_output_contribution_arg_conv);
46191         int64_t ret_ref = 0;
46192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46194         return ret_ref;
46195 }
46196
46197 static inline uint64_t TxInitRbf_clone_ptr(LDKTxInitRbf *NONNULL_PTR arg) {
46198         LDKTxInitRbf ret_var = TxInitRbf_clone(arg);
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 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46205         LDKTxInitRbf arg_conv;
46206         arg_conv.inner = untag_ptr(arg);
46207         arg_conv.is_owned = ptr_is_owned(arg);
46208         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46209         arg_conv.is_owned = false;
46210         int64_t ret_conv = TxInitRbf_clone_ptr(&arg_conv);
46211         return ret_conv;
46212 }
46213
46214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46215         LDKTxInitRbf orig_conv;
46216         orig_conv.inner = untag_ptr(orig);
46217         orig_conv.is_owned = ptr_is_owned(orig);
46218         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46219         orig_conv.is_owned = false;
46220         LDKTxInitRbf ret_var = TxInitRbf_clone(&orig_conv);
46221         int64_t ret_ref = 0;
46222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46224         return ret_ref;
46225 }
46226
46227 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46228         LDKTxInitRbf a_conv;
46229         a_conv.inner = untag_ptr(a);
46230         a_conv.is_owned = ptr_is_owned(a);
46231         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46232         a_conv.is_owned = false;
46233         LDKTxInitRbf b_conv;
46234         b_conv.inner = untag_ptr(b);
46235         b_conv.is_owned = ptr_is_owned(b);
46236         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46237         b_conv.is_owned = false;
46238         jboolean ret_conv = TxInitRbf_eq(&a_conv, &b_conv);
46239         return ret_conv;
46240 }
46241
46242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46243         LDKTxAckRbf this_obj_conv;
46244         this_obj_conv.inner = untag_ptr(this_obj);
46245         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46247         TxAckRbf_free(this_obj_conv);
46248 }
46249
46250 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46251         LDKTxAckRbf this_ptr_conv;
46252         this_ptr_conv.inner = untag_ptr(this_ptr);
46253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46255         this_ptr_conv.is_owned = false;
46256         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46257         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAckRbf_get_channel_id(&this_ptr_conv));
46258         return ret_arr;
46259 }
46260
46261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46262         LDKTxAckRbf 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         LDKThirtyTwoBytes val_ref;
46268         CHECK((*env)->GetArrayLength(env, val) == 32);
46269         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46270         TxAckRbf_set_channel_id(&this_ptr_conv, val_ref);
46271 }
46272
46273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1get_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr) {
46274         LDKTxAckRbf this_ptr_conv;
46275         this_ptr_conv.inner = untag_ptr(this_ptr);
46276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46278         this_ptr_conv.is_owned = false;
46279         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
46280         *ret_copy = TxAckRbf_get_funding_output_contribution(&this_ptr_conv);
46281         int64_t ret_ref = tag_ptr(ret_copy, true);
46282         return ret_ref;
46283 }
46284
46285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1set_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46286         LDKTxAckRbf this_ptr_conv;
46287         this_ptr_conv.inner = untag_ptr(this_ptr);
46288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46290         this_ptr_conv.is_owned = false;
46291         void* val_ptr = untag_ptr(val);
46292         CHECK_ACCESS(val_ptr);
46293         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
46294         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
46295         TxAckRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
46296 }
46297
46298 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) {
46299         LDKThirtyTwoBytes channel_id_arg_ref;
46300         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
46301         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
46302         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
46303         CHECK_ACCESS(funding_output_contribution_arg_ptr);
46304         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
46305         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
46306         LDKTxAckRbf ret_var = TxAckRbf_new(channel_id_arg_ref, funding_output_contribution_arg_conv);
46307         int64_t ret_ref = 0;
46308         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46309         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46310         return ret_ref;
46311 }
46312
46313 static inline uint64_t TxAckRbf_clone_ptr(LDKTxAckRbf *NONNULL_PTR arg) {
46314         LDKTxAckRbf ret_var = TxAckRbf_clone(arg);
46315         int64_t ret_ref = 0;
46316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46318         return ret_ref;
46319 }
46320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46321         LDKTxAckRbf arg_conv;
46322         arg_conv.inner = untag_ptr(arg);
46323         arg_conv.is_owned = ptr_is_owned(arg);
46324         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46325         arg_conv.is_owned = false;
46326         int64_t ret_conv = TxAckRbf_clone_ptr(&arg_conv);
46327         return ret_conv;
46328 }
46329
46330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46331         LDKTxAckRbf orig_conv;
46332         orig_conv.inner = untag_ptr(orig);
46333         orig_conv.is_owned = ptr_is_owned(orig);
46334         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46335         orig_conv.is_owned = false;
46336         LDKTxAckRbf ret_var = TxAckRbf_clone(&orig_conv);
46337         int64_t ret_ref = 0;
46338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46340         return ret_ref;
46341 }
46342
46343 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46344         LDKTxAckRbf a_conv;
46345         a_conv.inner = untag_ptr(a);
46346         a_conv.is_owned = ptr_is_owned(a);
46347         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46348         a_conv.is_owned = false;
46349         LDKTxAckRbf b_conv;
46350         b_conv.inner = untag_ptr(b);
46351         b_conv.is_owned = ptr_is_owned(b);
46352         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46353         b_conv.is_owned = false;
46354         jboolean ret_conv = TxAckRbf_eq(&a_conv, &b_conv);
46355         return ret_conv;
46356 }
46357
46358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46359         LDKTxAbort this_obj_conv;
46360         this_obj_conv.inner = untag_ptr(this_obj);
46361         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46363         TxAbort_free(this_obj_conv);
46364 }
46365
46366 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAbort_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46367         LDKTxAbort this_ptr_conv;
46368         this_ptr_conv.inner = untag_ptr(this_ptr);
46369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46371         this_ptr_conv.is_owned = false;
46372         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46373         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAbort_get_channel_id(&this_ptr_conv));
46374         return ret_arr;
46375 }
46376
46377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46378         LDKTxAbort this_ptr_conv;
46379         this_ptr_conv.inner = untag_ptr(this_ptr);
46380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46382         this_ptr_conv.is_owned = false;
46383         LDKThirtyTwoBytes val_ref;
46384         CHECK((*env)->GetArrayLength(env, val) == 32);
46385         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46386         TxAbort_set_channel_id(&this_ptr_conv, val_ref);
46387 }
46388
46389 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAbort_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
46390         LDKTxAbort this_ptr_conv;
46391         this_ptr_conv.inner = untag_ptr(this_ptr);
46392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46394         this_ptr_conv.is_owned = false;
46395         LDKCVec_u8Z ret_var = TxAbort_get_data(&this_ptr_conv);
46396         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
46397         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
46398         CVec_u8Z_free(ret_var);
46399         return ret_arr;
46400 }
46401
46402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46403         LDKTxAbort this_ptr_conv;
46404         this_ptr_conv.inner = untag_ptr(this_ptr);
46405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46407         this_ptr_conv.is_owned = false;
46408         LDKCVec_u8Z val_ref;
46409         val_ref.datalen = (*env)->GetArrayLength(env, val);
46410         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
46411         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
46412         TxAbort_set_data(&this_ptr_conv, val_ref);
46413 }
46414
46415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray data_arg) {
46416         LDKThirtyTwoBytes channel_id_arg_ref;
46417         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
46418         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
46419         LDKCVec_u8Z data_arg_ref;
46420         data_arg_ref.datalen = (*env)->GetArrayLength(env, data_arg);
46421         data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
46422         (*env)->GetByteArrayRegion(env, data_arg, 0, data_arg_ref.datalen, data_arg_ref.data);
46423         LDKTxAbort ret_var = TxAbort_new(channel_id_arg_ref, data_arg_ref);
46424         int64_t ret_ref = 0;
46425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46427         return ret_ref;
46428 }
46429
46430 static inline uint64_t TxAbort_clone_ptr(LDKTxAbort *NONNULL_PTR arg) {
46431         LDKTxAbort ret_var = TxAbort_clone(arg);
46432         int64_t ret_ref = 0;
46433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46435         return ret_ref;
46436 }
46437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46438         LDKTxAbort arg_conv;
46439         arg_conv.inner = untag_ptr(arg);
46440         arg_conv.is_owned = ptr_is_owned(arg);
46441         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46442         arg_conv.is_owned = false;
46443         int64_t ret_conv = TxAbort_clone_ptr(&arg_conv);
46444         return ret_conv;
46445 }
46446
46447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46448         LDKTxAbort orig_conv;
46449         orig_conv.inner = untag_ptr(orig);
46450         orig_conv.is_owned = ptr_is_owned(orig);
46451         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46452         orig_conv.is_owned = false;
46453         LDKTxAbort ret_var = TxAbort_clone(&orig_conv);
46454         int64_t ret_ref = 0;
46455         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46456         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46457         return ret_ref;
46458 }
46459
46460 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAbort_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46461         LDKTxAbort a_conv;
46462         a_conv.inner = untag_ptr(a);
46463         a_conv.is_owned = ptr_is_owned(a);
46464         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46465         a_conv.is_owned = false;
46466         LDKTxAbort b_conv;
46467         b_conv.inner = untag_ptr(b);
46468         b_conv.is_owned = ptr_is_owned(b);
46469         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46470         b_conv.is_owned = false;
46471         jboolean ret_conv = TxAbort_eq(&a_conv, &b_conv);
46472         return ret_conv;
46473 }
46474
46475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46476         LDKShutdown this_obj_conv;
46477         this_obj_conv.inner = untag_ptr(this_obj);
46478         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46480         Shutdown_free(this_obj_conv);
46481 }
46482
46483 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46484         LDKShutdown this_ptr_conv;
46485         this_ptr_conv.inner = untag_ptr(this_ptr);
46486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46488         this_ptr_conv.is_owned = false;
46489         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46490         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
46491         return ret_arr;
46492 }
46493
46494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46495         LDKShutdown this_ptr_conv;
46496         this_ptr_conv.inner = untag_ptr(this_ptr);
46497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46499         this_ptr_conv.is_owned = false;
46500         LDKThirtyTwoBytes val_ref;
46501         CHECK((*env)->GetArrayLength(env, val) == 32);
46502         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46503         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
46504 }
46505
46506 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
46507         LDKShutdown this_ptr_conv;
46508         this_ptr_conv.inner = untag_ptr(this_ptr);
46509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46511         this_ptr_conv.is_owned = false;
46512         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
46513         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
46514         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
46515         return ret_arr;
46516 }
46517
46518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46519         LDKShutdown this_ptr_conv;
46520         this_ptr_conv.inner = untag_ptr(this_ptr);
46521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46523         this_ptr_conv.is_owned = false;
46524         LDKCVec_u8Z val_ref;
46525         val_ref.datalen = (*env)->GetArrayLength(env, val);
46526         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
46527         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
46528         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
46529 }
46530
46531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
46532         LDKThirtyTwoBytes channel_id_arg_ref;
46533         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
46534         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
46535         LDKCVec_u8Z scriptpubkey_arg_ref;
46536         scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
46537         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
46538         (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
46539         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
46540         int64_t ret_ref = 0;
46541         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46542         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46543         return ret_ref;
46544 }
46545
46546 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
46547         LDKShutdown ret_var = Shutdown_clone(arg);
46548         int64_t ret_ref = 0;
46549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46551         return ret_ref;
46552 }
46553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46554         LDKShutdown arg_conv;
46555         arg_conv.inner = untag_ptr(arg);
46556         arg_conv.is_owned = ptr_is_owned(arg);
46557         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46558         arg_conv.is_owned = false;
46559         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
46560         return ret_conv;
46561 }
46562
46563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46564         LDKShutdown orig_conv;
46565         orig_conv.inner = untag_ptr(orig);
46566         orig_conv.is_owned = ptr_is_owned(orig);
46567         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46568         orig_conv.is_owned = false;
46569         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
46570         int64_t ret_ref = 0;
46571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46573         return ret_ref;
46574 }
46575
46576 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Shutdown_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46577         LDKShutdown a_conv;
46578         a_conv.inner = untag_ptr(a);
46579         a_conv.is_owned = ptr_is_owned(a);
46580         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46581         a_conv.is_owned = false;
46582         LDKShutdown b_conv;
46583         b_conv.inner = untag_ptr(b);
46584         b_conv.is_owned = ptr_is_owned(b);
46585         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46586         b_conv.is_owned = false;
46587         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
46588         return ret_conv;
46589 }
46590
46591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46592         LDKClosingSignedFeeRange this_obj_conv;
46593         this_obj_conv.inner = untag_ptr(this_obj);
46594         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46596         ClosingSignedFeeRange_free(this_obj_conv);
46597 }
46598
46599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
46600         LDKClosingSignedFeeRange this_ptr_conv;
46601         this_ptr_conv.inner = untag_ptr(this_ptr);
46602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46604         this_ptr_conv.is_owned = false;
46605         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
46606         return ret_conv;
46607 }
46608
46609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46610         LDKClosingSignedFeeRange this_ptr_conv;
46611         this_ptr_conv.inner = untag_ptr(this_ptr);
46612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46614         this_ptr_conv.is_owned = false;
46615         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
46616 }
46617
46618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
46619         LDKClosingSignedFeeRange this_ptr_conv;
46620         this_ptr_conv.inner = untag_ptr(this_ptr);
46621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46623         this_ptr_conv.is_owned = false;
46624         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
46625         return ret_conv;
46626 }
46627
46628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46629         LDKClosingSignedFeeRange this_ptr_conv;
46630         this_ptr_conv.inner = untag_ptr(this_ptr);
46631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46633         this_ptr_conv.is_owned = false;
46634         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
46635 }
46636
46637 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) {
46638         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
46639         int64_t ret_ref = 0;
46640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46642         return ret_ref;
46643 }
46644
46645 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
46646         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
46647         int64_t ret_ref = 0;
46648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46650         return ret_ref;
46651 }
46652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46653         LDKClosingSignedFeeRange arg_conv;
46654         arg_conv.inner = untag_ptr(arg);
46655         arg_conv.is_owned = ptr_is_owned(arg);
46656         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46657         arg_conv.is_owned = false;
46658         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
46659         return ret_conv;
46660 }
46661
46662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46663         LDKClosingSignedFeeRange orig_conv;
46664         orig_conv.inner = untag_ptr(orig);
46665         orig_conv.is_owned = ptr_is_owned(orig);
46666         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46667         orig_conv.is_owned = false;
46668         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
46669         int64_t ret_ref = 0;
46670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46672         return ret_ref;
46673 }
46674
46675 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46676         LDKClosingSignedFeeRange a_conv;
46677         a_conv.inner = untag_ptr(a);
46678         a_conv.is_owned = ptr_is_owned(a);
46679         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46680         a_conv.is_owned = false;
46681         LDKClosingSignedFeeRange b_conv;
46682         b_conv.inner = untag_ptr(b);
46683         b_conv.is_owned = ptr_is_owned(b);
46684         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46685         b_conv.is_owned = false;
46686         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
46687         return ret_conv;
46688 }
46689
46690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46691         LDKClosingSigned this_obj_conv;
46692         this_obj_conv.inner = untag_ptr(this_obj);
46693         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46695         ClosingSigned_free(this_obj_conv);
46696 }
46697
46698 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46699         LDKClosingSigned this_ptr_conv;
46700         this_ptr_conv.inner = untag_ptr(this_ptr);
46701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46703         this_ptr_conv.is_owned = false;
46704         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46705         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
46706         return ret_arr;
46707 }
46708
46709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46710         LDKClosingSigned this_ptr_conv;
46711         this_ptr_conv.inner = untag_ptr(this_ptr);
46712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46714         this_ptr_conv.is_owned = false;
46715         LDKThirtyTwoBytes val_ref;
46716         CHECK((*env)->GetArrayLength(env, val) == 32);
46717         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46718         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
46719 }
46720
46721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
46722         LDKClosingSigned this_ptr_conv;
46723         this_ptr_conv.inner = untag_ptr(this_ptr);
46724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46726         this_ptr_conv.is_owned = false;
46727         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
46728         return ret_conv;
46729 }
46730
46731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46732         LDKClosingSigned this_ptr_conv;
46733         this_ptr_conv.inner = untag_ptr(this_ptr);
46734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46736         this_ptr_conv.is_owned = false;
46737         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
46738 }
46739
46740 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
46741         LDKClosingSigned this_ptr_conv;
46742         this_ptr_conv.inner = untag_ptr(this_ptr);
46743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46745         this_ptr_conv.is_owned = false;
46746         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
46747         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
46748         return ret_arr;
46749 }
46750
46751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46752         LDKClosingSigned this_ptr_conv;
46753         this_ptr_conv.inner = untag_ptr(this_ptr);
46754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46756         this_ptr_conv.is_owned = false;
46757         LDKECDSASignature val_ref;
46758         CHECK((*env)->GetArrayLength(env, val) == 64);
46759         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
46760         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
46761 }
46762
46763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
46764         LDKClosingSigned this_ptr_conv;
46765         this_ptr_conv.inner = untag_ptr(this_ptr);
46766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46768         this_ptr_conv.is_owned = false;
46769         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
46770         int64_t ret_ref = 0;
46771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46773         return ret_ref;
46774 }
46775
46776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46777         LDKClosingSigned this_ptr_conv;
46778         this_ptr_conv.inner = untag_ptr(this_ptr);
46779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46781         this_ptr_conv.is_owned = false;
46782         LDKClosingSignedFeeRange val_conv;
46783         val_conv.inner = untag_ptr(val);
46784         val_conv.is_owned = ptr_is_owned(val);
46785         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46786         val_conv = ClosingSignedFeeRange_clone(&val_conv);
46787         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
46788 }
46789
46790 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) {
46791         LDKThirtyTwoBytes channel_id_arg_ref;
46792         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
46793         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
46794         LDKECDSASignature signature_arg_ref;
46795         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
46796         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
46797         LDKClosingSignedFeeRange fee_range_arg_conv;
46798         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
46799         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
46800         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
46801         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
46802         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
46803         int64_t ret_ref = 0;
46804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46806         return ret_ref;
46807 }
46808
46809 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
46810         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
46811         int64_t ret_ref = 0;
46812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46814         return ret_ref;
46815 }
46816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46817         LDKClosingSigned arg_conv;
46818         arg_conv.inner = untag_ptr(arg);
46819         arg_conv.is_owned = ptr_is_owned(arg);
46820         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46821         arg_conv.is_owned = false;
46822         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
46823         return ret_conv;
46824 }
46825
46826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46827         LDKClosingSigned orig_conv;
46828         orig_conv.inner = untag_ptr(orig);
46829         orig_conv.is_owned = ptr_is_owned(orig);
46830         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46831         orig_conv.is_owned = false;
46832         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
46833         int64_t ret_ref = 0;
46834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46836         return ret_ref;
46837 }
46838
46839 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46840         LDKClosingSigned a_conv;
46841         a_conv.inner = untag_ptr(a);
46842         a_conv.is_owned = ptr_is_owned(a);
46843         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46844         a_conv.is_owned = false;
46845         LDKClosingSigned b_conv;
46846         b_conv.inner = untag_ptr(b);
46847         b_conv.is_owned = ptr_is_owned(b);
46848         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46849         b_conv.is_owned = false;
46850         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
46851         return ret_conv;
46852 }
46853
46854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46855         LDKUpdateAddHTLC this_obj_conv;
46856         this_obj_conv.inner = untag_ptr(this_obj);
46857         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46859         UpdateAddHTLC_free(this_obj_conv);
46860 }
46861
46862 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46863         LDKUpdateAddHTLC this_ptr_conv;
46864         this_ptr_conv.inner = untag_ptr(this_ptr);
46865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46867         this_ptr_conv.is_owned = false;
46868         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46869         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
46870         return ret_arr;
46871 }
46872
46873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46874         LDKUpdateAddHTLC this_ptr_conv;
46875         this_ptr_conv.inner = untag_ptr(this_ptr);
46876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46878         this_ptr_conv.is_owned = false;
46879         LDKThirtyTwoBytes val_ref;
46880         CHECK((*env)->GetArrayLength(env, val) == 32);
46881         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46882         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
46883 }
46884
46885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46886         LDKUpdateAddHTLC this_ptr_conv;
46887         this_ptr_conv.inner = untag_ptr(this_ptr);
46888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46890         this_ptr_conv.is_owned = false;
46891         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
46892         return ret_conv;
46893 }
46894
46895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46896         LDKUpdateAddHTLC this_ptr_conv;
46897         this_ptr_conv.inner = untag_ptr(this_ptr);
46898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46900         this_ptr_conv.is_owned = false;
46901         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
46902 }
46903
46904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46905         LDKUpdateAddHTLC this_ptr_conv;
46906         this_ptr_conv.inner = untag_ptr(this_ptr);
46907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46909         this_ptr_conv.is_owned = false;
46910         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
46911         return ret_conv;
46912 }
46913
46914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46915         LDKUpdateAddHTLC this_ptr_conv;
46916         this_ptr_conv.inner = untag_ptr(this_ptr);
46917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46919         this_ptr_conv.is_owned = false;
46920         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
46921 }
46922
46923 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
46924         LDKUpdateAddHTLC this_ptr_conv;
46925         this_ptr_conv.inner = untag_ptr(this_ptr);
46926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46928         this_ptr_conv.is_owned = false;
46929         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46930         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
46931         return ret_arr;
46932 }
46933
46934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46935         LDKUpdateAddHTLC this_ptr_conv;
46936         this_ptr_conv.inner = untag_ptr(this_ptr);
46937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46939         this_ptr_conv.is_owned = false;
46940         LDKThirtyTwoBytes val_ref;
46941         CHECK((*env)->GetArrayLength(env, val) == 32);
46942         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46943         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
46944 }
46945
46946 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
46947         LDKUpdateAddHTLC this_ptr_conv;
46948         this_ptr_conv.inner = untag_ptr(this_ptr);
46949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46951         this_ptr_conv.is_owned = false;
46952         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
46953         return ret_conv;
46954 }
46955
46956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
46957         LDKUpdateAddHTLC this_ptr_conv;
46958         this_ptr_conv.inner = untag_ptr(this_ptr);
46959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46961         this_ptr_conv.is_owned = false;
46962         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
46963 }
46964
46965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46966         LDKUpdateAddHTLC this_ptr_conv;
46967         this_ptr_conv.inner = untag_ptr(this_ptr);
46968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46970         this_ptr_conv.is_owned = false;
46971         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46972         *ret_copy = UpdateAddHTLC_get_skimmed_fee_msat(&this_ptr_conv);
46973         int64_t ret_ref = tag_ptr(ret_copy, true);
46974         return ret_ref;
46975 }
46976
46977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46978         LDKUpdateAddHTLC this_ptr_conv;
46979         this_ptr_conv.inner = untag_ptr(this_ptr);
46980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46982         this_ptr_conv.is_owned = false;
46983         void* val_ptr = untag_ptr(val);
46984         CHECK_ACCESS(val_ptr);
46985         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46986         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
46987         UpdateAddHTLC_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
46988 }
46989
46990 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
46991         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
46992         int64_t ret_ref = 0;
46993         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46994         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46995         return ret_ref;
46996 }
46997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46998         LDKUpdateAddHTLC arg_conv;
46999         arg_conv.inner = untag_ptr(arg);
47000         arg_conv.is_owned = ptr_is_owned(arg);
47001         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47002         arg_conv.is_owned = false;
47003         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
47004         return ret_conv;
47005 }
47006
47007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47008         LDKUpdateAddHTLC orig_conv;
47009         orig_conv.inner = untag_ptr(orig);
47010         orig_conv.is_owned = ptr_is_owned(orig);
47011         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47012         orig_conv.is_owned = false;
47013         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
47014         int64_t ret_ref = 0;
47015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47017         return ret_ref;
47018 }
47019
47020 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47021         LDKUpdateAddHTLC a_conv;
47022         a_conv.inner = untag_ptr(a);
47023         a_conv.is_owned = ptr_is_owned(a);
47024         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47025         a_conv.is_owned = false;
47026         LDKUpdateAddHTLC b_conv;
47027         b_conv.inner = untag_ptr(b);
47028         b_conv.is_owned = ptr_is_owned(b);
47029         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47030         b_conv.is_owned = false;
47031         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
47032         return ret_conv;
47033 }
47034
47035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47036         LDKOnionMessage this_obj_conv;
47037         this_obj_conv.inner = untag_ptr(this_obj);
47038         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47040         OnionMessage_free(this_obj_conv);
47041 }
47042
47043 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessage_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
47044         LDKOnionMessage this_ptr_conv;
47045         this_ptr_conv.inner = untag_ptr(this_ptr);
47046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47048         this_ptr_conv.is_owned = false;
47049         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47050         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form);
47051         return ret_arr;
47052 }
47053
47054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47055         LDKOnionMessage this_ptr_conv;
47056         this_ptr_conv.inner = untag_ptr(this_ptr);
47057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47059         this_ptr_conv.is_owned = false;
47060         LDKPublicKey val_ref;
47061         CHECK((*env)->GetArrayLength(env, val) == 33);
47062         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47063         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
47064 }
47065
47066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1get_1onion_1routing_1packet(JNIEnv *env, jclass clz, int64_t this_ptr) {
47067         LDKOnionMessage this_ptr_conv;
47068         this_ptr_conv.inner = untag_ptr(this_ptr);
47069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47071         this_ptr_conv.is_owned = false;
47072         LDKPacket ret_var = OnionMessage_get_onion_routing_packet(&this_ptr_conv);
47073         int64_t ret_ref = 0;
47074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47076         return ret_ref;
47077 }
47078
47079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1set_1onion_1routing_1packet(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47080         LDKOnionMessage this_ptr_conv;
47081         this_ptr_conv.inner = untag_ptr(this_ptr);
47082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47084         this_ptr_conv.is_owned = false;
47085         LDKPacket val_conv;
47086         val_conv.inner = untag_ptr(val);
47087         val_conv.is_owned = ptr_is_owned(val);
47088         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47089         val_conv = Packet_clone(&val_conv);
47090         OnionMessage_set_onion_routing_packet(&this_ptr_conv, val_conv);
47091 }
47092
47093 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) {
47094         LDKPublicKey blinding_point_arg_ref;
47095         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
47096         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
47097         LDKPacket onion_routing_packet_arg_conv;
47098         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
47099         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
47100         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
47101         onion_routing_packet_arg_conv = Packet_clone(&onion_routing_packet_arg_conv);
47102         LDKOnionMessage ret_var = OnionMessage_new(blinding_point_arg_ref, onion_routing_packet_arg_conv);
47103         int64_t ret_ref = 0;
47104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47106         return ret_ref;
47107 }
47108
47109 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
47110         LDKOnionMessage ret_var = OnionMessage_clone(arg);
47111         int64_t ret_ref = 0;
47112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47114         return ret_ref;
47115 }
47116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47117         LDKOnionMessage arg_conv;
47118         arg_conv.inner = untag_ptr(arg);
47119         arg_conv.is_owned = ptr_is_owned(arg);
47120         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47121         arg_conv.is_owned = false;
47122         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
47123         return ret_conv;
47124 }
47125
47126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47127         LDKOnionMessage orig_conv;
47128         orig_conv.inner = untag_ptr(orig);
47129         orig_conv.is_owned = ptr_is_owned(orig);
47130         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47131         orig_conv.is_owned = false;
47132         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
47133         int64_t ret_ref = 0;
47134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47136         return ret_ref;
47137 }
47138
47139 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OnionMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47140         LDKOnionMessage a_conv;
47141         a_conv.inner = untag_ptr(a);
47142         a_conv.is_owned = ptr_is_owned(a);
47143         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47144         a_conv.is_owned = false;
47145         LDKOnionMessage b_conv;
47146         b_conv.inner = untag_ptr(b);
47147         b_conv.is_owned = ptr_is_owned(b);
47148         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47149         b_conv.is_owned = false;
47150         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
47151         return ret_conv;
47152 }
47153
47154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47155         LDKUpdateFulfillHTLC this_obj_conv;
47156         this_obj_conv.inner = untag_ptr(this_obj);
47157         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47159         UpdateFulfillHTLC_free(this_obj_conv);
47160 }
47161
47162 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47163         LDKUpdateFulfillHTLC this_ptr_conv;
47164         this_ptr_conv.inner = untag_ptr(this_ptr);
47165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47167         this_ptr_conv.is_owned = false;
47168         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47169         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
47170         return ret_arr;
47171 }
47172
47173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47174         LDKUpdateFulfillHTLC this_ptr_conv;
47175         this_ptr_conv.inner = untag_ptr(this_ptr);
47176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47178         this_ptr_conv.is_owned = false;
47179         LDKThirtyTwoBytes val_ref;
47180         CHECK((*env)->GetArrayLength(env, val) == 32);
47181         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47182         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
47183 }
47184
47185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47186         LDKUpdateFulfillHTLC this_ptr_conv;
47187         this_ptr_conv.inner = untag_ptr(this_ptr);
47188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47190         this_ptr_conv.is_owned = false;
47191         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
47192         return ret_conv;
47193 }
47194
47195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47196         LDKUpdateFulfillHTLC this_ptr_conv;
47197         this_ptr_conv.inner = untag_ptr(this_ptr);
47198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47200         this_ptr_conv.is_owned = false;
47201         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
47202 }
47203
47204 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
47205         LDKUpdateFulfillHTLC this_ptr_conv;
47206         this_ptr_conv.inner = untag_ptr(this_ptr);
47207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47209         this_ptr_conv.is_owned = false;
47210         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47211         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
47212         return ret_arr;
47213 }
47214
47215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47216         LDKUpdateFulfillHTLC this_ptr_conv;
47217         this_ptr_conv.inner = untag_ptr(this_ptr);
47218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47220         this_ptr_conv.is_owned = false;
47221         LDKThirtyTwoBytes val_ref;
47222         CHECK((*env)->GetArrayLength(env, val) == 32);
47223         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47224         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
47225 }
47226
47227 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) {
47228         LDKThirtyTwoBytes channel_id_arg_ref;
47229         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
47230         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
47231         LDKThirtyTwoBytes payment_preimage_arg_ref;
47232         CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
47233         (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
47234         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
47235         int64_t ret_ref = 0;
47236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47238         return ret_ref;
47239 }
47240
47241 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
47242         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
47243         int64_t ret_ref = 0;
47244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47246         return ret_ref;
47247 }
47248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47249         LDKUpdateFulfillHTLC arg_conv;
47250         arg_conv.inner = untag_ptr(arg);
47251         arg_conv.is_owned = ptr_is_owned(arg);
47252         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47253         arg_conv.is_owned = false;
47254         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
47255         return ret_conv;
47256 }
47257
47258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47259         LDKUpdateFulfillHTLC orig_conv;
47260         orig_conv.inner = untag_ptr(orig);
47261         orig_conv.is_owned = ptr_is_owned(orig);
47262         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47263         orig_conv.is_owned = false;
47264         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
47265         int64_t ret_ref = 0;
47266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47268         return ret_ref;
47269 }
47270
47271 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47272         LDKUpdateFulfillHTLC a_conv;
47273         a_conv.inner = untag_ptr(a);
47274         a_conv.is_owned = ptr_is_owned(a);
47275         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47276         a_conv.is_owned = false;
47277         LDKUpdateFulfillHTLC b_conv;
47278         b_conv.inner = untag_ptr(b);
47279         b_conv.is_owned = ptr_is_owned(b);
47280         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47281         b_conv.is_owned = false;
47282         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
47283         return ret_conv;
47284 }
47285
47286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47287         LDKUpdateFailHTLC this_obj_conv;
47288         this_obj_conv.inner = untag_ptr(this_obj);
47289         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47291         UpdateFailHTLC_free(this_obj_conv);
47292 }
47293
47294 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47295         LDKUpdateFailHTLC this_ptr_conv;
47296         this_ptr_conv.inner = untag_ptr(this_ptr);
47297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47299         this_ptr_conv.is_owned = false;
47300         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47301         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
47302         return ret_arr;
47303 }
47304
47305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47306         LDKUpdateFailHTLC 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         LDKThirtyTwoBytes val_ref;
47312         CHECK((*env)->GetArrayLength(env, val) == 32);
47313         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47314         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
47315 }
47316
47317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47318         LDKUpdateFailHTLC this_ptr_conv;
47319         this_ptr_conv.inner = untag_ptr(this_ptr);
47320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47322         this_ptr_conv.is_owned = false;
47323         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
47324         return ret_conv;
47325 }
47326
47327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47328         LDKUpdateFailHTLC this_ptr_conv;
47329         this_ptr_conv.inner = untag_ptr(this_ptr);
47330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47332         this_ptr_conv.is_owned = false;
47333         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
47334 }
47335
47336 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
47337         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
47338         int64_t ret_ref = 0;
47339         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47340         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47341         return ret_ref;
47342 }
47343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47344         LDKUpdateFailHTLC arg_conv;
47345         arg_conv.inner = untag_ptr(arg);
47346         arg_conv.is_owned = ptr_is_owned(arg);
47347         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47348         arg_conv.is_owned = false;
47349         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
47350         return ret_conv;
47351 }
47352
47353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47354         LDKUpdateFailHTLC orig_conv;
47355         orig_conv.inner = untag_ptr(orig);
47356         orig_conv.is_owned = ptr_is_owned(orig);
47357         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47358         orig_conv.is_owned = false;
47359         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
47360         int64_t ret_ref = 0;
47361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47363         return ret_ref;
47364 }
47365
47366 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47367         LDKUpdateFailHTLC a_conv;
47368         a_conv.inner = untag_ptr(a);
47369         a_conv.is_owned = ptr_is_owned(a);
47370         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47371         a_conv.is_owned = false;
47372         LDKUpdateFailHTLC b_conv;
47373         b_conv.inner = untag_ptr(b);
47374         b_conv.is_owned = ptr_is_owned(b);
47375         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47376         b_conv.is_owned = false;
47377         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
47378         return ret_conv;
47379 }
47380
47381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47382         LDKUpdateFailMalformedHTLC this_obj_conv;
47383         this_obj_conv.inner = untag_ptr(this_obj);
47384         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47386         UpdateFailMalformedHTLC_free(this_obj_conv);
47387 }
47388
47389 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47390         LDKUpdateFailMalformedHTLC 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47396         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
47397         return ret_arr;
47398 }
47399
47400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47401         LDKUpdateFailMalformedHTLC this_ptr_conv;
47402         this_ptr_conv.inner = untag_ptr(this_ptr);
47403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47405         this_ptr_conv.is_owned = false;
47406         LDKThirtyTwoBytes val_ref;
47407         CHECK((*env)->GetArrayLength(env, val) == 32);
47408         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47409         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
47410 }
47411
47412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47413         LDKUpdateFailMalformedHTLC this_ptr_conv;
47414         this_ptr_conv.inner = untag_ptr(this_ptr);
47415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47417         this_ptr_conv.is_owned = false;
47418         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
47419         return ret_conv;
47420 }
47421
47422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47423         LDKUpdateFailMalformedHTLC this_ptr_conv;
47424         this_ptr_conv.inner = untag_ptr(this_ptr);
47425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47427         this_ptr_conv.is_owned = false;
47428         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
47429 }
47430
47431 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
47432         LDKUpdateFailMalformedHTLC this_ptr_conv;
47433         this_ptr_conv.inner = untag_ptr(this_ptr);
47434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47436         this_ptr_conv.is_owned = false;
47437         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
47438         return ret_conv;
47439 }
47440
47441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
47442         LDKUpdateFailMalformedHTLC this_ptr_conv;
47443         this_ptr_conv.inner = untag_ptr(this_ptr);
47444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47446         this_ptr_conv.is_owned = false;
47447         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
47448 }
47449
47450 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
47451         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
47452         int64_t ret_ref = 0;
47453         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47454         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47455         return ret_ref;
47456 }
47457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47458         LDKUpdateFailMalformedHTLC arg_conv;
47459         arg_conv.inner = untag_ptr(arg);
47460         arg_conv.is_owned = ptr_is_owned(arg);
47461         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47462         arg_conv.is_owned = false;
47463         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
47464         return ret_conv;
47465 }
47466
47467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47468         LDKUpdateFailMalformedHTLC orig_conv;
47469         orig_conv.inner = untag_ptr(orig);
47470         orig_conv.is_owned = ptr_is_owned(orig);
47471         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47472         orig_conv.is_owned = false;
47473         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
47474         int64_t ret_ref = 0;
47475         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47476         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47477         return ret_ref;
47478 }
47479
47480 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47481         LDKUpdateFailMalformedHTLC a_conv;
47482         a_conv.inner = untag_ptr(a);
47483         a_conv.is_owned = ptr_is_owned(a);
47484         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47485         a_conv.is_owned = false;
47486         LDKUpdateFailMalformedHTLC b_conv;
47487         b_conv.inner = untag_ptr(b);
47488         b_conv.is_owned = ptr_is_owned(b);
47489         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47490         b_conv.is_owned = false;
47491         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
47492         return ret_conv;
47493 }
47494
47495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47496         LDKCommitmentSigned this_obj_conv;
47497         this_obj_conv.inner = untag_ptr(this_obj);
47498         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47500         CommitmentSigned_free(this_obj_conv);
47501 }
47502
47503 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47504         LDKCommitmentSigned this_ptr_conv;
47505         this_ptr_conv.inner = untag_ptr(this_ptr);
47506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47508         this_ptr_conv.is_owned = false;
47509         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47510         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
47511         return ret_arr;
47512 }
47513
47514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47515         LDKCommitmentSigned this_ptr_conv;
47516         this_ptr_conv.inner = untag_ptr(this_ptr);
47517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47519         this_ptr_conv.is_owned = false;
47520         LDKThirtyTwoBytes val_ref;
47521         CHECK((*env)->GetArrayLength(env, val) == 32);
47522         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47523         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
47524 }
47525
47526 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
47527         LDKCommitmentSigned this_ptr_conv;
47528         this_ptr_conv.inner = untag_ptr(this_ptr);
47529         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47531         this_ptr_conv.is_owned = false;
47532         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
47533         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
47534         return ret_arr;
47535 }
47536
47537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47538         LDKCommitmentSigned this_ptr_conv;
47539         this_ptr_conv.inner = untag_ptr(this_ptr);
47540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47542         this_ptr_conv.is_owned = false;
47543         LDKECDSASignature val_ref;
47544         CHECK((*env)->GetArrayLength(env, val) == 64);
47545         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
47546         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
47547 }
47548
47549 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr) {
47550         LDKCommitmentSigned this_ptr_conv;
47551         this_ptr_conv.inner = untag_ptr(this_ptr);
47552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47554         this_ptr_conv.is_owned = false;
47555         LDKCVec_ECDSASignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
47556         jobjectArray ret_arr = NULL;
47557         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
47558         ;
47559         for (size_t i = 0; i < ret_var.datalen; i++) {
47560                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
47561                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
47562                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
47563         }
47564         
47565         FREE(ret_var.data);
47566         return ret_arr;
47567 }
47568
47569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
47570         LDKCommitmentSigned this_ptr_conv;
47571         this_ptr_conv.inner = untag_ptr(this_ptr);
47572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47574         this_ptr_conv.is_owned = false;
47575         LDKCVec_ECDSASignatureZ val_constr;
47576         val_constr.datalen = (*env)->GetArrayLength(env, val);
47577         if (val_constr.datalen > 0)
47578                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
47579         else
47580                 val_constr.data = NULL;
47581         for (size_t i = 0; i < val_constr.datalen; i++) {
47582                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
47583                 LDKECDSASignature val_conv_8_ref;
47584                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
47585                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
47586                 val_constr.data[i] = val_conv_8_ref;
47587         }
47588         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
47589 }
47590
47591 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) {
47592         LDKThirtyTwoBytes channel_id_arg_ref;
47593         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
47594         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
47595         LDKECDSASignature signature_arg_ref;
47596         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
47597         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
47598         LDKCVec_ECDSASignatureZ htlc_signatures_arg_constr;
47599         htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
47600         if (htlc_signatures_arg_constr.datalen > 0)
47601                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
47602         else
47603                 htlc_signatures_arg_constr.data = NULL;
47604         for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
47605                 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
47606                 LDKECDSASignature htlc_signatures_arg_conv_8_ref;
47607                 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
47608                 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
47609                 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
47610         }
47611         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
47612         int64_t ret_ref = 0;
47613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47615         return ret_ref;
47616 }
47617
47618 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
47619         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
47620         int64_t ret_ref = 0;
47621         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47622         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47623         return ret_ref;
47624 }
47625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47626         LDKCommitmentSigned arg_conv;
47627         arg_conv.inner = untag_ptr(arg);
47628         arg_conv.is_owned = ptr_is_owned(arg);
47629         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47630         arg_conv.is_owned = false;
47631         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
47632         return ret_conv;
47633 }
47634
47635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47636         LDKCommitmentSigned orig_conv;
47637         orig_conv.inner = untag_ptr(orig);
47638         orig_conv.is_owned = ptr_is_owned(orig);
47639         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47640         orig_conv.is_owned = false;
47641         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
47642         int64_t ret_ref = 0;
47643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47645         return ret_ref;
47646 }
47647
47648 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47649         LDKCommitmentSigned a_conv;
47650         a_conv.inner = untag_ptr(a);
47651         a_conv.is_owned = ptr_is_owned(a);
47652         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47653         a_conv.is_owned = false;
47654         LDKCommitmentSigned b_conv;
47655         b_conv.inner = untag_ptr(b);
47656         b_conv.is_owned = ptr_is_owned(b);
47657         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47658         b_conv.is_owned = false;
47659         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
47660         return ret_conv;
47661 }
47662
47663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47664         LDKRevokeAndACK this_obj_conv;
47665         this_obj_conv.inner = untag_ptr(this_obj);
47666         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47668         RevokeAndACK_free(this_obj_conv);
47669 }
47670
47671 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47672         LDKRevokeAndACK this_ptr_conv;
47673         this_ptr_conv.inner = untag_ptr(this_ptr);
47674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47676         this_ptr_conv.is_owned = false;
47677         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47678         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
47679         return ret_arr;
47680 }
47681
47682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47683         LDKRevokeAndACK this_ptr_conv;
47684         this_ptr_conv.inner = untag_ptr(this_ptr);
47685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47687         this_ptr_conv.is_owned = false;
47688         LDKThirtyTwoBytes val_ref;
47689         CHECK((*env)->GetArrayLength(env, val) == 32);
47690         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47691         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
47692 }
47693
47694 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
47695         LDKRevokeAndACK this_ptr_conv;
47696         this_ptr_conv.inner = untag_ptr(this_ptr);
47697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47699         this_ptr_conv.is_owned = false;
47700         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47701         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
47702         return ret_arr;
47703 }
47704
47705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47706         LDKRevokeAndACK this_ptr_conv;
47707         this_ptr_conv.inner = untag_ptr(this_ptr);
47708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47710         this_ptr_conv.is_owned = false;
47711         LDKThirtyTwoBytes val_ref;
47712         CHECK((*env)->GetArrayLength(env, val) == 32);
47713         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47714         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
47715 }
47716
47717 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
47718         LDKRevokeAndACK this_ptr_conv;
47719         this_ptr_conv.inner = untag_ptr(this_ptr);
47720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47722         this_ptr_conv.is_owned = false;
47723         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47724         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
47725         return ret_arr;
47726 }
47727
47728 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) {
47729         LDKRevokeAndACK this_ptr_conv;
47730         this_ptr_conv.inner = untag_ptr(this_ptr);
47731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47733         this_ptr_conv.is_owned = false;
47734         LDKPublicKey val_ref;
47735         CHECK((*env)->GetArrayLength(env, val) == 33);
47736         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47737         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
47738 }
47739
47740 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) {
47741         LDKThirtyTwoBytes channel_id_arg_ref;
47742         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
47743         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
47744         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
47745         CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
47746         (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
47747         LDKPublicKey next_per_commitment_point_arg_ref;
47748         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
47749         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
47750         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
47751         int64_t ret_ref = 0;
47752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47754         return ret_ref;
47755 }
47756
47757 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
47758         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
47759         int64_t ret_ref = 0;
47760         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47761         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47762         return ret_ref;
47763 }
47764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47765         LDKRevokeAndACK arg_conv;
47766         arg_conv.inner = untag_ptr(arg);
47767         arg_conv.is_owned = ptr_is_owned(arg);
47768         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47769         arg_conv.is_owned = false;
47770         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
47771         return ret_conv;
47772 }
47773
47774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47775         LDKRevokeAndACK orig_conv;
47776         orig_conv.inner = untag_ptr(orig);
47777         orig_conv.is_owned = ptr_is_owned(orig);
47778         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47779         orig_conv.is_owned = false;
47780         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
47781         int64_t ret_ref = 0;
47782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47784         return ret_ref;
47785 }
47786
47787 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47788         LDKRevokeAndACK a_conv;
47789         a_conv.inner = untag_ptr(a);
47790         a_conv.is_owned = ptr_is_owned(a);
47791         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47792         a_conv.is_owned = false;
47793         LDKRevokeAndACK b_conv;
47794         b_conv.inner = untag_ptr(b);
47795         b_conv.is_owned = ptr_is_owned(b);
47796         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47797         b_conv.is_owned = false;
47798         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
47799         return ret_conv;
47800 }
47801
47802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47803         LDKUpdateFee this_obj_conv;
47804         this_obj_conv.inner = untag_ptr(this_obj);
47805         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47807         UpdateFee_free(this_obj_conv);
47808 }
47809
47810 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47811         LDKUpdateFee this_ptr_conv;
47812         this_ptr_conv.inner = untag_ptr(this_ptr);
47813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47815         this_ptr_conv.is_owned = false;
47816         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47817         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
47818         return ret_arr;
47819 }
47820
47821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47822         LDKUpdateFee this_ptr_conv;
47823         this_ptr_conv.inner = untag_ptr(this_ptr);
47824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47826         this_ptr_conv.is_owned = false;
47827         LDKThirtyTwoBytes val_ref;
47828         CHECK((*env)->GetArrayLength(env, val) == 32);
47829         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47830         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
47831 }
47832
47833 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
47834         LDKUpdateFee this_ptr_conv;
47835         this_ptr_conv.inner = untag_ptr(this_ptr);
47836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47838         this_ptr_conv.is_owned = false;
47839         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
47840         return ret_conv;
47841 }
47842
47843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
47844         LDKUpdateFee this_ptr_conv;
47845         this_ptr_conv.inner = untag_ptr(this_ptr);
47846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47848         this_ptr_conv.is_owned = false;
47849         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
47850 }
47851
47852 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) {
47853         LDKThirtyTwoBytes channel_id_arg_ref;
47854         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
47855         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
47856         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
47857         int64_t ret_ref = 0;
47858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47860         return ret_ref;
47861 }
47862
47863 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
47864         LDKUpdateFee ret_var = UpdateFee_clone(arg);
47865         int64_t ret_ref = 0;
47866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47868         return ret_ref;
47869 }
47870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47871         LDKUpdateFee arg_conv;
47872         arg_conv.inner = untag_ptr(arg);
47873         arg_conv.is_owned = ptr_is_owned(arg);
47874         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47875         arg_conv.is_owned = false;
47876         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
47877         return ret_conv;
47878 }
47879
47880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47881         LDKUpdateFee orig_conv;
47882         orig_conv.inner = untag_ptr(orig);
47883         orig_conv.is_owned = ptr_is_owned(orig);
47884         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47885         orig_conv.is_owned = false;
47886         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
47887         int64_t ret_ref = 0;
47888         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47889         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47890         return ret_ref;
47891 }
47892
47893 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFee_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47894         LDKUpdateFee a_conv;
47895         a_conv.inner = untag_ptr(a);
47896         a_conv.is_owned = ptr_is_owned(a);
47897         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47898         a_conv.is_owned = false;
47899         LDKUpdateFee b_conv;
47900         b_conv.inner = untag_ptr(b);
47901         b_conv.is_owned = ptr_is_owned(b);
47902         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47903         b_conv.is_owned = false;
47904         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
47905         return ret_conv;
47906 }
47907
47908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47909         LDKChannelReestablish this_obj_conv;
47910         this_obj_conv.inner = untag_ptr(this_obj);
47911         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47913         ChannelReestablish_free(this_obj_conv);
47914 }
47915
47916 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47917         LDKChannelReestablish this_ptr_conv;
47918         this_ptr_conv.inner = untag_ptr(this_ptr);
47919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47921         this_ptr_conv.is_owned = false;
47922         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47923         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
47924         return ret_arr;
47925 }
47926
47927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47928         LDKChannelReestablish this_ptr_conv;
47929         this_ptr_conv.inner = untag_ptr(this_ptr);
47930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47932         this_ptr_conv.is_owned = false;
47933         LDKThirtyTwoBytes val_ref;
47934         CHECK((*env)->GetArrayLength(env, val) == 32);
47935         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47936         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
47937 }
47938
47939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
47940         LDKChannelReestablish this_ptr_conv;
47941         this_ptr_conv.inner = untag_ptr(this_ptr);
47942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47944         this_ptr_conv.is_owned = false;
47945         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
47946         return ret_conv;
47947 }
47948
47949 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) {
47950         LDKChannelReestablish this_ptr_conv;
47951         this_ptr_conv.inner = untag_ptr(this_ptr);
47952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47954         this_ptr_conv.is_owned = false;
47955         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
47956 }
47957
47958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
47959         LDKChannelReestablish 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         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
47965         return ret_conv;
47966 }
47967
47968 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) {
47969         LDKChannelReestablish this_ptr_conv;
47970         this_ptr_conv.inner = untag_ptr(this_ptr);
47971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47973         this_ptr_conv.is_owned = false;
47974         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
47975 }
47976
47977 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
47978         LDKChannelReestablish this_ptr_conv;
47979         this_ptr_conv.inner = untag_ptr(this_ptr);
47980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47982         this_ptr_conv.is_owned = false;
47983         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47984         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_your_last_per_commitment_secret(&this_ptr_conv));
47985         return ret_arr;
47986 }
47987
47988 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) {
47989         LDKChannelReestablish this_ptr_conv;
47990         this_ptr_conv.inner = untag_ptr(this_ptr);
47991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47993         this_ptr_conv.is_owned = false;
47994         LDKThirtyTwoBytes val_ref;
47995         CHECK((*env)->GetArrayLength(env, val) == 32);
47996         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47997         ChannelReestablish_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
47998 }
47999
48000 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
48001         LDKChannelReestablish this_ptr_conv;
48002         this_ptr_conv.inner = untag_ptr(this_ptr);
48003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48005         this_ptr_conv.is_owned = false;
48006         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48007         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReestablish_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
48008         return ret_arr;
48009 }
48010
48011 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) {
48012         LDKChannelReestablish this_ptr_conv;
48013         this_ptr_conv.inner = untag_ptr(this_ptr);
48014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48016         this_ptr_conv.is_owned = false;
48017         LDKPublicKey val_ref;
48018         CHECK((*env)->GetArrayLength(env, val) == 33);
48019         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48020         ChannelReestablish_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
48021 }
48022
48023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
48024         LDKChannelReestablish this_ptr_conv;
48025         this_ptr_conv.inner = untag_ptr(this_ptr);
48026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48028         this_ptr_conv.is_owned = false;
48029         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
48030         *ret_copy = ChannelReestablish_get_next_funding_txid(&this_ptr_conv);
48031         int64_t ret_ref = tag_ptr(ret_copy, true);
48032         return ret_ref;
48033 }
48034
48035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48036         LDKChannelReestablish this_ptr_conv;
48037         this_ptr_conv.inner = untag_ptr(this_ptr);
48038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48040         this_ptr_conv.is_owned = false;
48041         void* val_ptr = untag_ptr(val);
48042         CHECK_ACCESS(val_ptr);
48043         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
48044         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
48045         ChannelReestablish_set_next_funding_txid(&this_ptr_conv, val_conv);
48046 }
48047
48048 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) {
48049         LDKThirtyTwoBytes channel_id_arg_ref;
48050         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
48051         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
48052         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
48053         CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
48054         (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
48055         LDKPublicKey my_current_per_commitment_point_arg_ref;
48056         CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
48057         (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
48058         void* next_funding_txid_arg_ptr = untag_ptr(next_funding_txid_arg);
48059         CHECK_ACCESS(next_funding_txid_arg_ptr);
48060         LDKCOption_ThirtyTwoBytesZ next_funding_txid_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_funding_txid_arg_ptr);
48061         next_funding_txid_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_funding_txid_arg));
48062         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);
48063         int64_t ret_ref = 0;
48064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48066         return ret_ref;
48067 }
48068
48069 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
48070         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
48071         int64_t ret_ref = 0;
48072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48074         return ret_ref;
48075 }
48076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48077         LDKChannelReestablish arg_conv;
48078         arg_conv.inner = untag_ptr(arg);
48079         arg_conv.is_owned = ptr_is_owned(arg);
48080         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48081         arg_conv.is_owned = false;
48082         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
48083         return ret_conv;
48084 }
48085
48086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48087         LDKChannelReestablish orig_conv;
48088         orig_conv.inner = untag_ptr(orig);
48089         orig_conv.is_owned = ptr_is_owned(orig);
48090         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48091         orig_conv.is_owned = false;
48092         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
48093         int64_t ret_ref = 0;
48094         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48095         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48096         return ret_ref;
48097 }
48098
48099 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48100         LDKChannelReestablish a_conv;
48101         a_conv.inner = untag_ptr(a);
48102         a_conv.is_owned = ptr_is_owned(a);
48103         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48104         a_conv.is_owned = false;
48105         LDKChannelReestablish b_conv;
48106         b_conv.inner = untag_ptr(b);
48107         b_conv.is_owned = ptr_is_owned(b);
48108         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48109         b_conv.is_owned = false;
48110         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
48111         return ret_conv;
48112 }
48113
48114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48115         LDKAnnouncementSignatures this_obj_conv;
48116         this_obj_conv.inner = untag_ptr(this_obj);
48117         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48119         AnnouncementSignatures_free(this_obj_conv);
48120 }
48121
48122 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
48123         LDKAnnouncementSignatures this_ptr_conv;
48124         this_ptr_conv.inner = untag_ptr(this_ptr);
48125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48127         this_ptr_conv.is_owned = false;
48128         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
48129         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
48130         return ret_arr;
48131 }
48132
48133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48134         LDKAnnouncementSignatures this_ptr_conv;
48135         this_ptr_conv.inner = untag_ptr(this_ptr);
48136         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48138         this_ptr_conv.is_owned = false;
48139         LDKThirtyTwoBytes val_ref;
48140         CHECK((*env)->GetArrayLength(env, val) == 32);
48141         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
48142         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
48143 }
48144
48145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
48146         LDKAnnouncementSignatures this_ptr_conv;
48147         this_ptr_conv.inner = untag_ptr(this_ptr);
48148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48150         this_ptr_conv.is_owned = false;
48151         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
48152         return ret_conv;
48153 }
48154
48155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48156         LDKAnnouncementSignatures this_ptr_conv;
48157         this_ptr_conv.inner = untag_ptr(this_ptr);
48158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48160         this_ptr_conv.is_owned = false;
48161         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
48162 }
48163
48164 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
48165         LDKAnnouncementSignatures this_ptr_conv;
48166         this_ptr_conv.inner = untag_ptr(this_ptr);
48167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48169         this_ptr_conv.is_owned = false;
48170         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
48171         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
48172         return ret_arr;
48173 }
48174
48175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48176         LDKAnnouncementSignatures this_ptr_conv;
48177         this_ptr_conv.inner = untag_ptr(this_ptr);
48178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48180         this_ptr_conv.is_owned = false;
48181         LDKECDSASignature val_ref;
48182         CHECK((*env)->GetArrayLength(env, val) == 64);
48183         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
48184         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
48185 }
48186
48187 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
48188         LDKAnnouncementSignatures this_ptr_conv;
48189         this_ptr_conv.inner = untag_ptr(this_ptr);
48190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48192         this_ptr_conv.is_owned = false;
48193         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
48194         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
48195         return ret_arr;
48196 }
48197
48198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48199         LDKAnnouncementSignatures this_ptr_conv;
48200         this_ptr_conv.inner = untag_ptr(this_ptr);
48201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48203         this_ptr_conv.is_owned = false;
48204         LDKECDSASignature val_ref;
48205         CHECK((*env)->GetArrayLength(env, val) == 64);
48206         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
48207         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
48208 }
48209
48210 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) {
48211         LDKThirtyTwoBytes channel_id_arg_ref;
48212         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
48213         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
48214         LDKECDSASignature node_signature_arg_ref;
48215         CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
48216         (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
48217         LDKECDSASignature bitcoin_signature_arg_ref;
48218         CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
48219         (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
48220         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
48221         int64_t ret_ref = 0;
48222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48224         return ret_ref;
48225 }
48226
48227 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
48228         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
48229         int64_t ret_ref = 0;
48230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48232         return ret_ref;
48233 }
48234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48235         LDKAnnouncementSignatures arg_conv;
48236         arg_conv.inner = untag_ptr(arg);
48237         arg_conv.is_owned = ptr_is_owned(arg);
48238         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48239         arg_conv.is_owned = false;
48240         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
48241         return ret_conv;
48242 }
48243
48244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48245         LDKAnnouncementSignatures orig_conv;
48246         orig_conv.inner = untag_ptr(orig);
48247         orig_conv.is_owned = ptr_is_owned(orig);
48248         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48249         orig_conv.is_owned = false;
48250         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
48251         int64_t ret_ref = 0;
48252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48254         return ret_ref;
48255 }
48256
48257 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48258         LDKAnnouncementSignatures a_conv;
48259         a_conv.inner = untag_ptr(a);
48260         a_conv.is_owned = ptr_is_owned(a);
48261         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48262         a_conv.is_owned = false;
48263         LDKAnnouncementSignatures b_conv;
48264         b_conv.inner = untag_ptr(b);
48265         b_conv.is_owned = ptr_is_owned(b);
48266         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48267         b_conv.is_owned = false;
48268         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
48269         return ret_conv;
48270 }
48271
48272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
48273         if (!ptr_is_owned(this_ptr)) return;
48274         void* this_ptr_ptr = untag_ptr(this_ptr);
48275         CHECK_ACCESS(this_ptr_ptr);
48276         LDKSocketAddress this_ptr_conv = *(LDKSocketAddress*)(this_ptr_ptr);
48277         FREE(untag_ptr(this_ptr));
48278         SocketAddress_free(this_ptr_conv);
48279 }
48280
48281 static inline uint64_t SocketAddress_clone_ptr(LDKSocketAddress *NONNULL_PTR arg) {
48282         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
48283         *ret_copy = SocketAddress_clone(arg);
48284         int64_t ret_ref = tag_ptr(ret_copy, true);
48285         return ret_ref;
48286 }
48287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48288         LDKSocketAddress* arg_conv = (LDKSocketAddress*)untag_ptr(arg);
48289         int64_t ret_conv = SocketAddress_clone_ptr(arg_conv);
48290         return ret_conv;
48291 }
48292
48293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48294         LDKSocketAddress* orig_conv = (LDKSocketAddress*)untag_ptr(orig);
48295         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
48296         *ret_copy = SocketAddress_clone(orig_conv);
48297         int64_t ret_ref = tag_ptr(ret_copy, true);
48298         return ret_ref;
48299 }
48300
48301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1tcp_1ip_1v4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
48302         LDKFourBytes addr_ref;
48303         CHECK((*env)->GetArrayLength(env, addr) == 4);
48304         (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
48305         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
48306         *ret_copy = SocketAddress_tcp_ip_v4(addr_ref, port);
48307         int64_t ret_ref = tag_ptr(ret_copy, true);
48308         return ret_ref;
48309 }
48310
48311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1tcp_1ip_1v6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
48312         LDKSixteenBytes addr_ref;
48313         CHECK((*env)->GetArrayLength(env, addr) == 16);
48314         (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
48315         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
48316         *ret_copy = SocketAddress_tcp_ip_v6(addr_ref, port);
48317         int64_t ret_ref = tag_ptr(ret_copy, true);
48318         return ret_ref;
48319 }
48320
48321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray a) {
48322         LDKTwelveBytes a_ref;
48323         CHECK((*env)->GetArrayLength(env, a) == 12);
48324         (*env)->GetByteArrayRegion(env, a, 0, 12, a_ref.data);
48325         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
48326         *ret_copy = SocketAddress_onion_v2(a_ref);
48327         int64_t ret_ref = tag_ptr(ret_copy, true);
48328         return ret_ref;
48329 }
48330
48331 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) {
48332         LDKThirtyTwoBytes ed25519_pubkey_ref;
48333         CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
48334         (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
48335         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
48336         *ret_copy = SocketAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
48337         int64_t ret_ref = tag_ptr(ret_copy, true);
48338         return ret_ref;
48339 }
48340
48341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1hostname(JNIEnv *env, jclass clz, int64_t hostname, int16_t port) {
48342         LDKHostname hostname_conv;
48343         hostname_conv.inner = untag_ptr(hostname);
48344         hostname_conv.is_owned = ptr_is_owned(hostname);
48345         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
48346         hostname_conv = Hostname_clone(&hostname_conv);
48347         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
48348         *ret_copy = SocketAddress_hostname(hostname_conv, port);
48349         int64_t ret_ref = tag_ptr(ret_copy, true);
48350         return ret_ref;
48351 }
48352
48353 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SocketAddress_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48354         LDKSocketAddress* a_conv = (LDKSocketAddress*)untag_ptr(a);
48355         LDKSocketAddress* b_conv = (LDKSocketAddress*)untag_ptr(b);
48356         jboolean ret_conv = SocketAddress_eq(a_conv, b_conv);
48357         return ret_conv;
48358 }
48359
48360 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SocketAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
48361         LDKSocketAddress* obj_conv = (LDKSocketAddress*)untag_ptr(obj);
48362         LDKCVec_u8Z ret_var = SocketAddress_write(obj_conv);
48363         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48364         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48365         CVec_u8Z_free(ret_var);
48366         return ret_arr;
48367 }
48368
48369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48370         LDKu8slice ser_ref;
48371         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48372         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48373         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
48374         *ret_conv = SocketAddress_read(ser_ref);
48375         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48376         return tag_ptr(ret_conv, true);
48377 }
48378
48379 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48380         LDKSocketAddressParseError* orig_conv = (LDKSocketAddressParseError*)untag_ptr(orig);
48381         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_clone(orig_conv));
48382         return ret_conv;
48383 }
48384
48385 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1socket_1addr_1parse(JNIEnv *env, jclass clz) {
48386         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_socket_addr_parse());
48387         return ret_conv;
48388 }
48389
48390 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1invalid_1input(JNIEnv *env, jclass clz) {
48391         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_invalid_input());
48392         return ret_conv;
48393 }
48394
48395 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1invalid_1port(JNIEnv *env, jclass clz) {
48396         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_invalid_port());
48397         return ret_conv;
48398 }
48399
48400 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1invalid_1onion_1v3(JNIEnv *env, jclass clz) {
48401         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_invalid_onion_v3());
48402         return ret_conv;
48403 }
48404
48405 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48406         LDKSocketAddressParseError* a_conv = (LDKSocketAddressParseError*)untag_ptr(a);
48407         LDKSocketAddressParseError* b_conv = (LDKSocketAddressParseError*)untag_ptr(b);
48408         jboolean ret_conv = SocketAddressParseError_eq(a_conv, b_conv);
48409         return ret_conv;
48410 }
48411
48412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_parse_1onion_1address(JNIEnv *env, jclass clz, jstring host, int16_t port) {
48413         LDKStr host_conv = java_to_owned_str(env, host);
48414         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
48415         *ret_conv = parse_onion_address(host_conv, port);
48416         return tag_ptr(ret_conv, true);
48417 }
48418
48419 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SocketAddress_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
48420         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
48421         LDKStr ret_str = SocketAddress_to_str(o_conv);
48422         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
48423         Str_free(ret_str);
48424         return ret_conv;
48425 }
48426
48427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1from_1str(JNIEnv *env, jclass clz, jstring s) {
48428         LDKStr s_conv = java_to_owned_str(env, s);
48429         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
48430         *ret_conv = SocketAddress_from_str(s_conv);
48431         return tag_ptr(ret_conv, true);
48432 }
48433
48434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
48435         if (!ptr_is_owned(this_ptr)) return;
48436         void* this_ptr_ptr = untag_ptr(this_ptr);
48437         CHECK_ACCESS(this_ptr_ptr);
48438         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
48439         FREE(untag_ptr(this_ptr));
48440         UnsignedGossipMessage_free(this_ptr_conv);
48441 }
48442
48443 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
48444         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
48445         *ret_copy = UnsignedGossipMessage_clone(arg);
48446         int64_t ret_ref = tag_ptr(ret_copy, true);
48447         return ret_ref;
48448 }
48449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48450         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
48451         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
48452         return ret_conv;
48453 }
48454
48455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48456         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
48457         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
48458         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
48459         int64_t ret_ref = tag_ptr(ret_copy, true);
48460         return ret_ref;
48461 }
48462
48463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1channel_1announcement(JNIEnv *env, jclass clz, int64_t a) {
48464         LDKUnsignedChannelAnnouncement a_conv;
48465         a_conv.inner = untag_ptr(a);
48466         a_conv.is_owned = ptr_is_owned(a);
48467         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48468         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
48469         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
48470         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
48471         int64_t ret_ref = tag_ptr(ret_copy, true);
48472         return ret_ref;
48473 }
48474
48475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1channel_1update(JNIEnv *env, jclass clz, int64_t a) {
48476         LDKUnsignedChannelUpdate a_conv;
48477         a_conv.inner = untag_ptr(a);
48478         a_conv.is_owned = ptr_is_owned(a);
48479         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48480         a_conv = UnsignedChannelUpdate_clone(&a_conv);
48481         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
48482         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
48483         int64_t ret_ref = tag_ptr(ret_copy, true);
48484         return ret_ref;
48485 }
48486
48487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1node_1announcement(JNIEnv *env, jclass clz, int64_t a) {
48488         LDKUnsignedNodeAnnouncement a_conv;
48489         a_conv.inner = untag_ptr(a);
48490         a_conv.is_owned = ptr_is_owned(a);
48491         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48492         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
48493         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
48494         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
48495         int64_t ret_ref = tag_ptr(ret_copy, true);
48496         return ret_ref;
48497 }
48498
48499 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
48500         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
48501         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
48502         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48503         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48504         CVec_u8Z_free(ret_var);
48505         return ret_arr;
48506 }
48507
48508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48509         LDKUnsignedNodeAnnouncement this_obj_conv;
48510         this_obj_conv.inner = untag_ptr(this_obj);
48511         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48513         UnsignedNodeAnnouncement_free(this_obj_conv);
48514 }
48515
48516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
48517         LDKUnsignedNodeAnnouncement this_ptr_conv;
48518         this_ptr_conv.inner = untag_ptr(this_ptr);
48519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48521         this_ptr_conv.is_owned = false;
48522         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
48523         int64_t ret_ref = 0;
48524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48526         return ret_ref;
48527 }
48528
48529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48530         LDKUnsignedNodeAnnouncement this_ptr_conv;
48531         this_ptr_conv.inner = untag_ptr(this_ptr);
48532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48534         this_ptr_conv.is_owned = false;
48535         LDKNodeFeatures val_conv;
48536         val_conv.inner = untag_ptr(val);
48537         val_conv.is_owned = ptr_is_owned(val);
48538         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48539         val_conv = NodeFeatures_clone(&val_conv);
48540         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
48541 }
48542
48543 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
48544         LDKUnsignedNodeAnnouncement this_ptr_conv;
48545         this_ptr_conv.inner = untag_ptr(this_ptr);
48546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48548         this_ptr_conv.is_owned = false;
48549         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
48550         return ret_conv;
48551 }
48552
48553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
48554         LDKUnsignedNodeAnnouncement this_ptr_conv;
48555         this_ptr_conv.inner = untag_ptr(this_ptr);
48556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48558         this_ptr_conv.is_owned = false;
48559         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
48560 }
48561
48562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
48563         LDKUnsignedNodeAnnouncement this_ptr_conv;
48564         this_ptr_conv.inner = untag_ptr(this_ptr);
48565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48567         this_ptr_conv.is_owned = false;
48568         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
48569         int64_t ret_ref = 0;
48570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48572         return ret_ref;
48573 }
48574
48575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48576         LDKUnsignedNodeAnnouncement this_ptr_conv;
48577         this_ptr_conv.inner = untag_ptr(this_ptr);
48578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48580         this_ptr_conv.is_owned = false;
48581         LDKNodeId val_conv;
48582         val_conv.inner = untag_ptr(val);
48583         val_conv.is_owned = ptr_is_owned(val);
48584         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48585         val_conv = NodeId_clone(&val_conv);
48586         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
48587 }
48588
48589 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
48590         LDKUnsignedNodeAnnouncement this_ptr_conv;
48591         this_ptr_conv.inner = untag_ptr(this_ptr);
48592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48594         this_ptr_conv.is_owned = false;
48595         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
48596         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
48597         return ret_arr;
48598 }
48599
48600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48601         LDKUnsignedNodeAnnouncement this_ptr_conv;
48602         this_ptr_conv.inner = untag_ptr(this_ptr);
48603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48605         this_ptr_conv.is_owned = false;
48606         LDKThreeBytes val_ref;
48607         CHECK((*env)->GetArrayLength(env, val) == 3);
48608         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
48609         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
48610 }
48611
48612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
48613         LDKUnsignedNodeAnnouncement this_ptr_conv;
48614         this_ptr_conv.inner = untag_ptr(this_ptr);
48615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48617         this_ptr_conv.is_owned = false;
48618         LDKNodeAlias ret_var = UnsignedNodeAnnouncement_get_alias(&this_ptr_conv);
48619         int64_t ret_ref = 0;
48620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48622         return ret_ref;
48623 }
48624
48625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48626         LDKUnsignedNodeAnnouncement this_ptr_conv;
48627         this_ptr_conv.inner = untag_ptr(this_ptr);
48628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48630         this_ptr_conv.is_owned = false;
48631         LDKNodeAlias val_conv;
48632         val_conv.inner = untag_ptr(val);
48633         val_conv.is_owned = ptr_is_owned(val);
48634         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48635         val_conv = NodeAlias_clone(&val_conv);
48636         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_conv);
48637 }
48638
48639 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr) {
48640         LDKUnsignedNodeAnnouncement this_ptr_conv;
48641         this_ptr_conv.inner = untag_ptr(this_ptr);
48642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48644         this_ptr_conv.is_owned = false;
48645         LDKCVec_SocketAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
48646         int64_tArray ret_arr = NULL;
48647         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
48648         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
48649         for (size_t p = 0; p < ret_var.datalen; p++) {
48650                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
48651                 *ret_conv_15_copy = ret_var.data[p];
48652                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
48653                 ret_arr_ptr[p] = ret_conv_15_ref;
48654         }
48655         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
48656         FREE(ret_var.data);
48657         return ret_arr;
48658 }
48659
48660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
48661         LDKUnsignedNodeAnnouncement this_ptr_conv;
48662         this_ptr_conv.inner = untag_ptr(this_ptr);
48663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48665         this_ptr_conv.is_owned = false;
48666         LDKCVec_SocketAddressZ val_constr;
48667         val_constr.datalen = (*env)->GetArrayLength(env, val);
48668         if (val_constr.datalen > 0)
48669                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
48670         else
48671                 val_constr.data = NULL;
48672         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
48673         for (size_t p = 0; p < val_constr.datalen; p++) {
48674                 int64_t val_conv_15 = val_vals[p];
48675                 void* val_conv_15_ptr = untag_ptr(val_conv_15);
48676                 CHECK_ACCESS(val_conv_15_ptr);
48677                 LDKSocketAddress val_conv_15_conv = *(LDKSocketAddress*)(val_conv_15_ptr);
48678                 val_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(val_conv_15));
48679                 val_constr.data[p] = val_conv_15_conv;
48680         }
48681         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
48682         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
48683 }
48684
48685 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
48686         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
48687         int64_t ret_ref = 0;
48688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48690         return ret_ref;
48691 }
48692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48693         LDKUnsignedNodeAnnouncement arg_conv;
48694         arg_conv.inner = untag_ptr(arg);
48695         arg_conv.is_owned = ptr_is_owned(arg);
48696         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48697         arg_conv.is_owned = false;
48698         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
48699         return ret_conv;
48700 }
48701
48702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48703         LDKUnsignedNodeAnnouncement orig_conv;
48704         orig_conv.inner = untag_ptr(orig);
48705         orig_conv.is_owned = ptr_is_owned(orig);
48706         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48707         orig_conv.is_owned = false;
48708         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
48709         int64_t ret_ref = 0;
48710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48712         return ret_ref;
48713 }
48714
48715 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48716         LDKUnsignedNodeAnnouncement a_conv;
48717         a_conv.inner = untag_ptr(a);
48718         a_conv.is_owned = ptr_is_owned(a);
48719         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48720         a_conv.is_owned = false;
48721         LDKUnsignedNodeAnnouncement b_conv;
48722         b_conv.inner = untag_ptr(b);
48723         b_conv.is_owned = ptr_is_owned(b);
48724         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48725         b_conv.is_owned = false;
48726         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
48727         return ret_conv;
48728 }
48729
48730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48731         LDKNodeAnnouncement this_obj_conv;
48732         this_obj_conv.inner = untag_ptr(this_obj);
48733         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48735         NodeAnnouncement_free(this_obj_conv);
48736 }
48737
48738 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
48739         LDKNodeAnnouncement this_ptr_conv;
48740         this_ptr_conv.inner = untag_ptr(this_ptr);
48741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48743         this_ptr_conv.is_owned = false;
48744         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
48745         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
48746         return ret_arr;
48747 }
48748
48749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48750         LDKNodeAnnouncement this_ptr_conv;
48751         this_ptr_conv.inner = untag_ptr(this_ptr);
48752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48754         this_ptr_conv.is_owned = false;
48755         LDKECDSASignature val_ref;
48756         CHECK((*env)->GetArrayLength(env, val) == 64);
48757         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
48758         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
48759 }
48760
48761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
48762         LDKNodeAnnouncement this_ptr_conv;
48763         this_ptr_conv.inner = untag_ptr(this_ptr);
48764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48766         this_ptr_conv.is_owned = false;
48767         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
48768         int64_t ret_ref = 0;
48769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48771         return ret_ref;
48772 }
48773
48774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48775         LDKNodeAnnouncement this_ptr_conv;
48776         this_ptr_conv.inner = untag_ptr(this_ptr);
48777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48779         this_ptr_conv.is_owned = false;
48780         LDKUnsignedNodeAnnouncement val_conv;
48781         val_conv.inner = untag_ptr(val);
48782         val_conv.is_owned = ptr_is_owned(val);
48783         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48784         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
48785         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
48786 }
48787
48788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
48789         LDKECDSASignature signature_arg_ref;
48790         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
48791         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
48792         LDKUnsignedNodeAnnouncement contents_arg_conv;
48793         contents_arg_conv.inner = untag_ptr(contents_arg);
48794         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
48795         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
48796         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
48797         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
48798         int64_t ret_ref = 0;
48799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48801         return ret_ref;
48802 }
48803
48804 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
48805         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
48806         int64_t ret_ref = 0;
48807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48809         return ret_ref;
48810 }
48811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48812         LDKNodeAnnouncement arg_conv;
48813         arg_conv.inner = untag_ptr(arg);
48814         arg_conv.is_owned = ptr_is_owned(arg);
48815         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48816         arg_conv.is_owned = false;
48817         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
48818         return ret_conv;
48819 }
48820
48821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48822         LDKNodeAnnouncement orig_conv;
48823         orig_conv.inner = untag_ptr(orig);
48824         orig_conv.is_owned = ptr_is_owned(orig);
48825         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48826         orig_conv.is_owned = false;
48827         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
48828         int64_t ret_ref = 0;
48829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48831         return ret_ref;
48832 }
48833
48834 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48835         LDKNodeAnnouncement a_conv;
48836         a_conv.inner = untag_ptr(a);
48837         a_conv.is_owned = ptr_is_owned(a);
48838         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48839         a_conv.is_owned = false;
48840         LDKNodeAnnouncement b_conv;
48841         b_conv.inner = untag_ptr(b);
48842         b_conv.is_owned = ptr_is_owned(b);
48843         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48844         b_conv.is_owned = false;
48845         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
48846         return ret_conv;
48847 }
48848
48849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48850         LDKUnsignedChannelAnnouncement this_obj_conv;
48851         this_obj_conv.inner = untag_ptr(this_obj);
48852         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48854         UnsignedChannelAnnouncement_free(this_obj_conv);
48855 }
48856
48857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
48858         LDKUnsignedChannelAnnouncement this_ptr_conv;
48859         this_ptr_conv.inner = untag_ptr(this_ptr);
48860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48862         this_ptr_conv.is_owned = false;
48863         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
48864         int64_t ret_ref = 0;
48865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48867         return ret_ref;
48868 }
48869
48870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48871         LDKUnsignedChannelAnnouncement this_ptr_conv;
48872         this_ptr_conv.inner = untag_ptr(this_ptr);
48873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48875         this_ptr_conv.is_owned = false;
48876         LDKChannelFeatures val_conv;
48877         val_conv.inner = untag_ptr(val);
48878         val_conv.is_owned = ptr_is_owned(val);
48879         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48880         val_conv = ChannelFeatures_clone(&val_conv);
48881         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
48882 }
48883
48884 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
48885         LDKUnsignedChannelAnnouncement this_ptr_conv;
48886         this_ptr_conv.inner = untag_ptr(this_ptr);
48887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48889         this_ptr_conv.is_owned = false;
48890         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
48891         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
48892         return ret_arr;
48893 }
48894
48895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48896         LDKUnsignedChannelAnnouncement this_ptr_conv;
48897         this_ptr_conv.inner = untag_ptr(this_ptr);
48898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48900         this_ptr_conv.is_owned = false;
48901         LDKThirtyTwoBytes val_ref;
48902         CHECK((*env)->GetArrayLength(env, val) == 32);
48903         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
48904         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
48905 }
48906
48907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
48908         LDKUnsignedChannelAnnouncement this_ptr_conv;
48909         this_ptr_conv.inner = untag_ptr(this_ptr);
48910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48912         this_ptr_conv.is_owned = false;
48913         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
48914         return ret_conv;
48915 }
48916
48917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48918         LDKUnsignedChannelAnnouncement this_ptr_conv;
48919         this_ptr_conv.inner = untag_ptr(this_ptr);
48920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48922         this_ptr_conv.is_owned = false;
48923         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
48924 }
48925
48926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
48927         LDKUnsignedChannelAnnouncement this_ptr_conv;
48928         this_ptr_conv.inner = untag_ptr(this_ptr);
48929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48931         this_ptr_conv.is_owned = false;
48932         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
48933         int64_t ret_ref = 0;
48934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48936         return ret_ref;
48937 }
48938
48939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48940         LDKUnsignedChannelAnnouncement this_ptr_conv;
48941         this_ptr_conv.inner = untag_ptr(this_ptr);
48942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48944         this_ptr_conv.is_owned = false;
48945         LDKNodeId val_conv;
48946         val_conv.inner = untag_ptr(val);
48947         val_conv.is_owned = ptr_is_owned(val);
48948         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48949         val_conv = NodeId_clone(&val_conv);
48950         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
48951 }
48952
48953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
48954         LDKUnsignedChannelAnnouncement this_ptr_conv;
48955         this_ptr_conv.inner = untag_ptr(this_ptr);
48956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48958         this_ptr_conv.is_owned = false;
48959         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
48960         int64_t ret_ref = 0;
48961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48963         return ret_ref;
48964 }
48965
48966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48967         LDKUnsignedChannelAnnouncement this_ptr_conv;
48968         this_ptr_conv.inner = untag_ptr(this_ptr);
48969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48971         this_ptr_conv.is_owned = false;
48972         LDKNodeId val_conv;
48973         val_conv.inner = untag_ptr(val);
48974         val_conv.is_owned = ptr_is_owned(val);
48975         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48976         val_conv = NodeId_clone(&val_conv);
48977         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
48978 }
48979
48980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
48981         LDKUnsignedChannelAnnouncement this_ptr_conv;
48982         this_ptr_conv.inner = untag_ptr(this_ptr);
48983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48985         this_ptr_conv.is_owned = false;
48986         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
48987         int64_t ret_ref = 0;
48988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48990         return ret_ref;
48991 }
48992
48993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48994         LDKUnsignedChannelAnnouncement this_ptr_conv;
48995         this_ptr_conv.inner = untag_ptr(this_ptr);
48996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48998         this_ptr_conv.is_owned = false;
48999         LDKNodeId val_conv;
49000         val_conv.inner = untag_ptr(val);
49001         val_conv.is_owned = ptr_is_owned(val);
49002         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49003         val_conv = NodeId_clone(&val_conv);
49004         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
49005 }
49006
49007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
49008         LDKUnsignedChannelAnnouncement this_ptr_conv;
49009         this_ptr_conv.inner = untag_ptr(this_ptr);
49010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49012         this_ptr_conv.is_owned = false;
49013         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
49014         int64_t ret_ref = 0;
49015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49017         return ret_ref;
49018 }
49019
49020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49021         LDKUnsignedChannelAnnouncement this_ptr_conv;
49022         this_ptr_conv.inner = untag_ptr(this_ptr);
49023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49025         this_ptr_conv.is_owned = false;
49026         LDKNodeId val_conv;
49027         val_conv.inner = untag_ptr(val);
49028         val_conv.is_owned = ptr_is_owned(val);
49029         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49030         val_conv = NodeId_clone(&val_conv);
49031         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
49032 }
49033
49034 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
49035         LDKUnsignedChannelAnnouncement this_ptr_conv;
49036         this_ptr_conv.inner = untag_ptr(this_ptr);
49037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49039         this_ptr_conv.is_owned = false;
49040         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_get_excess_data(&this_ptr_conv);
49041         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49042         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49043         CVec_u8Z_free(ret_var);
49044         return ret_arr;
49045 }
49046
49047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49048         LDKUnsignedChannelAnnouncement this_ptr_conv;
49049         this_ptr_conv.inner = untag_ptr(this_ptr);
49050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49052         this_ptr_conv.is_owned = false;
49053         LDKCVec_u8Z val_ref;
49054         val_ref.datalen = (*env)->GetArrayLength(env, val);
49055         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
49056         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
49057         UnsignedChannelAnnouncement_set_excess_data(&this_ptr_conv, val_ref);
49058 }
49059
49060 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) {
49061         LDKChannelFeatures features_arg_conv;
49062         features_arg_conv.inner = untag_ptr(features_arg);
49063         features_arg_conv.is_owned = ptr_is_owned(features_arg);
49064         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
49065         features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
49066         LDKThirtyTwoBytes chain_hash_arg_ref;
49067         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
49068         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
49069         LDKNodeId node_id_1_arg_conv;
49070         node_id_1_arg_conv.inner = untag_ptr(node_id_1_arg);
49071         node_id_1_arg_conv.is_owned = ptr_is_owned(node_id_1_arg);
49072         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_1_arg_conv);
49073         node_id_1_arg_conv = NodeId_clone(&node_id_1_arg_conv);
49074         LDKNodeId node_id_2_arg_conv;
49075         node_id_2_arg_conv.inner = untag_ptr(node_id_2_arg);
49076         node_id_2_arg_conv.is_owned = ptr_is_owned(node_id_2_arg);
49077         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_2_arg_conv);
49078         node_id_2_arg_conv = NodeId_clone(&node_id_2_arg_conv);
49079         LDKNodeId bitcoin_key_1_arg_conv;
49080         bitcoin_key_1_arg_conv.inner = untag_ptr(bitcoin_key_1_arg);
49081         bitcoin_key_1_arg_conv.is_owned = ptr_is_owned(bitcoin_key_1_arg);
49082         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_1_arg_conv);
49083         bitcoin_key_1_arg_conv = NodeId_clone(&bitcoin_key_1_arg_conv);
49084         LDKNodeId bitcoin_key_2_arg_conv;
49085         bitcoin_key_2_arg_conv.inner = untag_ptr(bitcoin_key_2_arg);
49086         bitcoin_key_2_arg_conv.is_owned = ptr_is_owned(bitcoin_key_2_arg);
49087         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_2_arg_conv);
49088         bitcoin_key_2_arg_conv = NodeId_clone(&bitcoin_key_2_arg_conv);
49089         LDKCVec_u8Z excess_data_arg_ref;
49090         excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg);
49091         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
49092         (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data);
49093         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);
49094         int64_t ret_ref = 0;
49095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49097         return ret_ref;
49098 }
49099
49100 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
49101         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
49102         int64_t ret_ref = 0;
49103         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49104         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49105         return ret_ref;
49106 }
49107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49108         LDKUnsignedChannelAnnouncement arg_conv;
49109         arg_conv.inner = untag_ptr(arg);
49110         arg_conv.is_owned = ptr_is_owned(arg);
49111         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49112         arg_conv.is_owned = false;
49113         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
49114         return ret_conv;
49115 }
49116
49117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49118         LDKUnsignedChannelAnnouncement orig_conv;
49119         orig_conv.inner = untag_ptr(orig);
49120         orig_conv.is_owned = ptr_is_owned(orig);
49121         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49122         orig_conv.is_owned = false;
49123         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
49124         int64_t ret_ref = 0;
49125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49127         return ret_ref;
49128 }
49129
49130 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49131         LDKUnsignedChannelAnnouncement a_conv;
49132         a_conv.inner = untag_ptr(a);
49133         a_conv.is_owned = ptr_is_owned(a);
49134         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49135         a_conv.is_owned = false;
49136         LDKUnsignedChannelAnnouncement b_conv;
49137         b_conv.inner = untag_ptr(b);
49138         b_conv.is_owned = ptr_is_owned(b);
49139         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49140         b_conv.is_owned = false;
49141         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
49142         return ret_conv;
49143 }
49144
49145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49146         LDKChannelAnnouncement this_obj_conv;
49147         this_obj_conv.inner = untag_ptr(this_obj);
49148         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49150         ChannelAnnouncement_free(this_obj_conv);
49151 }
49152
49153 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
49154         LDKChannelAnnouncement this_ptr_conv;
49155         this_ptr_conv.inner = untag_ptr(this_ptr);
49156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49158         this_ptr_conv.is_owned = false;
49159         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
49160         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
49161         return ret_arr;
49162 }
49163
49164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49165         LDKChannelAnnouncement this_ptr_conv;
49166         this_ptr_conv.inner = untag_ptr(this_ptr);
49167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49169         this_ptr_conv.is_owned = false;
49170         LDKECDSASignature val_ref;
49171         CHECK((*env)->GetArrayLength(env, val) == 64);
49172         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
49173         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
49174 }
49175
49176 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
49177         LDKChannelAnnouncement this_ptr_conv;
49178         this_ptr_conv.inner = untag_ptr(this_ptr);
49179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49181         this_ptr_conv.is_owned = false;
49182         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
49183         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
49184         return ret_arr;
49185 }
49186
49187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49188         LDKChannelAnnouncement this_ptr_conv;
49189         this_ptr_conv.inner = untag_ptr(this_ptr);
49190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49192         this_ptr_conv.is_owned = false;
49193         LDKECDSASignature val_ref;
49194         CHECK((*env)->GetArrayLength(env, val) == 64);
49195         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
49196         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
49197 }
49198
49199 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
49200         LDKChannelAnnouncement this_ptr_conv;
49201         this_ptr_conv.inner = untag_ptr(this_ptr);
49202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49204         this_ptr_conv.is_owned = false;
49205         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
49206         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
49207         return ret_arr;
49208 }
49209
49210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49211         LDKChannelAnnouncement this_ptr_conv;
49212         this_ptr_conv.inner = untag_ptr(this_ptr);
49213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49215         this_ptr_conv.is_owned = false;
49216         LDKECDSASignature val_ref;
49217         CHECK((*env)->GetArrayLength(env, val) == 64);
49218         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
49219         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
49220 }
49221
49222 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
49223         LDKChannelAnnouncement this_ptr_conv;
49224         this_ptr_conv.inner = untag_ptr(this_ptr);
49225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49227         this_ptr_conv.is_owned = false;
49228         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
49229         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
49230         return ret_arr;
49231 }
49232
49233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49234         LDKChannelAnnouncement this_ptr_conv;
49235         this_ptr_conv.inner = untag_ptr(this_ptr);
49236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49238         this_ptr_conv.is_owned = false;
49239         LDKECDSASignature val_ref;
49240         CHECK((*env)->GetArrayLength(env, val) == 64);
49241         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
49242         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
49243 }
49244
49245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
49246         LDKChannelAnnouncement this_ptr_conv;
49247         this_ptr_conv.inner = untag_ptr(this_ptr);
49248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49250         this_ptr_conv.is_owned = false;
49251         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
49252         int64_t ret_ref = 0;
49253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49255         return ret_ref;
49256 }
49257
49258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49259         LDKChannelAnnouncement this_ptr_conv;
49260         this_ptr_conv.inner = untag_ptr(this_ptr);
49261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49263         this_ptr_conv.is_owned = false;
49264         LDKUnsignedChannelAnnouncement val_conv;
49265         val_conv.inner = untag_ptr(val);
49266         val_conv.is_owned = ptr_is_owned(val);
49267         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49268         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
49269         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
49270 }
49271
49272 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) {
49273         LDKECDSASignature node_signature_1_arg_ref;
49274         CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
49275         (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
49276         LDKECDSASignature node_signature_2_arg_ref;
49277         CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
49278         (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
49279         LDKECDSASignature bitcoin_signature_1_arg_ref;
49280         CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
49281         (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
49282         LDKECDSASignature bitcoin_signature_2_arg_ref;
49283         CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
49284         (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
49285         LDKUnsignedChannelAnnouncement contents_arg_conv;
49286         contents_arg_conv.inner = untag_ptr(contents_arg);
49287         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
49288         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
49289         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
49290         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);
49291         int64_t ret_ref = 0;
49292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49294         return ret_ref;
49295 }
49296
49297 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
49298         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
49299         int64_t ret_ref = 0;
49300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49302         return ret_ref;
49303 }
49304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49305         LDKChannelAnnouncement arg_conv;
49306         arg_conv.inner = untag_ptr(arg);
49307         arg_conv.is_owned = ptr_is_owned(arg);
49308         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49309         arg_conv.is_owned = false;
49310         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
49311         return ret_conv;
49312 }
49313
49314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49315         LDKChannelAnnouncement orig_conv;
49316         orig_conv.inner = untag_ptr(orig);
49317         orig_conv.is_owned = ptr_is_owned(orig);
49318         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49319         orig_conv.is_owned = false;
49320         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
49321         int64_t ret_ref = 0;
49322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49324         return ret_ref;
49325 }
49326
49327 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49328         LDKChannelAnnouncement a_conv;
49329         a_conv.inner = untag_ptr(a);
49330         a_conv.is_owned = ptr_is_owned(a);
49331         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49332         a_conv.is_owned = false;
49333         LDKChannelAnnouncement b_conv;
49334         b_conv.inner = untag_ptr(b);
49335         b_conv.is_owned = ptr_is_owned(b);
49336         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49337         b_conv.is_owned = false;
49338         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
49339         return ret_conv;
49340 }
49341
49342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49343         LDKUnsignedChannelUpdate this_obj_conv;
49344         this_obj_conv.inner = untag_ptr(this_obj);
49345         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49347         UnsignedChannelUpdate_free(this_obj_conv);
49348 }
49349
49350 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
49351         LDKUnsignedChannelUpdate this_ptr_conv;
49352         this_ptr_conv.inner = untag_ptr(this_ptr);
49353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49355         this_ptr_conv.is_owned = false;
49356         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49357         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
49358         return ret_arr;
49359 }
49360
49361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49362         LDKUnsignedChannelUpdate this_ptr_conv;
49363         this_ptr_conv.inner = untag_ptr(this_ptr);
49364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49366         this_ptr_conv.is_owned = false;
49367         LDKThirtyTwoBytes val_ref;
49368         CHECK((*env)->GetArrayLength(env, val) == 32);
49369         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49370         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
49371 }
49372
49373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
49374         LDKUnsignedChannelUpdate this_ptr_conv;
49375         this_ptr_conv.inner = untag_ptr(this_ptr);
49376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49378         this_ptr_conv.is_owned = false;
49379         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
49380         return ret_conv;
49381 }
49382
49383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49384         LDKUnsignedChannelUpdate this_ptr_conv;
49385         this_ptr_conv.inner = untag_ptr(this_ptr);
49386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49388         this_ptr_conv.is_owned = false;
49389         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
49390 }
49391
49392 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
49393         LDKUnsignedChannelUpdate this_ptr_conv;
49394         this_ptr_conv.inner = untag_ptr(this_ptr);
49395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49397         this_ptr_conv.is_owned = false;
49398         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
49399         return ret_conv;
49400 }
49401
49402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49403         LDKUnsignedChannelUpdate this_ptr_conv;
49404         this_ptr_conv.inner = untag_ptr(this_ptr);
49405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49407         this_ptr_conv.is_owned = false;
49408         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
49409 }
49410
49411 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
49412         LDKUnsignedChannelUpdate this_ptr_conv;
49413         this_ptr_conv.inner = untag_ptr(this_ptr);
49414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49416         this_ptr_conv.is_owned = false;
49417         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
49418         return ret_conv;
49419 }
49420
49421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
49422         LDKUnsignedChannelUpdate this_ptr_conv;
49423         this_ptr_conv.inner = untag_ptr(this_ptr);
49424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49426         this_ptr_conv.is_owned = false;
49427         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
49428 }
49429
49430 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
49431         LDKUnsignedChannelUpdate this_ptr_conv;
49432         this_ptr_conv.inner = untag_ptr(this_ptr);
49433         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49435         this_ptr_conv.is_owned = false;
49436         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
49437         return ret_conv;
49438 }
49439
49440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
49441         LDKUnsignedChannelUpdate 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         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
49447 }
49448
49449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
49450         LDKUnsignedChannelUpdate this_ptr_conv;
49451         this_ptr_conv.inner = untag_ptr(this_ptr);
49452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49454         this_ptr_conv.is_owned = false;
49455         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
49456         return ret_conv;
49457 }
49458
49459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49460         LDKUnsignedChannelUpdate 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         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
49466 }
49467
49468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
49469         LDKUnsignedChannelUpdate this_ptr_conv;
49470         this_ptr_conv.inner = untag_ptr(this_ptr);
49471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49473         this_ptr_conv.is_owned = false;
49474         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
49475         return ret_conv;
49476 }
49477
49478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49479         LDKUnsignedChannelUpdate this_ptr_conv;
49480         this_ptr_conv.inner = untag_ptr(this_ptr);
49481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49483         this_ptr_conv.is_owned = false;
49484         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
49485 }
49486
49487 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
49488         LDKUnsignedChannelUpdate this_ptr_conv;
49489         this_ptr_conv.inner = untag_ptr(this_ptr);
49490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49492         this_ptr_conv.is_owned = false;
49493         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
49494         return ret_conv;
49495 }
49496
49497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49498         LDKUnsignedChannelUpdate this_ptr_conv;
49499         this_ptr_conv.inner = untag_ptr(this_ptr);
49500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49502         this_ptr_conv.is_owned = false;
49503         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
49504 }
49505
49506 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
49507         LDKUnsignedChannelUpdate this_ptr_conv;
49508         this_ptr_conv.inner = untag_ptr(this_ptr);
49509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49511         this_ptr_conv.is_owned = false;
49512         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
49513         return ret_conv;
49514 }
49515
49516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49517         LDKUnsignedChannelUpdate this_ptr_conv;
49518         this_ptr_conv.inner = untag_ptr(this_ptr);
49519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49521         this_ptr_conv.is_owned = false;
49522         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
49523 }
49524
49525 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
49526         LDKUnsignedChannelUpdate this_ptr_conv;
49527         this_ptr_conv.inner = untag_ptr(this_ptr);
49528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49530         this_ptr_conv.is_owned = false;
49531         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
49532         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49533         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49534         CVec_u8Z_free(ret_var);
49535         return ret_arr;
49536 }
49537
49538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49539         LDKUnsignedChannelUpdate this_ptr_conv;
49540         this_ptr_conv.inner = untag_ptr(this_ptr);
49541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49543         this_ptr_conv.is_owned = false;
49544         LDKCVec_u8Z val_ref;
49545         val_ref.datalen = (*env)->GetArrayLength(env, val);
49546         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
49547         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
49548         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
49549 }
49550
49551 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) {
49552         LDKThirtyTwoBytes chain_hash_arg_ref;
49553         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
49554         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
49555         LDKCVec_u8Z excess_data_arg_ref;
49556         excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg);
49557         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
49558         (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data);
49559         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);
49560         int64_t ret_ref = 0;
49561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49563         return ret_ref;
49564 }
49565
49566 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
49567         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
49568         int64_t ret_ref = 0;
49569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49571         return ret_ref;
49572 }
49573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49574         LDKUnsignedChannelUpdate arg_conv;
49575         arg_conv.inner = untag_ptr(arg);
49576         arg_conv.is_owned = ptr_is_owned(arg);
49577         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49578         arg_conv.is_owned = false;
49579         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
49580         return ret_conv;
49581 }
49582
49583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49584         LDKUnsignedChannelUpdate orig_conv;
49585         orig_conv.inner = untag_ptr(orig);
49586         orig_conv.is_owned = ptr_is_owned(orig);
49587         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49588         orig_conv.is_owned = false;
49589         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
49590         int64_t ret_ref = 0;
49591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49593         return ret_ref;
49594 }
49595
49596 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49597         LDKUnsignedChannelUpdate a_conv;
49598         a_conv.inner = untag_ptr(a);
49599         a_conv.is_owned = ptr_is_owned(a);
49600         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49601         a_conv.is_owned = false;
49602         LDKUnsignedChannelUpdate b_conv;
49603         b_conv.inner = untag_ptr(b);
49604         b_conv.is_owned = ptr_is_owned(b);
49605         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49606         b_conv.is_owned = false;
49607         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
49608         return ret_conv;
49609 }
49610
49611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49612         LDKChannelUpdate this_obj_conv;
49613         this_obj_conv.inner = untag_ptr(this_obj);
49614         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49616         ChannelUpdate_free(this_obj_conv);
49617 }
49618
49619 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
49620         LDKChannelUpdate this_ptr_conv;
49621         this_ptr_conv.inner = untag_ptr(this_ptr);
49622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49624         this_ptr_conv.is_owned = false;
49625         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
49626         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
49627         return ret_arr;
49628 }
49629
49630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49631         LDKChannelUpdate this_ptr_conv;
49632         this_ptr_conv.inner = untag_ptr(this_ptr);
49633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49635         this_ptr_conv.is_owned = false;
49636         LDKECDSASignature val_ref;
49637         CHECK((*env)->GetArrayLength(env, val) == 64);
49638         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
49639         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
49640 }
49641
49642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
49643         LDKChannelUpdate this_ptr_conv;
49644         this_ptr_conv.inner = untag_ptr(this_ptr);
49645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49647         this_ptr_conv.is_owned = false;
49648         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
49649         int64_t ret_ref = 0;
49650         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49651         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49652         return ret_ref;
49653 }
49654
49655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49656         LDKChannelUpdate this_ptr_conv;
49657         this_ptr_conv.inner = untag_ptr(this_ptr);
49658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49660         this_ptr_conv.is_owned = false;
49661         LDKUnsignedChannelUpdate val_conv;
49662         val_conv.inner = untag_ptr(val);
49663         val_conv.is_owned = ptr_is_owned(val);
49664         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49665         val_conv = UnsignedChannelUpdate_clone(&val_conv);
49666         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
49667 }
49668
49669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
49670         LDKECDSASignature signature_arg_ref;
49671         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
49672         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
49673         LDKUnsignedChannelUpdate contents_arg_conv;
49674         contents_arg_conv.inner = untag_ptr(contents_arg);
49675         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
49676         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
49677         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
49678         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
49679         int64_t ret_ref = 0;
49680         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49681         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49682         return ret_ref;
49683 }
49684
49685 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
49686         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
49687         int64_t ret_ref = 0;
49688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49690         return ret_ref;
49691 }
49692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49693         LDKChannelUpdate arg_conv;
49694         arg_conv.inner = untag_ptr(arg);
49695         arg_conv.is_owned = ptr_is_owned(arg);
49696         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49697         arg_conv.is_owned = false;
49698         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
49699         return ret_conv;
49700 }
49701
49702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49703         LDKChannelUpdate orig_conv;
49704         orig_conv.inner = untag_ptr(orig);
49705         orig_conv.is_owned = ptr_is_owned(orig);
49706         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49707         orig_conv.is_owned = false;
49708         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
49709         int64_t ret_ref = 0;
49710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49712         return ret_ref;
49713 }
49714
49715 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49716         LDKChannelUpdate a_conv;
49717         a_conv.inner = untag_ptr(a);
49718         a_conv.is_owned = ptr_is_owned(a);
49719         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49720         a_conv.is_owned = false;
49721         LDKChannelUpdate b_conv;
49722         b_conv.inner = untag_ptr(b);
49723         b_conv.is_owned = ptr_is_owned(b);
49724         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49725         b_conv.is_owned = false;
49726         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
49727         return ret_conv;
49728 }
49729
49730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49731         LDKQueryChannelRange this_obj_conv;
49732         this_obj_conv.inner = untag_ptr(this_obj);
49733         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49735         QueryChannelRange_free(this_obj_conv);
49736 }
49737
49738 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
49739         LDKQueryChannelRange this_ptr_conv;
49740         this_ptr_conv.inner = untag_ptr(this_ptr);
49741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49743         this_ptr_conv.is_owned = false;
49744         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49745         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
49746         return ret_arr;
49747 }
49748
49749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49750         LDKQueryChannelRange this_ptr_conv;
49751         this_ptr_conv.inner = untag_ptr(this_ptr);
49752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49754         this_ptr_conv.is_owned = false;
49755         LDKThirtyTwoBytes val_ref;
49756         CHECK((*env)->GetArrayLength(env, val) == 32);
49757         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49758         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
49759 }
49760
49761 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
49762         LDKQueryChannelRange this_ptr_conv;
49763         this_ptr_conv.inner = untag_ptr(this_ptr);
49764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49766         this_ptr_conv.is_owned = false;
49767         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
49768         return ret_conv;
49769 }
49770
49771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49772         LDKQueryChannelRange this_ptr_conv;
49773         this_ptr_conv.inner = untag_ptr(this_ptr);
49774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49776         this_ptr_conv.is_owned = false;
49777         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
49778 }
49779
49780 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
49781         LDKQueryChannelRange this_ptr_conv;
49782         this_ptr_conv.inner = untag_ptr(this_ptr);
49783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49785         this_ptr_conv.is_owned = false;
49786         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
49787         return ret_conv;
49788 }
49789
49790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49791         LDKQueryChannelRange this_ptr_conv;
49792         this_ptr_conv.inner = untag_ptr(this_ptr);
49793         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49795         this_ptr_conv.is_owned = false;
49796         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
49797 }
49798
49799 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) {
49800         LDKThirtyTwoBytes chain_hash_arg_ref;
49801         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
49802         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
49803         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
49804         int64_t ret_ref = 0;
49805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49807         return ret_ref;
49808 }
49809
49810 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
49811         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
49812         int64_t ret_ref = 0;
49813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49815         return ret_ref;
49816 }
49817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49818         LDKQueryChannelRange arg_conv;
49819         arg_conv.inner = untag_ptr(arg);
49820         arg_conv.is_owned = ptr_is_owned(arg);
49821         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49822         arg_conv.is_owned = false;
49823         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
49824         return ret_conv;
49825 }
49826
49827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49828         LDKQueryChannelRange orig_conv;
49829         orig_conv.inner = untag_ptr(orig);
49830         orig_conv.is_owned = ptr_is_owned(orig);
49831         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49832         orig_conv.is_owned = false;
49833         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
49834         int64_t ret_ref = 0;
49835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49837         return ret_ref;
49838 }
49839
49840 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49841         LDKQueryChannelRange a_conv;
49842         a_conv.inner = untag_ptr(a);
49843         a_conv.is_owned = ptr_is_owned(a);
49844         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49845         a_conv.is_owned = false;
49846         LDKQueryChannelRange b_conv;
49847         b_conv.inner = untag_ptr(b);
49848         b_conv.is_owned = ptr_is_owned(b);
49849         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49850         b_conv.is_owned = false;
49851         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
49852         return ret_conv;
49853 }
49854
49855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49856         LDKReplyChannelRange this_obj_conv;
49857         this_obj_conv.inner = untag_ptr(this_obj);
49858         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49860         ReplyChannelRange_free(this_obj_conv);
49861 }
49862
49863 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
49864         LDKReplyChannelRange this_ptr_conv;
49865         this_ptr_conv.inner = untag_ptr(this_ptr);
49866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49868         this_ptr_conv.is_owned = false;
49869         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49870         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
49871         return ret_arr;
49872 }
49873
49874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49875         LDKReplyChannelRange this_ptr_conv;
49876         this_ptr_conv.inner = untag_ptr(this_ptr);
49877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49879         this_ptr_conv.is_owned = false;
49880         LDKThirtyTwoBytes val_ref;
49881         CHECK((*env)->GetArrayLength(env, val) == 32);
49882         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49883         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
49884 }
49885
49886 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
49887         LDKReplyChannelRange this_ptr_conv;
49888         this_ptr_conv.inner = untag_ptr(this_ptr);
49889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49891         this_ptr_conv.is_owned = false;
49892         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
49893         return ret_conv;
49894 }
49895
49896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49897         LDKReplyChannelRange this_ptr_conv;
49898         this_ptr_conv.inner = untag_ptr(this_ptr);
49899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49901         this_ptr_conv.is_owned = false;
49902         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
49903 }
49904
49905 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
49906         LDKReplyChannelRange this_ptr_conv;
49907         this_ptr_conv.inner = untag_ptr(this_ptr);
49908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49910         this_ptr_conv.is_owned = false;
49911         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
49912         return ret_conv;
49913 }
49914
49915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49916         LDKReplyChannelRange this_ptr_conv;
49917         this_ptr_conv.inner = untag_ptr(this_ptr);
49918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49920         this_ptr_conv.is_owned = false;
49921         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
49922 }
49923
49924 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
49925         LDKReplyChannelRange this_ptr_conv;
49926         this_ptr_conv.inner = untag_ptr(this_ptr);
49927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49929         this_ptr_conv.is_owned = false;
49930         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
49931         return ret_conv;
49932 }
49933
49934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
49935         LDKReplyChannelRange this_ptr_conv;
49936         this_ptr_conv.inner = untag_ptr(this_ptr);
49937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49939         this_ptr_conv.is_owned = false;
49940         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
49941 }
49942
49943 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
49944         LDKReplyChannelRange this_ptr_conv;
49945         this_ptr_conv.inner = untag_ptr(this_ptr);
49946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49948         this_ptr_conv.is_owned = false;
49949         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
49950         int64_tArray ret_arr = NULL;
49951         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
49952         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
49953         for (size_t g = 0; g < ret_var.datalen; g++) {
49954                 int64_t ret_conv_6_conv = ret_var.data[g];
49955                 ret_arr_ptr[g] = ret_conv_6_conv;
49956         }
49957         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
49958         FREE(ret_var.data);
49959         return ret_arr;
49960 }
49961
49962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
49963         LDKReplyChannelRange this_ptr_conv;
49964         this_ptr_conv.inner = untag_ptr(this_ptr);
49965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49967         this_ptr_conv.is_owned = false;
49968         LDKCVec_u64Z val_constr;
49969         val_constr.datalen = (*env)->GetArrayLength(env, val);
49970         if (val_constr.datalen > 0)
49971                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
49972         else
49973                 val_constr.data = NULL;
49974         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
49975         for (size_t g = 0; g < val_constr.datalen; g++) {
49976                 int64_t val_conv_6 = val_vals[g];
49977                 val_constr.data[g] = val_conv_6;
49978         }
49979         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
49980         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
49981 }
49982
49983 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) {
49984         LDKThirtyTwoBytes chain_hash_arg_ref;
49985         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
49986         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
49987         LDKCVec_u64Z short_channel_ids_arg_constr;
49988         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
49989         if (short_channel_ids_arg_constr.datalen > 0)
49990                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
49991         else
49992                 short_channel_ids_arg_constr.data = NULL;
49993         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
49994         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
49995                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
49996                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
49997         }
49998         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
49999         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
50000         int64_t ret_ref = 0;
50001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50003         return ret_ref;
50004 }
50005
50006 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
50007         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
50008         int64_t ret_ref = 0;
50009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50011         return ret_ref;
50012 }
50013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50014         LDKReplyChannelRange arg_conv;
50015         arg_conv.inner = untag_ptr(arg);
50016         arg_conv.is_owned = ptr_is_owned(arg);
50017         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50018         arg_conv.is_owned = false;
50019         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
50020         return ret_conv;
50021 }
50022
50023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50024         LDKReplyChannelRange orig_conv;
50025         orig_conv.inner = untag_ptr(orig);
50026         orig_conv.is_owned = ptr_is_owned(orig);
50027         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50028         orig_conv.is_owned = false;
50029         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
50030         int64_t ret_ref = 0;
50031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50033         return ret_ref;
50034 }
50035
50036 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50037         LDKReplyChannelRange a_conv;
50038         a_conv.inner = untag_ptr(a);
50039         a_conv.is_owned = ptr_is_owned(a);
50040         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50041         a_conv.is_owned = false;
50042         LDKReplyChannelRange b_conv;
50043         b_conv.inner = untag_ptr(b);
50044         b_conv.is_owned = ptr_is_owned(b);
50045         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50046         b_conv.is_owned = false;
50047         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
50048         return ret_conv;
50049 }
50050
50051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50052         LDKQueryShortChannelIds this_obj_conv;
50053         this_obj_conv.inner = untag_ptr(this_obj);
50054         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50056         QueryShortChannelIds_free(this_obj_conv);
50057 }
50058
50059 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
50060         LDKQueryShortChannelIds this_ptr_conv;
50061         this_ptr_conv.inner = untag_ptr(this_ptr);
50062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50064         this_ptr_conv.is_owned = false;
50065         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
50066         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
50067         return ret_arr;
50068 }
50069
50070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50071         LDKQueryShortChannelIds this_ptr_conv;
50072         this_ptr_conv.inner = untag_ptr(this_ptr);
50073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50075         this_ptr_conv.is_owned = false;
50076         LDKThirtyTwoBytes val_ref;
50077         CHECK((*env)->GetArrayLength(env, val) == 32);
50078         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
50079         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
50080 }
50081
50082 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
50083         LDKQueryShortChannelIds this_ptr_conv;
50084         this_ptr_conv.inner = untag_ptr(this_ptr);
50085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50087         this_ptr_conv.is_owned = false;
50088         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
50089         int64_tArray ret_arr = NULL;
50090         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
50091         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
50092         for (size_t g = 0; g < ret_var.datalen; g++) {
50093                 int64_t ret_conv_6_conv = ret_var.data[g];
50094                 ret_arr_ptr[g] = ret_conv_6_conv;
50095         }
50096         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
50097         FREE(ret_var.data);
50098         return ret_arr;
50099 }
50100
50101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
50102         LDKQueryShortChannelIds this_ptr_conv;
50103         this_ptr_conv.inner = untag_ptr(this_ptr);
50104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50106         this_ptr_conv.is_owned = false;
50107         LDKCVec_u64Z val_constr;
50108         val_constr.datalen = (*env)->GetArrayLength(env, val);
50109         if (val_constr.datalen > 0)
50110                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
50111         else
50112                 val_constr.data = NULL;
50113         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
50114         for (size_t g = 0; g < val_constr.datalen; g++) {
50115                 int64_t val_conv_6 = val_vals[g];
50116                 val_constr.data[g] = val_conv_6;
50117         }
50118         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
50119         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
50120 }
50121
50122 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) {
50123         LDKThirtyTwoBytes chain_hash_arg_ref;
50124         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
50125         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
50126         LDKCVec_u64Z short_channel_ids_arg_constr;
50127         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
50128         if (short_channel_ids_arg_constr.datalen > 0)
50129                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
50130         else
50131                 short_channel_ids_arg_constr.data = NULL;
50132         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
50133         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
50134                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
50135                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
50136         }
50137         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
50138         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
50139         int64_t ret_ref = 0;
50140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50142         return ret_ref;
50143 }
50144
50145 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
50146         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
50147         int64_t ret_ref = 0;
50148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50150         return ret_ref;
50151 }
50152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50153         LDKQueryShortChannelIds arg_conv;
50154         arg_conv.inner = untag_ptr(arg);
50155         arg_conv.is_owned = ptr_is_owned(arg);
50156         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50157         arg_conv.is_owned = false;
50158         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
50159         return ret_conv;
50160 }
50161
50162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50163         LDKQueryShortChannelIds orig_conv;
50164         orig_conv.inner = untag_ptr(orig);
50165         orig_conv.is_owned = ptr_is_owned(orig);
50166         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50167         orig_conv.is_owned = false;
50168         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
50169         int64_t ret_ref = 0;
50170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50172         return ret_ref;
50173 }
50174
50175 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50176         LDKQueryShortChannelIds a_conv;
50177         a_conv.inner = untag_ptr(a);
50178         a_conv.is_owned = ptr_is_owned(a);
50179         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50180         a_conv.is_owned = false;
50181         LDKQueryShortChannelIds b_conv;
50182         b_conv.inner = untag_ptr(b);
50183         b_conv.is_owned = ptr_is_owned(b);
50184         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50185         b_conv.is_owned = false;
50186         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
50187         return ret_conv;
50188 }
50189
50190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50191         LDKReplyShortChannelIdsEnd this_obj_conv;
50192         this_obj_conv.inner = untag_ptr(this_obj);
50193         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50195         ReplyShortChannelIdsEnd_free(this_obj_conv);
50196 }
50197
50198 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
50199         LDKReplyShortChannelIdsEnd this_ptr_conv;
50200         this_ptr_conv.inner = untag_ptr(this_ptr);
50201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50203         this_ptr_conv.is_owned = false;
50204         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
50205         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
50206         return ret_arr;
50207 }
50208
50209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50210         LDKReplyShortChannelIdsEnd this_ptr_conv;
50211         this_ptr_conv.inner = untag_ptr(this_ptr);
50212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50214         this_ptr_conv.is_owned = false;
50215         LDKThirtyTwoBytes val_ref;
50216         CHECK((*env)->GetArrayLength(env, val) == 32);
50217         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
50218         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
50219 }
50220
50221 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
50222         LDKReplyShortChannelIdsEnd this_ptr_conv;
50223         this_ptr_conv.inner = untag_ptr(this_ptr);
50224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50226         this_ptr_conv.is_owned = false;
50227         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
50228         return ret_conv;
50229 }
50230
50231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
50232         LDKReplyShortChannelIdsEnd this_ptr_conv;
50233         this_ptr_conv.inner = untag_ptr(this_ptr);
50234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50236         this_ptr_conv.is_owned = false;
50237         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
50238 }
50239
50240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
50241         LDKThirtyTwoBytes chain_hash_arg_ref;
50242         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
50243         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
50244         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
50245         int64_t ret_ref = 0;
50246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50248         return ret_ref;
50249 }
50250
50251 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
50252         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
50253         int64_t ret_ref = 0;
50254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50256         return ret_ref;
50257 }
50258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50259         LDKReplyShortChannelIdsEnd arg_conv;
50260         arg_conv.inner = untag_ptr(arg);
50261         arg_conv.is_owned = ptr_is_owned(arg);
50262         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50263         arg_conv.is_owned = false;
50264         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
50265         return ret_conv;
50266 }
50267
50268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50269         LDKReplyShortChannelIdsEnd orig_conv;
50270         orig_conv.inner = untag_ptr(orig);
50271         orig_conv.is_owned = ptr_is_owned(orig);
50272         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50273         orig_conv.is_owned = false;
50274         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
50275         int64_t ret_ref = 0;
50276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50278         return ret_ref;
50279 }
50280
50281 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50282         LDKReplyShortChannelIdsEnd a_conv;
50283         a_conv.inner = untag_ptr(a);
50284         a_conv.is_owned = ptr_is_owned(a);
50285         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50286         a_conv.is_owned = false;
50287         LDKReplyShortChannelIdsEnd b_conv;
50288         b_conv.inner = untag_ptr(b);
50289         b_conv.is_owned = ptr_is_owned(b);
50290         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50291         b_conv.is_owned = false;
50292         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
50293         return ret_conv;
50294 }
50295
50296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50297         LDKGossipTimestampFilter this_obj_conv;
50298         this_obj_conv.inner = untag_ptr(this_obj);
50299         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50301         GossipTimestampFilter_free(this_obj_conv);
50302 }
50303
50304 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
50305         LDKGossipTimestampFilter this_ptr_conv;
50306         this_ptr_conv.inner = untag_ptr(this_ptr);
50307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50309         this_ptr_conv.is_owned = false;
50310         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
50311         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
50312         return ret_arr;
50313 }
50314
50315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50316         LDKGossipTimestampFilter this_ptr_conv;
50317         this_ptr_conv.inner = untag_ptr(this_ptr);
50318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50320         this_ptr_conv.is_owned = false;
50321         LDKThirtyTwoBytes val_ref;
50322         CHECK((*env)->GetArrayLength(env, val) == 32);
50323         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
50324         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
50325 }
50326
50327 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
50328         LDKGossipTimestampFilter this_ptr_conv;
50329         this_ptr_conv.inner = untag_ptr(this_ptr);
50330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50332         this_ptr_conv.is_owned = false;
50333         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
50334         return ret_conv;
50335 }
50336
50337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
50338         LDKGossipTimestampFilter this_ptr_conv;
50339         this_ptr_conv.inner = untag_ptr(this_ptr);
50340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50342         this_ptr_conv.is_owned = false;
50343         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
50344 }
50345
50346 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
50347         LDKGossipTimestampFilter this_ptr_conv;
50348         this_ptr_conv.inner = untag_ptr(this_ptr);
50349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50351         this_ptr_conv.is_owned = false;
50352         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
50353         return ret_conv;
50354 }
50355
50356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
50357         LDKGossipTimestampFilter this_ptr_conv;
50358         this_ptr_conv.inner = untag_ptr(this_ptr);
50359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50361         this_ptr_conv.is_owned = false;
50362         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
50363 }
50364
50365 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) {
50366         LDKThirtyTwoBytes chain_hash_arg_ref;
50367         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
50368         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
50369         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
50370         int64_t ret_ref = 0;
50371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50373         return ret_ref;
50374 }
50375
50376 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
50377         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
50378         int64_t ret_ref = 0;
50379         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50380         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50381         return ret_ref;
50382 }
50383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50384         LDKGossipTimestampFilter arg_conv;
50385         arg_conv.inner = untag_ptr(arg);
50386         arg_conv.is_owned = ptr_is_owned(arg);
50387         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50388         arg_conv.is_owned = false;
50389         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
50390         return ret_conv;
50391 }
50392
50393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50394         LDKGossipTimestampFilter orig_conv;
50395         orig_conv.inner = untag_ptr(orig);
50396         orig_conv.is_owned = ptr_is_owned(orig);
50397         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50398         orig_conv.is_owned = false;
50399         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
50400         int64_t ret_ref = 0;
50401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50403         return ret_ref;
50404 }
50405
50406 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50407         LDKGossipTimestampFilter a_conv;
50408         a_conv.inner = untag_ptr(a);
50409         a_conv.is_owned = ptr_is_owned(a);
50410         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50411         a_conv.is_owned = false;
50412         LDKGossipTimestampFilter b_conv;
50413         b_conv.inner = untag_ptr(b);
50414         b_conv.is_owned = ptr_is_owned(b);
50415         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50416         b_conv.is_owned = false;
50417         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
50418         return ret_conv;
50419 }
50420
50421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
50422         if (!ptr_is_owned(this_ptr)) return;
50423         void* this_ptr_ptr = untag_ptr(this_ptr);
50424         CHECK_ACCESS(this_ptr_ptr);
50425         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
50426         FREE(untag_ptr(this_ptr));
50427         ErrorAction_free(this_ptr_conv);
50428 }
50429
50430 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
50431         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50432         *ret_copy = ErrorAction_clone(arg);
50433         int64_t ret_ref = tag_ptr(ret_copy, true);
50434         return ret_ref;
50435 }
50436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50437         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
50438         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
50439         return ret_conv;
50440 }
50441
50442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50443         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
50444         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50445         *ret_copy = ErrorAction_clone(orig_conv);
50446         int64_t ret_ref = tag_ptr(ret_copy, true);
50447         return ret_ref;
50448 }
50449
50450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
50451         LDKErrorMessage msg_conv;
50452         msg_conv.inner = untag_ptr(msg);
50453         msg_conv.is_owned = ptr_is_owned(msg);
50454         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50455         msg_conv = ErrorMessage_clone(&msg_conv);
50456         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50457         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
50458         int64_t ret_ref = tag_ptr(ret_copy, true);
50459         return ret_ref;
50460 }
50461
50462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer_1with_1warning(JNIEnv *env, jclass clz, int64_t msg) {
50463         LDKWarningMessage msg_conv;
50464         msg_conv.inner = untag_ptr(msg);
50465         msg_conv.is_owned = ptr_is_owned(msg);
50466         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50467         msg_conv = WarningMessage_clone(&msg_conv);
50468         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50469         *ret_copy = ErrorAction_disconnect_peer_with_warning(msg_conv);
50470         int64_t ret_ref = tag_ptr(ret_copy, true);
50471         return ret_ref;
50472 }
50473
50474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
50475         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50476         *ret_copy = ErrorAction_ignore_error();
50477         int64_t ret_ref = tag_ptr(ret_copy, true);
50478         return ret_ref;
50479 }
50480
50481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
50482         LDKLevel a_conv = LDKLevel_from_java(env, a);
50483         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50484         *ret_copy = ErrorAction_ignore_and_log(a_conv);
50485         int64_t ret_ref = tag_ptr(ret_copy, true);
50486         return ret_ref;
50487 }
50488
50489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1duplicate_1gossip(JNIEnv *env, jclass clz) {
50490         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50491         *ret_copy = ErrorAction_ignore_duplicate_gossip();
50492         int64_t ret_ref = tag_ptr(ret_copy, true);
50493         return ret_ref;
50494 }
50495
50496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
50497         LDKErrorMessage msg_conv;
50498         msg_conv.inner = untag_ptr(msg);
50499         msg_conv.is_owned = ptr_is_owned(msg);
50500         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50501         msg_conv = ErrorMessage_clone(&msg_conv);
50502         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50503         *ret_copy = ErrorAction_send_error_message(msg_conv);
50504         int64_t ret_ref = tag_ptr(ret_copy, true);
50505         return ret_ref;
50506 }
50507
50508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1warning_1message(JNIEnv *env, jclass clz, int64_t msg, jclass log_level) {
50509         LDKWarningMessage msg_conv;
50510         msg_conv.inner = untag_ptr(msg);
50511         msg_conv.is_owned = ptr_is_owned(msg);
50512         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50513         msg_conv = WarningMessage_clone(&msg_conv);
50514         LDKLevel log_level_conv = LDKLevel_from_java(env, log_level);
50515         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50516         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
50517         int64_t ret_ref = tag_ptr(ret_copy, true);
50518         return ret_ref;
50519 }
50520
50521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50522         LDKLightningError this_obj_conv;
50523         this_obj_conv.inner = untag_ptr(this_obj);
50524         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50526         LightningError_free(this_obj_conv);
50527 }
50528
50529 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
50530         LDKLightningError this_ptr_conv;
50531         this_ptr_conv.inner = untag_ptr(this_ptr);
50532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50534         this_ptr_conv.is_owned = false;
50535         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
50536         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
50537         Str_free(ret_str);
50538         return ret_conv;
50539 }
50540
50541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
50542         LDKLightningError this_ptr_conv;
50543         this_ptr_conv.inner = untag_ptr(this_ptr);
50544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50546         this_ptr_conv.is_owned = false;
50547         LDKStr val_conv = java_to_owned_str(env, val);
50548         LightningError_set_err(&this_ptr_conv, val_conv);
50549 }
50550
50551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
50552         LDKLightningError this_ptr_conv;
50553         this_ptr_conv.inner = untag_ptr(this_ptr);
50554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50556         this_ptr_conv.is_owned = false;
50557         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50558         *ret_copy = LightningError_get_action(&this_ptr_conv);
50559         int64_t ret_ref = tag_ptr(ret_copy, true);
50560         return ret_ref;
50561 }
50562
50563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50564         LDKLightningError this_ptr_conv;
50565         this_ptr_conv.inner = untag_ptr(this_ptr);
50566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50568         this_ptr_conv.is_owned = false;
50569         void* val_ptr = untag_ptr(val);
50570         CHECK_ACCESS(val_ptr);
50571         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
50572         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
50573         LightningError_set_action(&this_ptr_conv, val_conv);
50574 }
50575
50576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
50577         LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
50578         void* action_arg_ptr = untag_ptr(action_arg);
50579         CHECK_ACCESS(action_arg_ptr);
50580         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
50581         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
50582         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
50583         int64_t ret_ref = 0;
50584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50586         return ret_ref;
50587 }
50588
50589 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
50590         LDKLightningError ret_var = LightningError_clone(arg);
50591         int64_t ret_ref = 0;
50592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50594         return ret_ref;
50595 }
50596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50597         LDKLightningError arg_conv;
50598         arg_conv.inner = untag_ptr(arg);
50599         arg_conv.is_owned = ptr_is_owned(arg);
50600         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50601         arg_conv.is_owned = false;
50602         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
50603         return ret_conv;
50604 }
50605
50606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50607         LDKLightningError orig_conv;
50608         orig_conv.inner = untag_ptr(orig);
50609         orig_conv.is_owned = ptr_is_owned(orig);
50610         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50611         orig_conv.is_owned = false;
50612         LDKLightningError ret_var = LightningError_clone(&orig_conv);
50613         int64_t ret_ref = 0;
50614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50616         return ret_ref;
50617 }
50618
50619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50620         LDKCommitmentUpdate this_obj_conv;
50621         this_obj_conv.inner = untag_ptr(this_obj);
50622         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50624         CommitmentUpdate_free(this_obj_conv);
50625 }
50626
50627 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
50628         LDKCommitmentUpdate this_ptr_conv;
50629         this_ptr_conv.inner = untag_ptr(this_ptr);
50630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50632         this_ptr_conv.is_owned = false;
50633         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
50634         int64_tArray ret_arr = NULL;
50635         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
50636         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
50637         for (size_t p = 0; p < ret_var.datalen; p++) {
50638                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
50639                 int64_t ret_conv_15_ref = 0;
50640                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
50641                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
50642                 ret_arr_ptr[p] = ret_conv_15_ref;
50643         }
50644         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
50645         FREE(ret_var.data);
50646         return ret_arr;
50647 }
50648
50649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
50650         LDKCommitmentUpdate this_ptr_conv;
50651         this_ptr_conv.inner = untag_ptr(this_ptr);
50652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50654         this_ptr_conv.is_owned = false;
50655         LDKCVec_UpdateAddHTLCZ val_constr;
50656         val_constr.datalen = (*env)->GetArrayLength(env, val);
50657         if (val_constr.datalen > 0)
50658                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
50659         else
50660                 val_constr.data = NULL;
50661         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
50662         for (size_t p = 0; p < val_constr.datalen; p++) {
50663                 int64_t val_conv_15 = val_vals[p];
50664                 LDKUpdateAddHTLC val_conv_15_conv;
50665                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
50666                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
50667                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
50668                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
50669                 val_constr.data[p] = val_conv_15_conv;
50670         }
50671         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
50672         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
50673 }
50674
50675 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
50676         LDKCommitmentUpdate this_ptr_conv;
50677         this_ptr_conv.inner = untag_ptr(this_ptr);
50678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50680         this_ptr_conv.is_owned = false;
50681         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
50682         int64_tArray ret_arr = NULL;
50683         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
50684         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
50685         for (size_t t = 0; t < ret_var.datalen; t++) {
50686                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
50687                 int64_t ret_conv_19_ref = 0;
50688                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
50689                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
50690                 ret_arr_ptr[t] = ret_conv_19_ref;
50691         }
50692         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
50693         FREE(ret_var.data);
50694         return ret_arr;
50695 }
50696
50697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
50698         LDKCommitmentUpdate this_ptr_conv;
50699         this_ptr_conv.inner = untag_ptr(this_ptr);
50700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50702         this_ptr_conv.is_owned = false;
50703         LDKCVec_UpdateFulfillHTLCZ val_constr;
50704         val_constr.datalen = (*env)->GetArrayLength(env, val);
50705         if (val_constr.datalen > 0)
50706                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
50707         else
50708                 val_constr.data = NULL;
50709         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
50710         for (size_t t = 0; t < val_constr.datalen; t++) {
50711                 int64_t val_conv_19 = val_vals[t];
50712                 LDKUpdateFulfillHTLC val_conv_19_conv;
50713                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
50714                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
50715                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
50716                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
50717                 val_constr.data[t] = val_conv_19_conv;
50718         }
50719         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
50720         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
50721 }
50722
50723 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
50724         LDKCommitmentUpdate this_ptr_conv;
50725         this_ptr_conv.inner = untag_ptr(this_ptr);
50726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50728         this_ptr_conv.is_owned = false;
50729         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
50730         int64_tArray ret_arr = NULL;
50731         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
50732         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
50733         for (size_t q = 0; q < ret_var.datalen; q++) {
50734                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
50735                 int64_t ret_conv_16_ref = 0;
50736                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
50737                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
50738                 ret_arr_ptr[q] = ret_conv_16_ref;
50739         }
50740         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
50741         FREE(ret_var.data);
50742         return ret_arr;
50743 }
50744
50745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
50746         LDKCommitmentUpdate this_ptr_conv;
50747         this_ptr_conv.inner = untag_ptr(this_ptr);
50748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50750         this_ptr_conv.is_owned = false;
50751         LDKCVec_UpdateFailHTLCZ val_constr;
50752         val_constr.datalen = (*env)->GetArrayLength(env, val);
50753         if (val_constr.datalen > 0)
50754                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
50755         else
50756                 val_constr.data = NULL;
50757         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
50758         for (size_t q = 0; q < val_constr.datalen; q++) {
50759                 int64_t val_conv_16 = val_vals[q];
50760                 LDKUpdateFailHTLC val_conv_16_conv;
50761                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
50762                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
50763                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
50764                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
50765                 val_constr.data[q] = val_conv_16_conv;
50766         }
50767         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
50768         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
50769 }
50770
50771 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
50772         LDKCommitmentUpdate this_ptr_conv;
50773         this_ptr_conv.inner = untag_ptr(this_ptr);
50774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50776         this_ptr_conv.is_owned = false;
50777         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
50778         int64_tArray ret_arr = NULL;
50779         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
50780         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
50781         for (size_t z = 0; z < ret_var.datalen; z++) {
50782                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
50783                 int64_t ret_conv_25_ref = 0;
50784                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
50785                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
50786                 ret_arr_ptr[z] = ret_conv_25_ref;
50787         }
50788         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
50789         FREE(ret_var.data);
50790         return ret_arr;
50791 }
50792
50793 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) {
50794         LDKCommitmentUpdate this_ptr_conv;
50795         this_ptr_conv.inner = untag_ptr(this_ptr);
50796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50798         this_ptr_conv.is_owned = false;
50799         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
50800         val_constr.datalen = (*env)->GetArrayLength(env, val);
50801         if (val_constr.datalen > 0)
50802                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
50803         else
50804                 val_constr.data = NULL;
50805         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
50806         for (size_t z = 0; z < val_constr.datalen; z++) {
50807                 int64_t val_conv_25 = val_vals[z];
50808                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
50809                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
50810                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
50811                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
50812                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
50813                 val_constr.data[z] = val_conv_25_conv;
50814         }
50815         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
50816         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
50817 }
50818
50819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
50820         LDKCommitmentUpdate this_ptr_conv;
50821         this_ptr_conv.inner = untag_ptr(this_ptr);
50822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50824         this_ptr_conv.is_owned = false;
50825         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
50826         int64_t ret_ref = 0;
50827         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50828         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50829         return ret_ref;
50830 }
50831
50832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50833         LDKCommitmentUpdate this_ptr_conv;
50834         this_ptr_conv.inner = untag_ptr(this_ptr);
50835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50837         this_ptr_conv.is_owned = false;
50838         LDKUpdateFee val_conv;
50839         val_conv.inner = untag_ptr(val);
50840         val_conv.is_owned = ptr_is_owned(val);
50841         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50842         val_conv = UpdateFee_clone(&val_conv);
50843         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
50844 }
50845
50846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
50847         LDKCommitmentUpdate this_ptr_conv;
50848         this_ptr_conv.inner = untag_ptr(this_ptr);
50849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50851         this_ptr_conv.is_owned = false;
50852         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
50853         int64_t ret_ref = 0;
50854         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50855         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50856         return ret_ref;
50857 }
50858
50859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50860         LDKCommitmentUpdate this_ptr_conv;
50861         this_ptr_conv.inner = untag_ptr(this_ptr);
50862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50864         this_ptr_conv.is_owned = false;
50865         LDKCommitmentSigned val_conv;
50866         val_conv.inner = untag_ptr(val);
50867         val_conv.is_owned = ptr_is_owned(val);
50868         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50869         val_conv = CommitmentSigned_clone(&val_conv);
50870         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
50871 }
50872
50873 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) {
50874         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
50875         update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
50876         if (update_add_htlcs_arg_constr.datalen > 0)
50877                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
50878         else
50879                 update_add_htlcs_arg_constr.data = NULL;
50880         int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
50881         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
50882                 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
50883                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
50884                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
50885                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
50886                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
50887                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
50888                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
50889         }
50890         (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
50891         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
50892         update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
50893         if (update_fulfill_htlcs_arg_constr.datalen > 0)
50894                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
50895         else
50896                 update_fulfill_htlcs_arg_constr.data = NULL;
50897         int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
50898         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
50899                 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
50900                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
50901                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
50902                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
50903                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
50904                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
50905                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
50906         }
50907         (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
50908         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
50909         update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
50910         if (update_fail_htlcs_arg_constr.datalen > 0)
50911                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
50912         else
50913                 update_fail_htlcs_arg_constr.data = NULL;
50914         int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
50915         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
50916                 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
50917                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
50918                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
50919                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
50920                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
50921                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
50922                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
50923         }
50924         (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
50925         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
50926         update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
50927         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
50928                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
50929         else
50930                 update_fail_malformed_htlcs_arg_constr.data = NULL;
50931         int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
50932         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
50933                 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
50934                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
50935                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
50936                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
50937                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
50938                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
50939                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
50940         }
50941         (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
50942         LDKUpdateFee update_fee_arg_conv;
50943         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
50944         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
50945         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
50946         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
50947         LDKCommitmentSigned commitment_signed_arg_conv;
50948         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
50949         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
50950         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
50951         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
50952         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);
50953         int64_t ret_ref = 0;
50954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50956         return ret_ref;
50957 }
50958
50959 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
50960         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
50961         int64_t ret_ref = 0;
50962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50964         return ret_ref;
50965 }
50966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50967         LDKCommitmentUpdate arg_conv;
50968         arg_conv.inner = untag_ptr(arg);
50969         arg_conv.is_owned = ptr_is_owned(arg);
50970         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50971         arg_conv.is_owned = false;
50972         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
50973         return ret_conv;
50974 }
50975
50976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50977         LDKCommitmentUpdate orig_conv;
50978         orig_conv.inner = untag_ptr(orig);
50979         orig_conv.is_owned = ptr_is_owned(orig);
50980         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50981         orig_conv.is_owned = false;
50982         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
50983         int64_t ret_ref = 0;
50984         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50985         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50986         return ret_ref;
50987 }
50988
50989 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50990         LDKCommitmentUpdate a_conv;
50991         a_conv.inner = untag_ptr(a);
50992         a_conv.is_owned = ptr_is_owned(a);
50993         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50994         a_conv.is_owned = false;
50995         LDKCommitmentUpdate b_conv;
50996         b_conv.inner = untag_ptr(b);
50997         b_conv.is_owned = ptr_is_owned(b);
50998         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50999         b_conv.is_owned = false;
51000         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
51001         return ret_conv;
51002 }
51003
51004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
51005         if (!ptr_is_owned(this_ptr)) return;
51006         void* this_ptr_ptr = untag_ptr(this_ptr);
51007         CHECK_ACCESS(this_ptr_ptr);
51008         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
51009         FREE(untag_ptr(this_ptr));
51010         ChannelMessageHandler_free(this_ptr_conv);
51011 }
51012
51013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
51014         if (!ptr_is_owned(this_ptr)) return;
51015         void* this_ptr_ptr = untag_ptr(this_ptr);
51016         CHECK_ACCESS(this_ptr_ptr);
51017         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
51018         FREE(untag_ptr(this_ptr));
51019         RoutingMessageHandler_free(this_ptr_conv);
51020 }
51021
51022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
51023         if (!ptr_is_owned(this_ptr)) return;
51024         void* this_ptr_ptr = untag_ptr(this_ptr);
51025         CHECK_ACCESS(this_ptr_ptr);
51026         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
51027         FREE(untag_ptr(this_ptr));
51028         OnionMessageHandler_free(this_ptr_conv);
51029 }
51030
51031 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
51032         LDKAcceptChannel obj_conv;
51033         obj_conv.inner = untag_ptr(obj);
51034         obj_conv.is_owned = ptr_is_owned(obj);
51035         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51036         obj_conv.is_owned = false;
51037         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
51038         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51039         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51040         CVec_u8Z_free(ret_var);
51041         return ret_arr;
51042 }
51043
51044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51045         LDKu8slice ser_ref;
51046         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51047         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51048         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
51049         *ret_conv = AcceptChannel_read(ser_ref);
51050         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51051         return tag_ptr(ret_conv, true);
51052 }
51053
51054 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1write(JNIEnv *env, jclass clz, int64_t obj) {
51055         LDKAcceptChannelV2 obj_conv;
51056         obj_conv.inner = untag_ptr(obj);
51057         obj_conv.is_owned = ptr_is_owned(obj);
51058         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51059         obj_conv.is_owned = false;
51060         LDKCVec_u8Z ret_var = AcceptChannelV2_write(&obj_conv);
51061         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51062         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51063         CVec_u8Z_free(ret_var);
51064         return ret_arr;
51065 }
51066
51067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51068         LDKu8slice ser_ref;
51069         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51070         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51071         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
51072         *ret_conv = AcceptChannelV2_read(ser_ref);
51073         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51074         return tag_ptr(ret_conv, true);
51075 }
51076
51077 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddInput_1write(JNIEnv *env, jclass clz, int64_t obj) {
51078         LDKTxAddInput obj_conv;
51079         obj_conv.inner = untag_ptr(obj);
51080         obj_conv.is_owned = ptr_is_owned(obj);
51081         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51082         obj_conv.is_owned = false;
51083         LDKCVec_u8Z ret_var = TxAddInput_write(&obj_conv);
51084         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51085         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51086         CVec_u8Z_free(ret_var);
51087         return ret_arr;
51088 }
51089
51090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51091         LDKu8slice ser_ref;
51092         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51093         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51094         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
51095         *ret_conv = TxAddInput_read(ser_ref);
51096         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51097         return tag_ptr(ret_conv, true);
51098 }
51099
51100 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1write(JNIEnv *env, jclass clz, int64_t obj) {
51101         LDKTxAddOutput obj_conv;
51102         obj_conv.inner = untag_ptr(obj);
51103         obj_conv.is_owned = ptr_is_owned(obj);
51104         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51105         obj_conv.is_owned = false;
51106         LDKCVec_u8Z ret_var = TxAddOutput_write(&obj_conv);
51107         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51108         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51109         CVec_u8Z_free(ret_var);
51110         return ret_arr;
51111 }
51112
51113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51114         LDKu8slice ser_ref;
51115         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51116         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51117         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
51118         *ret_conv = TxAddOutput_read(ser_ref);
51119         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51120         return tag_ptr(ret_conv, true);
51121 }
51122
51123 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1write(JNIEnv *env, jclass clz, int64_t obj) {
51124         LDKTxRemoveInput obj_conv;
51125         obj_conv.inner = untag_ptr(obj);
51126         obj_conv.is_owned = ptr_is_owned(obj);
51127         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51128         obj_conv.is_owned = false;
51129         LDKCVec_u8Z ret_var = TxRemoveInput_write(&obj_conv);
51130         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51131         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51132         CVec_u8Z_free(ret_var);
51133         return ret_arr;
51134 }
51135
51136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51137         LDKu8slice ser_ref;
51138         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51139         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51140         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
51141         *ret_conv = TxRemoveInput_read(ser_ref);
51142         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51143         return tag_ptr(ret_conv, true);
51144 }
51145
51146 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1write(JNIEnv *env, jclass clz, int64_t obj) {
51147         LDKTxRemoveOutput obj_conv;
51148         obj_conv.inner = untag_ptr(obj);
51149         obj_conv.is_owned = ptr_is_owned(obj);
51150         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51151         obj_conv.is_owned = false;
51152         LDKCVec_u8Z ret_var = TxRemoveOutput_write(&obj_conv);
51153         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51154         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51155         CVec_u8Z_free(ret_var);
51156         return ret_arr;
51157 }
51158
51159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51160         LDKu8slice ser_ref;
51161         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51162         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51163         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
51164         *ret_conv = TxRemoveOutput_read(ser_ref);
51165         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51166         return tag_ptr(ret_conv, true);
51167 }
51168
51169 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxComplete_1write(JNIEnv *env, jclass clz, int64_t obj) {
51170         LDKTxComplete obj_conv;
51171         obj_conv.inner = untag_ptr(obj);
51172         obj_conv.is_owned = ptr_is_owned(obj);
51173         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51174         obj_conv.is_owned = false;
51175         LDKCVec_u8Z ret_var = TxComplete_write(&obj_conv);
51176         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51177         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51178         CVec_u8Z_free(ret_var);
51179         return ret_arr;
51180 }
51181
51182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51183         LDKu8slice ser_ref;
51184         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51185         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51186         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
51187         *ret_conv = TxComplete_read(ser_ref);
51188         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51189         return tag_ptr(ret_conv, true);
51190 }
51191
51192 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
51193         LDKTxSignatures obj_conv;
51194         obj_conv.inner = untag_ptr(obj);
51195         obj_conv.is_owned = ptr_is_owned(obj);
51196         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51197         obj_conv.is_owned = false;
51198         LDKCVec_u8Z ret_var = TxSignatures_write(&obj_conv);
51199         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51200         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51201         CVec_u8Z_free(ret_var);
51202         return ret_arr;
51203 }
51204
51205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51206         LDKu8slice ser_ref;
51207         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51208         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51209         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
51210         *ret_conv = TxSignatures_read(ser_ref);
51211         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51212         return tag_ptr(ret_conv, true);
51213 }
51214
51215 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1write(JNIEnv *env, jclass clz, int64_t obj) {
51216         LDKTxInitRbf obj_conv;
51217         obj_conv.inner = untag_ptr(obj);
51218         obj_conv.is_owned = ptr_is_owned(obj);
51219         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51220         obj_conv.is_owned = false;
51221         LDKCVec_u8Z ret_var = TxInitRbf_write(&obj_conv);
51222         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51223         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51224         CVec_u8Z_free(ret_var);
51225         return ret_arr;
51226 }
51227
51228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51229         LDKu8slice ser_ref;
51230         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51231         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51232         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
51233         *ret_conv = TxInitRbf_read(ser_ref);
51234         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51235         return tag_ptr(ret_conv, true);
51236 }
51237
51238 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1write(JNIEnv *env, jclass clz, int64_t obj) {
51239         LDKTxAckRbf obj_conv;
51240         obj_conv.inner = untag_ptr(obj);
51241         obj_conv.is_owned = ptr_is_owned(obj);
51242         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51243         obj_conv.is_owned = false;
51244         LDKCVec_u8Z ret_var = TxAckRbf_write(&obj_conv);
51245         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51246         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51247         CVec_u8Z_free(ret_var);
51248         return ret_arr;
51249 }
51250
51251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51252         LDKu8slice ser_ref;
51253         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51254         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51255         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
51256         *ret_conv = TxAckRbf_read(ser_ref);
51257         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51258         return tag_ptr(ret_conv, true);
51259 }
51260
51261 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAbort_1write(JNIEnv *env, jclass clz, int64_t obj) {
51262         LDKTxAbort obj_conv;
51263         obj_conv.inner = untag_ptr(obj);
51264         obj_conv.is_owned = ptr_is_owned(obj);
51265         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51266         obj_conv.is_owned = false;
51267         LDKCVec_u8Z ret_var = TxAbort_write(&obj_conv);
51268         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51269         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51270         CVec_u8Z_free(ret_var);
51271         return ret_arr;
51272 }
51273
51274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51275         LDKu8slice ser_ref;
51276         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51277         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51278         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
51279         *ret_conv = TxAbort_read(ser_ref);
51280         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51281         return tag_ptr(ret_conv, true);
51282 }
51283
51284 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
51285         LDKAnnouncementSignatures obj_conv;
51286         obj_conv.inner = untag_ptr(obj);
51287         obj_conv.is_owned = ptr_is_owned(obj);
51288         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51289         obj_conv.is_owned = false;
51290         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
51291         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51292         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51293         CVec_u8Z_free(ret_var);
51294         return ret_arr;
51295 }
51296
51297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51298         LDKu8slice ser_ref;
51299         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51300         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51301         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
51302         *ret_conv = AnnouncementSignatures_read(ser_ref);
51303         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51304         return tag_ptr(ret_conv, true);
51305 }
51306
51307 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
51308         LDKChannelReestablish obj_conv;
51309         obj_conv.inner = untag_ptr(obj);
51310         obj_conv.is_owned = ptr_is_owned(obj);
51311         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51312         obj_conv.is_owned = false;
51313         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
51314         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51315         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51316         CVec_u8Z_free(ret_var);
51317         return ret_arr;
51318 }
51319
51320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51321         LDKu8slice ser_ref;
51322         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51323         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51324         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
51325         *ret_conv = ChannelReestablish_read(ser_ref);
51326         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51327         return tag_ptr(ret_conv, true);
51328 }
51329
51330 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
51331         LDKClosingSigned obj_conv;
51332         obj_conv.inner = untag_ptr(obj);
51333         obj_conv.is_owned = ptr_is_owned(obj);
51334         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51335         obj_conv.is_owned = false;
51336         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
51337         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51338         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51339         CVec_u8Z_free(ret_var);
51340         return ret_arr;
51341 }
51342
51343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51344         LDKu8slice ser_ref;
51345         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51346         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51347         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
51348         *ret_conv = ClosingSigned_read(ser_ref);
51349         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51350         return tag_ptr(ret_conv, true);
51351 }
51352
51353 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
51354         LDKClosingSignedFeeRange obj_conv;
51355         obj_conv.inner = untag_ptr(obj);
51356         obj_conv.is_owned = ptr_is_owned(obj);
51357         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51358         obj_conv.is_owned = false;
51359         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
51360         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51361         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51362         CVec_u8Z_free(ret_var);
51363         return ret_arr;
51364 }
51365
51366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51367         LDKu8slice ser_ref;
51368         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51369         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51370         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
51371         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
51372         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51373         return tag_ptr(ret_conv, true);
51374 }
51375
51376 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
51377         LDKCommitmentSigned obj_conv;
51378         obj_conv.inner = untag_ptr(obj);
51379         obj_conv.is_owned = ptr_is_owned(obj);
51380         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51381         obj_conv.is_owned = false;
51382         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
51383         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51384         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51385         CVec_u8Z_free(ret_var);
51386         return ret_arr;
51387 }
51388
51389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51390         LDKu8slice ser_ref;
51391         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51392         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51393         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
51394         *ret_conv = CommitmentSigned_read(ser_ref);
51395         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51396         return tag_ptr(ret_conv, true);
51397 }
51398
51399 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
51400         LDKFundingCreated obj_conv;
51401         obj_conv.inner = untag_ptr(obj);
51402         obj_conv.is_owned = ptr_is_owned(obj);
51403         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51404         obj_conv.is_owned = false;
51405         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
51406         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51407         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51408         CVec_u8Z_free(ret_var);
51409         return ret_arr;
51410 }
51411
51412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51413         LDKu8slice ser_ref;
51414         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51415         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51416         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
51417         *ret_conv = FundingCreated_read(ser_ref);
51418         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51419         return tag_ptr(ret_conv, true);
51420 }
51421
51422 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
51423         LDKFundingSigned obj_conv;
51424         obj_conv.inner = untag_ptr(obj);
51425         obj_conv.is_owned = ptr_is_owned(obj);
51426         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51427         obj_conv.is_owned = false;
51428         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
51429         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51430         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51431         CVec_u8Z_free(ret_var);
51432         return ret_arr;
51433 }
51434
51435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51436         LDKu8slice ser_ref;
51437         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51438         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51439         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
51440         *ret_conv = FundingSigned_read(ser_ref);
51441         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51442         return tag_ptr(ret_conv, true);
51443 }
51444
51445 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1write(JNIEnv *env, jclass clz, int64_t obj) {
51446         LDKChannelReady obj_conv;
51447         obj_conv.inner = untag_ptr(obj);
51448         obj_conv.is_owned = ptr_is_owned(obj);
51449         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51450         obj_conv.is_owned = false;
51451         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
51452         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51453         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51454         CVec_u8Z_free(ret_var);
51455         return ret_arr;
51456 }
51457
51458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51459         LDKu8slice ser_ref;
51460         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51461         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51462         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
51463         *ret_conv = ChannelReady_read(ser_ref);
51464         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51465         return tag_ptr(ret_conv, true);
51466 }
51467
51468 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
51469         LDKInit obj_conv;
51470         obj_conv.inner = untag_ptr(obj);
51471         obj_conv.is_owned = ptr_is_owned(obj);
51472         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51473         obj_conv.is_owned = false;
51474         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
51475         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51476         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51477         CVec_u8Z_free(ret_var);
51478         return ret_arr;
51479 }
51480
51481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51482         LDKu8slice ser_ref;
51483         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51484         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51485         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
51486         *ret_conv = Init_read(ser_ref);
51487         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51488         return tag_ptr(ret_conv, true);
51489 }
51490
51491 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
51492         LDKOpenChannel obj_conv;
51493         obj_conv.inner = untag_ptr(obj);
51494         obj_conv.is_owned = ptr_is_owned(obj);
51495         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51496         obj_conv.is_owned = false;
51497         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
51498         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51499         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51500         CVec_u8Z_free(ret_var);
51501         return ret_arr;
51502 }
51503
51504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51505         LDKu8slice ser_ref;
51506         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51507         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51508         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
51509         *ret_conv = OpenChannel_read(ser_ref);
51510         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51511         return tag_ptr(ret_conv, true);
51512 }
51513
51514 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1write(JNIEnv *env, jclass clz, int64_t obj) {
51515         LDKOpenChannelV2 obj_conv;
51516         obj_conv.inner = untag_ptr(obj);
51517         obj_conv.is_owned = ptr_is_owned(obj);
51518         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51519         obj_conv.is_owned = false;
51520         LDKCVec_u8Z ret_var = OpenChannelV2_write(&obj_conv);
51521         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51522         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51523         CVec_u8Z_free(ret_var);
51524         return ret_arr;
51525 }
51526
51527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51528         LDKu8slice ser_ref;
51529         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51530         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51531         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
51532         *ret_conv = OpenChannelV2_read(ser_ref);
51533         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51534         return tag_ptr(ret_conv, true);
51535 }
51536
51537 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
51538         LDKRevokeAndACK obj_conv;
51539         obj_conv.inner = untag_ptr(obj);
51540         obj_conv.is_owned = ptr_is_owned(obj);
51541         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51542         obj_conv.is_owned = false;
51543         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
51544         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51545         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51546         CVec_u8Z_free(ret_var);
51547         return ret_arr;
51548 }
51549
51550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51551         LDKu8slice ser_ref;
51552         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51553         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51554         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
51555         *ret_conv = RevokeAndACK_read(ser_ref);
51556         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51557         return tag_ptr(ret_conv, true);
51558 }
51559
51560 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
51561         LDKShutdown obj_conv;
51562         obj_conv.inner = untag_ptr(obj);
51563         obj_conv.is_owned = ptr_is_owned(obj);
51564         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51565         obj_conv.is_owned = false;
51566         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
51567         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51568         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51569         CVec_u8Z_free(ret_var);
51570         return ret_arr;
51571 }
51572
51573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51574         LDKu8slice ser_ref;
51575         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51576         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51577         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
51578         *ret_conv = Shutdown_read(ser_ref);
51579         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51580         return tag_ptr(ret_conv, true);
51581 }
51582
51583 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
51584         LDKUpdateFailHTLC obj_conv;
51585         obj_conv.inner = untag_ptr(obj);
51586         obj_conv.is_owned = ptr_is_owned(obj);
51587         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51588         obj_conv.is_owned = false;
51589         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
51590         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51591         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51592         CVec_u8Z_free(ret_var);
51593         return ret_arr;
51594 }
51595
51596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51597         LDKu8slice ser_ref;
51598         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51599         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51600         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
51601         *ret_conv = UpdateFailHTLC_read(ser_ref);
51602         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51603         return tag_ptr(ret_conv, true);
51604 }
51605
51606 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
51607         LDKUpdateFailMalformedHTLC obj_conv;
51608         obj_conv.inner = untag_ptr(obj);
51609         obj_conv.is_owned = ptr_is_owned(obj);
51610         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51611         obj_conv.is_owned = false;
51612         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
51613         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51614         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51615         CVec_u8Z_free(ret_var);
51616         return ret_arr;
51617 }
51618
51619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51620         LDKu8slice ser_ref;
51621         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51622         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51623         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
51624         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
51625         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51626         return tag_ptr(ret_conv, true);
51627 }
51628
51629 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
51630         LDKUpdateFee obj_conv;
51631         obj_conv.inner = untag_ptr(obj);
51632         obj_conv.is_owned = ptr_is_owned(obj);
51633         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51634         obj_conv.is_owned = false;
51635         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
51636         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51637         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51638         CVec_u8Z_free(ret_var);
51639         return ret_arr;
51640 }
51641
51642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51643         LDKu8slice ser_ref;
51644         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51645         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51646         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
51647         *ret_conv = UpdateFee_read(ser_ref);
51648         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51649         return tag_ptr(ret_conv, true);
51650 }
51651
51652 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
51653         LDKUpdateFulfillHTLC obj_conv;
51654         obj_conv.inner = untag_ptr(obj);
51655         obj_conv.is_owned = ptr_is_owned(obj);
51656         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51657         obj_conv.is_owned = false;
51658         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
51659         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51660         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51661         CVec_u8Z_free(ret_var);
51662         return ret_arr;
51663 }
51664
51665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51666         LDKu8slice ser_ref;
51667         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51668         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51669         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
51670         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
51671         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51672         return tag_ptr(ret_conv, true);
51673 }
51674
51675 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
51676         LDKUpdateAddHTLC obj_conv;
51677         obj_conv.inner = untag_ptr(obj);
51678         obj_conv.is_owned = ptr_is_owned(obj);
51679         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51680         obj_conv.is_owned = false;
51681         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
51682         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51683         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51684         CVec_u8Z_free(ret_var);
51685         return ret_arr;
51686 }
51687
51688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51689         LDKu8slice ser_ref;
51690         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51691         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51692         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
51693         *ret_conv = UpdateAddHTLC_read(ser_ref);
51694         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51695         return tag_ptr(ret_conv, true);
51696 }
51697
51698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51699         LDKu8slice ser_ref;
51700         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51701         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51702         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
51703         *ret_conv = OnionMessage_read(ser_ref);
51704         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51705         return tag_ptr(ret_conv, true);
51706 }
51707
51708 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
51709         LDKOnionMessage obj_conv;
51710         obj_conv.inner = untag_ptr(obj);
51711         obj_conv.is_owned = ptr_is_owned(obj);
51712         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51713         obj_conv.is_owned = false;
51714         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
51715         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51716         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51717         CVec_u8Z_free(ret_var);
51718         return ret_arr;
51719 }
51720
51721 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
51722         LDKPing obj_conv;
51723         obj_conv.inner = untag_ptr(obj);
51724         obj_conv.is_owned = ptr_is_owned(obj);
51725         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51726         obj_conv.is_owned = false;
51727         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
51728         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51729         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51730         CVec_u8Z_free(ret_var);
51731         return ret_arr;
51732 }
51733
51734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51735         LDKu8slice ser_ref;
51736         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51737         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51738         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
51739         *ret_conv = Ping_read(ser_ref);
51740         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51741         return tag_ptr(ret_conv, true);
51742 }
51743
51744 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
51745         LDKPong obj_conv;
51746         obj_conv.inner = untag_ptr(obj);
51747         obj_conv.is_owned = ptr_is_owned(obj);
51748         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51749         obj_conv.is_owned = false;
51750         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
51751         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51752         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51753         CVec_u8Z_free(ret_var);
51754         return ret_arr;
51755 }
51756
51757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51758         LDKu8slice ser_ref;
51759         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51760         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51761         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
51762         *ret_conv = Pong_read(ser_ref);
51763         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51764         return tag_ptr(ret_conv, true);
51765 }
51766
51767 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
51768         LDKUnsignedChannelAnnouncement obj_conv;
51769         obj_conv.inner = untag_ptr(obj);
51770         obj_conv.is_owned = ptr_is_owned(obj);
51771         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51772         obj_conv.is_owned = false;
51773         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
51774         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51775         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51776         CVec_u8Z_free(ret_var);
51777         return ret_arr;
51778 }
51779
51780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51781         LDKu8slice ser_ref;
51782         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51783         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51784         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
51785         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
51786         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51787         return tag_ptr(ret_conv, true);
51788 }
51789
51790 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
51791         LDKChannelAnnouncement obj_conv;
51792         obj_conv.inner = untag_ptr(obj);
51793         obj_conv.is_owned = ptr_is_owned(obj);
51794         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51795         obj_conv.is_owned = false;
51796         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
51797         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51798         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51799         CVec_u8Z_free(ret_var);
51800         return ret_arr;
51801 }
51802
51803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51804         LDKu8slice ser_ref;
51805         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51806         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51807         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
51808         *ret_conv = ChannelAnnouncement_read(ser_ref);
51809         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51810         return tag_ptr(ret_conv, true);
51811 }
51812
51813 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
51814         LDKUnsignedChannelUpdate obj_conv;
51815         obj_conv.inner = untag_ptr(obj);
51816         obj_conv.is_owned = ptr_is_owned(obj);
51817         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51818         obj_conv.is_owned = false;
51819         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
51820         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51821         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51822         CVec_u8Z_free(ret_var);
51823         return ret_arr;
51824 }
51825
51826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51827         LDKu8slice ser_ref;
51828         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51829         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51830         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
51831         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
51832         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51833         return tag_ptr(ret_conv, true);
51834 }
51835
51836 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
51837         LDKChannelUpdate obj_conv;
51838         obj_conv.inner = untag_ptr(obj);
51839         obj_conv.is_owned = ptr_is_owned(obj);
51840         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51841         obj_conv.is_owned = false;
51842         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
51843         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51844         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51845         CVec_u8Z_free(ret_var);
51846         return ret_arr;
51847 }
51848
51849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51850         LDKu8slice ser_ref;
51851         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51852         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51853         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
51854         *ret_conv = ChannelUpdate_read(ser_ref);
51855         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51856         return tag_ptr(ret_conv, true);
51857 }
51858
51859 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
51860         LDKErrorMessage obj_conv;
51861         obj_conv.inner = untag_ptr(obj);
51862         obj_conv.is_owned = ptr_is_owned(obj);
51863         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51864         obj_conv.is_owned = false;
51865         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
51866         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51867         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51868         CVec_u8Z_free(ret_var);
51869         return ret_arr;
51870 }
51871
51872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51873         LDKu8slice ser_ref;
51874         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51875         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51876         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
51877         *ret_conv = ErrorMessage_read(ser_ref);
51878         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51879         return tag_ptr(ret_conv, true);
51880 }
51881
51882 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
51883         LDKWarningMessage obj_conv;
51884         obj_conv.inner = untag_ptr(obj);
51885         obj_conv.is_owned = ptr_is_owned(obj);
51886         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51887         obj_conv.is_owned = false;
51888         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
51889         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51890         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51891         CVec_u8Z_free(ret_var);
51892         return ret_arr;
51893 }
51894
51895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51896         LDKu8slice ser_ref;
51897         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51898         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51899         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
51900         *ret_conv = WarningMessage_read(ser_ref);
51901         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51902         return tag_ptr(ret_conv, true);
51903 }
51904
51905 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
51906         LDKUnsignedNodeAnnouncement obj_conv;
51907         obj_conv.inner = untag_ptr(obj);
51908         obj_conv.is_owned = ptr_is_owned(obj);
51909         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51910         obj_conv.is_owned = false;
51911         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
51912         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51913         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51914         CVec_u8Z_free(ret_var);
51915         return ret_arr;
51916 }
51917
51918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51919         LDKu8slice ser_ref;
51920         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51921         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51922         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
51923         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
51924         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51925         return tag_ptr(ret_conv, true);
51926 }
51927
51928 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
51929         LDKNodeAnnouncement obj_conv;
51930         obj_conv.inner = untag_ptr(obj);
51931         obj_conv.is_owned = ptr_is_owned(obj);
51932         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51933         obj_conv.is_owned = false;
51934         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
51935         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51936         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51937         CVec_u8Z_free(ret_var);
51938         return ret_arr;
51939 }
51940
51941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51942         LDKu8slice ser_ref;
51943         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51944         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51945         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
51946         *ret_conv = NodeAnnouncement_read(ser_ref);
51947         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51948         return tag_ptr(ret_conv, true);
51949 }
51950
51951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51952         LDKu8slice ser_ref;
51953         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51954         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51955         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
51956         *ret_conv = QueryShortChannelIds_read(ser_ref);
51957         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51958         return tag_ptr(ret_conv, true);
51959 }
51960
51961 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
51962         LDKQueryShortChannelIds obj_conv;
51963         obj_conv.inner = untag_ptr(obj);
51964         obj_conv.is_owned = ptr_is_owned(obj);
51965         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51966         obj_conv.is_owned = false;
51967         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
51968         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51969         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51970         CVec_u8Z_free(ret_var);
51971         return ret_arr;
51972 }
51973
51974 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
51975         LDKReplyShortChannelIdsEnd obj_conv;
51976         obj_conv.inner = untag_ptr(obj);
51977         obj_conv.is_owned = ptr_is_owned(obj);
51978         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51979         obj_conv.is_owned = false;
51980         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
51981         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51982         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51983         CVec_u8Z_free(ret_var);
51984         return ret_arr;
51985 }
51986
51987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51988         LDKu8slice ser_ref;
51989         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51990         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51991         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
51992         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
51993         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51994         return tag_ptr(ret_conv, true);
51995 }
51996
51997 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
51998         LDKQueryChannelRange this_arg_conv;
51999         this_arg_conv.inner = untag_ptr(this_arg);
52000         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52002         this_arg_conv.is_owned = false;
52003         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
52004         return ret_conv;
52005 }
52006
52007 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
52008         LDKQueryChannelRange obj_conv;
52009         obj_conv.inner = untag_ptr(obj);
52010         obj_conv.is_owned = ptr_is_owned(obj);
52011         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52012         obj_conv.is_owned = false;
52013         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
52014         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
52015         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
52016         CVec_u8Z_free(ret_var);
52017         return ret_arr;
52018 }
52019
52020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
52021         LDKu8slice ser_ref;
52022         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
52023         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
52024         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
52025         *ret_conv = QueryChannelRange_read(ser_ref);
52026         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
52027         return tag_ptr(ret_conv, true);
52028 }
52029
52030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
52031         LDKu8slice ser_ref;
52032         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
52033         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
52034         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
52035         *ret_conv = ReplyChannelRange_read(ser_ref);
52036         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
52037         return tag_ptr(ret_conv, true);
52038 }
52039
52040 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
52041         LDKReplyChannelRange obj_conv;
52042         obj_conv.inner = untag_ptr(obj);
52043         obj_conv.is_owned = ptr_is_owned(obj);
52044         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52045         obj_conv.is_owned = false;
52046         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
52047         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
52048         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
52049         CVec_u8Z_free(ret_var);
52050         return ret_arr;
52051 }
52052
52053 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
52054         LDKGossipTimestampFilter obj_conv;
52055         obj_conv.inner = untag_ptr(obj);
52056         obj_conv.is_owned = ptr_is_owned(obj);
52057         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52058         obj_conv.is_owned = false;
52059         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
52060         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
52061         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
52062         CVec_u8Z_free(ret_var);
52063         return ret_arr;
52064 }
52065
52066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
52067         LDKu8slice ser_ref;
52068         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
52069         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
52070         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
52071         *ret_conv = GossipTimestampFilter_read(ser_ref);
52072         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
52073         return tag_ptr(ret_conv, true);
52074 }
52075
52076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
52077         if (!ptr_is_owned(this_ptr)) return;
52078         void* this_ptr_ptr = untag_ptr(this_ptr);
52079         CHECK_ACCESS(this_ptr_ptr);
52080         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
52081         FREE(untag_ptr(this_ptr));
52082         CustomMessageHandler_free(this_ptr_conv);
52083 }
52084
52085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52086         LDKIgnoringMessageHandler this_obj_conv;
52087         this_obj_conv.inner = untag_ptr(this_obj);
52088         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52090         IgnoringMessageHandler_free(this_obj_conv);
52091 }
52092
52093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
52094         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
52095         int64_t ret_ref = 0;
52096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52098         return ret_ref;
52099 }
52100
52101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
52102         LDKIgnoringMessageHandler this_arg_conv;
52103         this_arg_conv.inner = untag_ptr(this_arg);
52104         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52106         this_arg_conv.is_owned = false;
52107         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
52108         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
52109         return tag_ptr(ret_ret, true);
52110 }
52111
52112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
52113         LDKIgnoringMessageHandler this_arg_conv;
52114         this_arg_conv.inner = untag_ptr(this_arg);
52115         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52117         this_arg_conv.is_owned = false;
52118         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
52119         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
52120         return tag_ptr(ret_ret, true);
52121 }
52122
52123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
52124         LDKIgnoringMessageHandler this_arg_conv;
52125         this_arg_conv.inner = untag_ptr(this_arg);
52126         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52128         this_arg_conv.is_owned = false;
52129         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
52130         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
52131         return tag_ptr(ret_ret, true);
52132 }
52133
52134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OffersMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
52135         LDKIgnoringMessageHandler this_arg_conv;
52136         this_arg_conv.inner = untag_ptr(this_arg);
52137         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52139         this_arg_conv.is_owned = false;
52140         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
52141         *ret_ret = IgnoringMessageHandler_as_OffersMessageHandler(&this_arg_conv);
52142         return tag_ptr(ret_ret, true);
52143 }
52144
52145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomOnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
52146         LDKIgnoringMessageHandler this_arg_conv;
52147         this_arg_conv.inner = untag_ptr(this_arg);
52148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52150         this_arg_conv.is_owned = false;
52151         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
52152         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
52153         return tag_ptr(ret_ret, true);
52154 }
52155
52156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
52157         LDKIgnoringMessageHandler this_arg_conv;
52158         this_arg_conv.inner = untag_ptr(this_arg);
52159         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52161         this_arg_conv.is_owned = false;
52162         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
52163         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
52164         return tag_ptr(ret_ret, true);
52165 }
52166
52167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
52168         LDKIgnoringMessageHandler this_arg_conv;
52169         this_arg_conv.inner = untag_ptr(this_arg);
52170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52172         this_arg_conv.is_owned = false;
52173         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
52174         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
52175         return tag_ptr(ret_ret, true);
52176 }
52177
52178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52179         LDKErroringMessageHandler this_obj_conv;
52180         this_obj_conv.inner = untag_ptr(this_obj);
52181         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52183         ErroringMessageHandler_free(this_obj_conv);
52184 }
52185
52186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
52187         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
52188         int64_t ret_ref = 0;
52189         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52190         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52191         return ret_ref;
52192 }
52193
52194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
52195         LDKErroringMessageHandler this_arg_conv;
52196         this_arg_conv.inner = untag_ptr(this_arg);
52197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52199         this_arg_conv.is_owned = false;
52200         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
52201         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
52202         return tag_ptr(ret_ret, true);
52203 }
52204
52205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
52206         LDKErroringMessageHandler this_arg_conv;
52207         this_arg_conv.inner = untag_ptr(this_arg);
52208         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52210         this_arg_conv.is_owned = false;
52211         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
52212         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
52213         return tag_ptr(ret_ret, true);
52214 }
52215
52216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52217         LDKMessageHandler this_obj_conv;
52218         this_obj_conv.inner = untag_ptr(this_obj);
52219         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52221         MessageHandler_free(this_obj_conv);
52222 }
52223
52224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
52225         LDKMessageHandler this_ptr_conv;
52226         this_ptr_conv.inner = untag_ptr(this_ptr);
52227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52229         this_ptr_conv.is_owned = false;
52230         // WARNING: This object doesn't live past this scope, needs clone!
52231         int64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
52232         return ret_ret;
52233 }
52234
52235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52236         LDKMessageHandler this_ptr_conv;
52237         this_ptr_conv.inner = untag_ptr(this_ptr);
52238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52240         this_ptr_conv.is_owned = false;
52241         void* val_ptr = untag_ptr(val);
52242         CHECK_ACCESS(val_ptr);
52243         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
52244         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
52245                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52246                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
52247         }
52248         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
52249 }
52250
52251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
52252         LDKMessageHandler this_ptr_conv;
52253         this_ptr_conv.inner = untag_ptr(this_ptr);
52254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52256         this_ptr_conv.is_owned = false;
52257         // WARNING: This object doesn't live past this scope, needs clone!
52258         int64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
52259         return ret_ret;
52260 }
52261
52262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52263         LDKMessageHandler this_ptr_conv;
52264         this_ptr_conv.inner = untag_ptr(this_ptr);
52265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52267         this_ptr_conv.is_owned = false;
52268         void* val_ptr = untag_ptr(val);
52269         CHECK_ACCESS(val_ptr);
52270         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
52271         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
52272                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52273                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
52274         }
52275         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
52276 }
52277
52278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1onion_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
52279         LDKMessageHandler this_ptr_conv;
52280         this_ptr_conv.inner = untag_ptr(this_ptr);
52281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52283         this_ptr_conv.is_owned = false;
52284         // WARNING: This object doesn't live past this scope, needs clone!
52285         int64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
52286         return ret_ret;
52287 }
52288
52289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1onion_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52290         LDKMessageHandler this_ptr_conv;
52291         this_ptr_conv.inner = untag_ptr(this_ptr);
52292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52294         this_ptr_conv.is_owned = false;
52295         void* val_ptr = untag_ptr(val);
52296         CHECK_ACCESS(val_ptr);
52297         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
52298         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
52299                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52300                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
52301         }
52302         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
52303 }
52304
52305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1custom_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
52306         LDKMessageHandler this_ptr_conv;
52307         this_ptr_conv.inner = untag_ptr(this_ptr);
52308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52310         this_ptr_conv.is_owned = false;
52311         // WARNING: This object doesn't live past this scope, needs clone!
52312         int64_t ret_ret = tag_ptr(MessageHandler_get_custom_message_handler(&this_ptr_conv), false);
52313         return ret_ret;
52314 }
52315
52316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1custom_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52317         LDKMessageHandler this_ptr_conv;
52318         this_ptr_conv.inner = untag_ptr(this_ptr);
52319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52321         this_ptr_conv.is_owned = false;
52322         void* val_ptr = untag_ptr(val);
52323         CHECK_ACCESS(val_ptr);
52324         LDKCustomMessageHandler val_conv = *(LDKCustomMessageHandler*)(val_ptr);
52325         if (val_conv.free == LDKCustomMessageHandler_JCalls_free) {
52326                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52327                 LDKCustomMessageHandler_JCalls_cloned(&val_conv);
52328         }
52329         MessageHandler_set_custom_message_handler(&this_ptr_conv, val_conv);
52330 }
52331
52332 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) {
52333         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
52334         CHECK_ACCESS(chan_handler_arg_ptr);
52335         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
52336         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
52337                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52338                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
52339         }
52340         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
52341         CHECK_ACCESS(route_handler_arg_ptr);
52342         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
52343         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
52344                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52345                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
52346         }
52347         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
52348         CHECK_ACCESS(onion_message_handler_arg_ptr);
52349         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
52350         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
52351                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52352                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
52353         }
52354         void* custom_message_handler_arg_ptr = untag_ptr(custom_message_handler_arg);
52355         CHECK_ACCESS(custom_message_handler_arg_ptr);
52356         LDKCustomMessageHandler custom_message_handler_arg_conv = *(LDKCustomMessageHandler*)(custom_message_handler_arg_ptr);
52357         if (custom_message_handler_arg_conv.free == LDKCustomMessageHandler_JCalls_free) {
52358                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52359                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_arg_conv);
52360         }
52361         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv, custom_message_handler_arg_conv);
52362         int64_t ret_ref = 0;
52363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52365         return ret_ref;
52366 }
52367
52368 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
52369         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
52370         *ret_ret = SocketDescriptor_clone(arg);
52371         return tag_ptr(ret_ret, true);
52372 }
52373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52374         void* arg_ptr = untag_ptr(arg);
52375         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
52376         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
52377         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
52378         return ret_conv;
52379 }
52380
52381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52382         void* orig_ptr = untag_ptr(orig);
52383         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
52384         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
52385         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
52386         *ret_ret = SocketDescriptor_clone(orig_conv);
52387         return tag_ptr(ret_ret, true);
52388 }
52389
52390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
52391         if (!ptr_is_owned(this_ptr)) return;
52392         void* this_ptr_ptr = untag_ptr(this_ptr);
52393         CHECK_ACCESS(this_ptr_ptr);
52394         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
52395         FREE(untag_ptr(this_ptr));
52396         SocketDescriptor_free(this_ptr_conv);
52397 }
52398
52399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52400         LDKPeerHandleError this_obj_conv;
52401         this_obj_conv.inner = untag_ptr(this_obj);
52402         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52404         PeerHandleError_free(this_obj_conv);
52405 }
52406
52407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz) {
52408         LDKPeerHandleError ret_var = PeerHandleError_new();
52409         int64_t ret_ref = 0;
52410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52412         return ret_ref;
52413 }
52414
52415 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
52416         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
52417         int64_t ret_ref = 0;
52418         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52419         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52420         return ret_ref;
52421 }
52422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52423         LDKPeerHandleError arg_conv;
52424         arg_conv.inner = untag_ptr(arg);
52425         arg_conv.is_owned = ptr_is_owned(arg);
52426         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52427         arg_conv.is_owned = false;
52428         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
52429         return ret_conv;
52430 }
52431
52432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52433         LDKPeerHandleError orig_conv;
52434         orig_conv.inner = untag_ptr(orig);
52435         orig_conv.is_owned = ptr_is_owned(orig);
52436         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52437         orig_conv.is_owned = false;
52438         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
52439         int64_t ret_ref = 0;
52440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52442         return ret_ref;
52443 }
52444
52445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52446         LDKPeerManager this_obj_conv;
52447         this_obj_conv.inner = untag_ptr(this_obj);
52448         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52450         PeerManager_free(this_obj_conv);
52451 }
52452
52453 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) {
52454         LDKMessageHandler message_handler_conv;
52455         message_handler_conv.inner = untag_ptr(message_handler);
52456         message_handler_conv.is_owned = ptr_is_owned(message_handler);
52457         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
52458         // WARNING: we need a move here but no clone is available for LDKMessageHandler
52459         
52460         uint8_t ephemeral_random_data_arr[32];
52461         CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
52462         (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
52463         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
52464         void* logger_ptr = untag_ptr(logger);
52465         CHECK_ACCESS(logger_ptr);
52466         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
52467         if (logger_conv.free == LDKLogger_JCalls_free) {
52468                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52469                 LDKLogger_JCalls_cloned(&logger_conv);
52470         }
52471         void* node_signer_ptr = untag_ptr(node_signer);
52472         CHECK_ACCESS(node_signer_ptr);
52473         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
52474         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
52475                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52476                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
52477         }
52478         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, node_signer_conv);
52479         int64_t ret_ref = 0;
52480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52482         return ret_ref;
52483 }
52484
52485 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
52486         LDKPeerManager this_arg_conv;
52487         this_arg_conv.inner = untag_ptr(this_arg);
52488         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52490         this_arg_conv.is_owned = false;
52491         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
52492         int64_tArray ret_arr = NULL;
52493         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
52494         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
52495         for (size_t r = 0; r < ret_var.datalen; r++) {
52496                 LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv_43_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
52497                 *ret_conv_43_conv = ret_var.data[r];
52498                 ret_arr_ptr[r] = tag_ptr(ret_conv_43_conv, true);
52499         }
52500         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
52501         FREE(ret_var.data);
52502         return ret_arr;
52503 }
52504
52505 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) {
52506         LDKPeerManager this_arg_conv;
52507         this_arg_conv.inner = untag_ptr(this_arg);
52508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52510         this_arg_conv.is_owned = false;
52511         LDKPublicKey their_node_id_ref;
52512         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
52513         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
52514         void* descriptor_ptr = untag_ptr(descriptor);
52515         CHECK_ACCESS(descriptor_ptr);
52516         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
52517         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
52518                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52519                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
52520         }
52521         void* remote_network_address_ptr = untag_ptr(remote_network_address);
52522         CHECK_ACCESS(remote_network_address_ptr);
52523         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
52524         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
52525         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
52526         return tag_ptr(ret_conv, true);
52527 }
52528
52529 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) {
52530         LDKPeerManager this_arg_conv;
52531         this_arg_conv.inner = untag_ptr(this_arg);
52532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52534         this_arg_conv.is_owned = false;
52535         void* descriptor_ptr = untag_ptr(descriptor);
52536         CHECK_ACCESS(descriptor_ptr);
52537         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
52538         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
52539                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52540                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
52541         }
52542         void* remote_network_address_ptr = untag_ptr(remote_network_address);
52543         CHECK_ACCESS(remote_network_address_ptr);
52544         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
52545         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
52546         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
52547         return tag_ptr(ret_conv, true);
52548 }
52549
52550 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) {
52551         LDKPeerManager this_arg_conv;
52552         this_arg_conv.inner = untag_ptr(this_arg);
52553         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52555         this_arg_conv.is_owned = false;
52556         void* descriptor_ptr = untag_ptr(descriptor);
52557         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
52558         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
52559         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
52560         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
52561         return tag_ptr(ret_conv, true);
52562 }
52563
52564 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) {
52565         LDKPeerManager this_arg_conv;
52566         this_arg_conv.inner = untag_ptr(this_arg);
52567         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52569         this_arg_conv.is_owned = false;
52570         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
52571         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
52572         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
52573         LDKu8slice data_ref;
52574         data_ref.datalen = (*env)->GetArrayLength(env, data);
52575         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
52576         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
52577         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
52578         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
52579         return tag_ptr(ret_conv, true);
52580 }
52581
52582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
52583         LDKPeerManager this_arg_conv;
52584         this_arg_conv.inner = untag_ptr(this_arg);
52585         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52587         this_arg_conv.is_owned = false;
52588         PeerManager_process_events(&this_arg_conv);
52589 }
52590
52591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
52592         LDKPeerManager this_arg_conv;
52593         this_arg_conv.inner = untag_ptr(this_arg);
52594         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52596         this_arg_conv.is_owned = false;
52597         void* descriptor_ptr = untag_ptr(descriptor);
52598         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
52599         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
52600         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
52601 }
52602
52603 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) {
52604         LDKPeerManager this_arg_conv;
52605         this_arg_conv.inner = untag_ptr(this_arg);
52606         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52608         this_arg_conv.is_owned = false;
52609         LDKPublicKey node_id_ref;
52610         CHECK((*env)->GetArrayLength(env, node_id) == 33);
52611         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
52612         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
52613 }
52614
52615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1peers(JNIEnv *env, jclass clz, int64_t this_arg) {
52616         LDKPeerManager this_arg_conv;
52617         this_arg_conv.inner = untag_ptr(this_arg);
52618         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52620         this_arg_conv.is_owned = false;
52621         PeerManager_disconnect_all_peers(&this_arg_conv);
52622 }
52623
52624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
52625         LDKPeerManager this_arg_conv;
52626         this_arg_conv.inner = untag_ptr(this_arg);
52627         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52629         this_arg_conv.is_owned = false;
52630         PeerManager_timer_tick_occurred(&this_arg_conv);
52631 }
52632
52633 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) {
52634         LDKPeerManager this_arg_conv;
52635         this_arg_conv.inner = untag_ptr(this_arg);
52636         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52638         this_arg_conv.is_owned = false;
52639         LDKThreeBytes rgb_ref;
52640         CHECK((*env)->GetArrayLength(env, rgb) == 3);
52641         (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
52642         LDKThirtyTwoBytes alias_ref;
52643         CHECK((*env)->GetArrayLength(env, alias) == 32);
52644         (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
52645         LDKCVec_SocketAddressZ addresses_constr;
52646         addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
52647         if (addresses_constr.datalen > 0)
52648                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
52649         else
52650                 addresses_constr.data = NULL;
52651         int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
52652         for (size_t p = 0; p < addresses_constr.datalen; p++) {
52653                 int64_t addresses_conv_15 = addresses_vals[p];
52654                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
52655                 CHECK_ACCESS(addresses_conv_15_ptr);
52656                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
52657                 addresses_constr.data[p] = addresses_conv_15_conv;
52658         }
52659         (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
52660         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
52661 }
52662
52663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1success_1tx_1weight(JNIEnv *env, jclass clz, int64_t channel_type_features) {
52664         LDKChannelTypeFeatures channel_type_features_conv;
52665         channel_type_features_conv.inner = untag_ptr(channel_type_features);
52666         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
52667         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
52668         channel_type_features_conv.is_owned = false;
52669         int64_t ret_conv = htlc_success_tx_weight(&channel_type_features_conv);
52670         return ret_conv;
52671 }
52672
52673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1timeout_1tx_1weight(JNIEnv *env, jclass clz, int64_t channel_type_features) {
52674         LDKChannelTypeFeatures channel_type_features_conv;
52675         channel_type_features_conv.inner = untag_ptr(channel_type_features);
52676         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
52677         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
52678         channel_type_features_conv.is_owned = false;
52679         int64_t ret_conv = htlc_timeout_tx_weight(&channel_type_features_conv);
52680         return ret_conv;
52681 }
52682
52683 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52684         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
52685         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_clone(orig_conv));
52686         return ret_conv;
52687 }
52688
52689 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1offered_1timeout(JNIEnv *env, jclass clz) {
52690         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_offered_timeout());
52691         return ret_conv;
52692 }
52693
52694 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1offered_1preimage(JNIEnv *env, jclass clz) {
52695         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_offered_preimage());
52696         return ret_conv;
52697 }
52698
52699 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1accepted_1timeout(JNIEnv *env, jclass clz) {
52700         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_accepted_timeout());
52701         return ret_conv;
52702 }
52703
52704 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1accepted_1preimage(JNIEnv *env, jclass clz) {
52705         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_accepted_preimage());
52706         return ret_conv;
52707 }
52708
52709 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1revocation(JNIEnv *env, jclass clz) {
52710         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_revocation());
52711         return ret_conv;
52712 }
52713
52714 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52715         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
52716         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
52717         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
52718         return ret_conv;
52719 }
52720
52721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1from_1witness(JNIEnv *env, jclass clz, int8_tArray witness) {
52722         LDKWitness witness_ref;
52723         witness_ref.datalen = (*env)->GetArrayLength(env, witness);
52724         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
52725         (*env)->GetByteArrayRegion(env, witness, 0, witness_ref.datalen, witness_ref.data);
52726         witness_ref.data_is_owned = true;
52727         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
52728         *ret_copy = HTLCClaim_from_witness(witness_ref);
52729         int64_t ret_ref = tag_ptr(ret_copy, true);
52730         return ret_ref;
52731 }
52732
52733 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
52734         uint8_t commitment_seed_arr[32];
52735         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
52736         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
52737         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
52738         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52739         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
52740         return ret_arr;
52741 }
52742
52743 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) {
52744         LDKCVec_u8Z to_holder_script_ref;
52745         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
52746         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
52747         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
52748         LDKCVec_u8Z to_counterparty_script_ref;
52749         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
52750         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
52751         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
52752         LDKOutPoint funding_outpoint_conv;
52753         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
52754         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
52755         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
52756         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
52757         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);
52758         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
52759         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
52760         Transaction_free(ret_var);
52761         return ret_arr;
52762 }
52763
52764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52765         LDKCounterpartyCommitmentSecrets this_obj_conv;
52766         this_obj_conv.inner = untag_ptr(this_obj);
52767         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52769         CounterpartyCommitmentSecrets_free(this_obj_conv);
52770 }
52771
52772 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
52773         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
52774         int64_t ret_ref = 0;
52775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52777         return ret_ref;
52778 }
52779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52780         LDKCounterpartyCommitmentSecrets arg_conv;
52781         arg_conv.inner = untag_ptr(arg);
52782         arg_conv.is_owned = ptr_is_owned(arg);
52783         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52784         arg_conv.is_owned = false;
52785         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
52786         return ret_conv;
52787 }
52788
52789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52790         LDKCounterpartyCommitmentSecrets orig_conv;
52791         orig_conv.inner = untag_ptr(orig);
52792         orig_conv.is_owned = ptr_is_owned(orig);
52793         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52794         orig_conv.is_owned = false;
52795         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
52796         int64_t ret_ref = 0;
52797         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52798         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52799         return ret_ref;
52800 }
52801
52802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1new(JNIEnv *env, jclass clz) {
52803         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
52804         int64_t ret_ref = 0;
52805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52807         return ret_ref;
52808 }
52809
52810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1min_1seen_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
52811         LDKCounterpartyCommitmentSecrets this_arg_conv;
52812         this_arg_conv.inner = untag_ptr(this_arg);
52813         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52815         this_arg_conv.is_owned = false;
52816         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
52817         return ret_conv;
52818 }
52819
52820 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) {
52821         LDKCounterpartyCommitmentSecrets this_arg_conv;
52822         this_arg_conv.inner = untag_ptr(this_arg);
52823         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52825         this_arg_conv.is_owned = false;
52826         LDKThirtyTwoBytes secret_ref;
52827         CHECK((*env)->GetArrayLength(env, secret) == 32);
52828         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_ref.data);
52829         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52830         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
52831         return tag_ptr(ret_conv, true);
52832 }
52833
52834 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
52835         LDKCounterpartyCommitmentSecrets this_arg_conv;
52836         this_arg_conv.inner = untag_ptr(this_arg);
52837         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52839         this_arg_conv.is_owned = false;
52840         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52841         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data);
52842         return ret_arr;
52843 }
52844
52845 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1write(JNIEnv *env, jclass clz, int64_t obj) {
52846         LDKCounterpartyCommitmentSecrets obj_conv;
52847         obj_conv.inner = untag_ptr(obj);
52848         obj_conv.is_owned = ptr_is_owned(obj);
52849         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52850         obj_conv.is_owned = false;
52851         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
52852         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
52853         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
52854         CVec_u8Z_free(ret_var);
52855         return ret_arr;
52856 }
52857
52858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
52859         LDKu8slice ser_ref;
52860         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
52861         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
52862         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
52863         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
52864         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
52865         return tag_ptr(ret_conv, true);
52866 }
52867
52868 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) {
52869         LDKPublicKey per_commitment_point_ref;
52870         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
52871         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
52872         uint8_t base_secret_arr[32];
52873         CHECK((*env)->GetArrayLength(env, base_secret) == 32);
52874         (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
52875         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
52876         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52877         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes);
52878         return ret_arr;
52879 }
52880
52881 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) {
52882         LDKPublicKey per_commitment_point_ref;
52883         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
52884         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
52885         LDKPublicKey base_point_ref;
52886         CHECK((*env)->GetArrayLength(env, base_point) == 33);
52887         (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
52888         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52889         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, derive_public_key(per_commitment_point_ref, base_point_ref).compressed_form);
52890         return ret_arr;
52891 }
52892
52893 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) {
52894         uint8_t per_commitment_secret_arr[32];
52895         CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
52896         (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
52897         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
52898         uint8_t countersignatory_revocation_base_secret_arr[32];
52899         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
52900         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
52901         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
52902         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52903         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes);
52904         return ret_arr;
52905 }
52906
52907 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) {
52908         LDKPublicKey per_commitment_point_ref;
52909         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
52910         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
52911         LDKPublicKey countersignatory_revocation_base_point_ref;
52912         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
52913         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
52914         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52915         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref).compressed_form);
52916         return ret_arr;
52917 }
52918
52919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52920         LDKTxCreationKeys this_obj_conv;
52921         this_obj_conv.inner = untag_ptr(this_obj);
52922         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52924         TxCreationKeys_free(this_obj_conv);
52925 }
52926
52927 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
52928         LDKTxCreationKeys this_ptr_conv;
52929         this_ptr_conv.inner = untag_ptr(this_ptr);
52930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52932         this_ptr_conv.is_owned = false;
52933         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52934         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
52935         return ret_arr;
52936 }
52937
52938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52939         LDKTxCreationKeys this_ptr_conv;
52940         this_ptr_conv.inner = untag_ptr(this_ptr);
52941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52943         this_ptr_conv.is_owned = false;
52944         LDKPublicKey val_ref;
52945         CHECK((*env)->GetArrayLength(env, val) == 33);
52946         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52947         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
52948 }
52949
52950 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
52951         LDKTxCreationKeys this_ptr_conv;
52952         this_ptr_conv.inner = untag_ptr(this_ptr);
52953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52955         this_ptr_conv.is_owned = false;
52956         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52957         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
52958         return ret_arr;
52959 }
52960
52961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52962         LDKTxCreationKeys this_ptr_conv;
52963         this_ptr_conv.inner = untag_ptr(this_ptr);
52964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52966         this_ptr_conv.is_owned = false;
52967         LDKPublicKey val_ref;
52968         CHECK((*env)->GetArrayLength(env, val) == 33);
52969         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52970         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
52971 }
52972
52973 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
52974         LDKTxCreationKeys this_ptr_conv;
52975         this_ptr_conv.inner = untag_ptr(this_ptr);
52976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52978         this_ptr_conv.is_owned = false;
52979         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52980         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
52981         return ret_arr;
52982 }
52983
52984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52985         LDKTxCreationKeys this_ptr_conv;
52986         this_ptr_conv.inner = untag_ptr(this_ptr);
52987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52989         this_ptr_conv.is_owned = false;
52990         LDKPublicKey val_ref;
52991         CHECK((*env)->GetArrayLength(env, val) == 33);
52992         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52993         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
52994 }
52995
52996 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
52997         LDKTxCreationKeys this_ptr_conv;
52998         this_ptr_conv.inner = untag_ptr(this_ptr);
52999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53001         this_ptr_conv.is_owned = false;
53002         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
53003         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
53004         return ret_arr;
53005 }
53006
53007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53008         LDKTxCreationKeys this_ptr_conv;
53009         this_ptr_conv.inner = untag_ptr(this_ptr);
53010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53012         this_ptr_conv.is_owned = false;
53013         LDKPublicKey val_ref;
53014         CHECK((*env)->GetArrayLength(env, val) == 33);
53015         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
53016         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
53017 }
53018
53019 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
53020         LDKTxCreationKeys this_ptr_conv;
53021         this_ptr_conv.inner = untag_ptr(this_ptr);
53022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53024         this_ptr_conv.is_owned = false;
53025         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
53026         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
53027         return ret_arr;
53028 }
53029
53030 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) {
53031         LDKTxCreationKeys this_ptr_conv;
53032         this_ptr_conv.inner = untag_ptr(this_ptr);
53033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53035         this_ptr_conv.is_owned = false;
53036         LDKPublicKey val_ref;
53037         CHECK((*env)->GetArrayLength(env, val) == 33);
53038         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
53039         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
53040 }
53041
53042 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) {
53043         LDKPublicKey per_commitment_point_arg_ref;
53044         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
53045         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
53046         LDKPublicKey revocation_key_arg_ref;
53047         CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
53048         (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
53049         LDKPublicKey broadcaster_htlc_key_arg_ref;
53050         CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
53051         (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
53052         LDKPublicKey countersignatory_htlc_key_arg_ref;
53053         CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
53054         (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
53055         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
53056         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
53057         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
53058         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);
53059         int64_t ret_ref = 0;
53060         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53061         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53062         return ret_ref;
53063 }
53064
53065 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53066         LDKTxCreationKeys a_conv;
53067         a_conv.inner = untag_ptr(a);
53068         a_conv.is_owned = ptr_is_owned(a);
53069         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53070         a_conv.is_owned = false;
53071         LDKTxCreationKeys b_conv;
53072         b_conv.inner = untag_ptr(b);
53073         b_conv.is_owned = ptr_is_owned(b);
53074         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53075         b_conv.is_owned = false;
53076         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
53077         return ret_conv;
53078 }
53079
53080 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
53081         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
53082         int64_t ret_ref = 0;
53083         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53084         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53085         return ret_ref;
53086 }
53087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53088         LDKTxCreationKeys arg_conv;
53089         arg_conv.inner = untag_ptr(arg);
53090         arg_conv.is_owned = ptr_is_owned(arg);
53091         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53092         arg_conv.is_owned = false;
53093         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
53094         return ret_conv;
53095 }
53096
53097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53098         LDKTxCreationKeys orig_conv;
53099         orig_conv.inner = untag_ptr(orig);
53100         orig_conv.is_owned = ptr_is_owned(orig);
53101         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53102         orig_conv.is_owned = false;
53103         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
53104         int64_t ret_ref = 0;
53105         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53106         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53107         return ret_ref;
53108 }
53109
53110 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
53111         LDKTxCreationKeys obj_conv;
53112         obj_conv.inner = untag_ptr(obj);
53113         obj_conv.is_owned = ptr_is_owned(obj);
53114         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53115         obj_conv.is_owned = false;
53116         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
53117         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53118         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53119         CVec_u8Z_free(ret_var);
53120         return ret_arr;
53121 }
53122
53123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
53124         LDKu8slice ser_ref;
53125         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
53126         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
53127         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
53128         *ret_conv = TxCreationKeys_read(ser_ref);
53129         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
53130         return tag_ptr(ret_conv, true);
53131 }
53132
53133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53134         LDKChannelPublicKeys this_obj_conv;
53135         this_obj_conv.inner = untag_ptr(this_obj);
53136         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53138         ChannelPublicKeys_free(this_obj_conv);
53139 }
53140
53141 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
53142         LDKChannelPublicKeys this_ptr_conv;
53143         this_ptr_conv.inner = untag_ptr(this_ptr);
53144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53146         this_ptr_conv.is_owned = false;
53147         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
53148         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
53149         return ret_arr;
53150 }
53151
53152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53153         LDKChannelPublicKeys this_ptr_conv;
53154         this_ptr_conv.inner = untag_ptr(this_ptr);
53155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53157         this_ptr_conv.is_owned = false;
53158         LDKPublicKey val_ref;
53159         CHECK((*env)->GetArrayLength(env, val) == 33);
53160         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
53161         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
53162 }
53163
53164 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
53165         LDKChannelPublicKeys this_ptr_conv;
53166         this_ptr_conv.inner = untag_ptr(this_ptr);
53167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53169         this_ptr_conv.is_owned = false;
53170         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
53171         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
53172         return ret_arr;
53173 }
53174
53175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53176         LDKChannelPublicKeys this_ptr_conv;
53177         this_ptr_conv.inner = untag_ptr(this_ptr);
53178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53180         this_ptr_conv.is_owned = false;
53181         LDKPublicKey val_ref;
53182         CHECK((*env)->GetArrayLength(env, val) == 33);
53183         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
53184         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
53185 }
53186
53187 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
53188         LDKChannelPublicKeys this_ptr_conv;
53189         this_ptr_conv.inner = untag_ptr(this_ptr);
53190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53192         this_ptr_conv.is_owned = false;
53193         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
53194         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
53195         return ret_arr;
53196 }
53197
53198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53199         LDKChannelPublicKeys this_ptr_conv;
53200         this_ptr_conv.inner = untag_ptr(this_ptr);
53201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53203         this_ptr_conv.is_owned = false;
53204         LDKPublicKey val_ref;
53205         CHECK((*env)->GetArrayLength(env, val) == 33);
53206         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
53207         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
53208 }
53209
53210 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
53211         LDKChannelPublicKeys 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
53217         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
53218         return ret_arr;
53219 }
53220
53221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53222         LDKChannelPublicKeys this_ptr_conv;
53223         this_ptr_conv.inner = untag_ptr(this_ptr);
53224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53226         this_ptr_conv.is_owned = false;
53227         LDKPublicKey val_ref;
53228         CHECK((*env)->GetArrayLength(env, val) == 33);
53229         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
53230         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
53231 }
53232
53233 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
53234         LDKChannelPublicKeys this_ptr_conv;
53235         this_ptr_conv.inner = untag_ptr(this_ptr);
53236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53238         this_ptr_conv.is_owned = false;
53239         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
53240         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
53241         return ret_arr;
53242 }
53243
53244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53245         LDKChannelPublicKeys this_ptr_conv;
53246         this_ptr_conv.inner = untag_ptr(this_ptr);
53247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53249         this_ptr_conv.is_owned = false;
53250         LDKPublicKey val_ref;
53251         CHECK((*env)->GetArrayLength(env, val) == 33);
53252         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
53253         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
53254 }
53255
53256 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) {
53257         LDKPublicKey funding_pubkey_arg_ref;
53258         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
53259         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
53260         LDKPublicKey revocation_basepoint_arg_ref;
53261         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
53262         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
53263         LDKPublicKey payment_point_arg_ref;
53264         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
53265         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
53266         LDKPublicKey delayed_payment_basepoint_arg_ref;
53267         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
53268         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
53269         LDKPublicKey htlc_basepoint_arg_ref;
53270         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
53271         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
53272         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);
53273         int64_t ret_ref = 0;
53274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53276         return ret_ref;
53277 }
53278
53279 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
53280         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
53281         int64_t ret_ref = 0;
53282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53284         return ret_ref;
53285 }
53286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53287         LDKChannelPublicKeys arg_conv;
53288         arg_conv.inner = untag_ptr(arg);
53289         arg_conv.is_owned = ptr_is_owned(arg);
53290         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53291         arg_conv.is_owned = false;
53292         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
53293         return ret_conv;
53294 }
53295
53296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53297         LDKChannelPublicKeys orig_conv;
53298         orig_conv.inner = untag_ptr(orig);
53299         orig_conv.is_owned = ptr_is_owned(orig);
53300         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53301         orig_conv.is_owned = false;
53302         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
53303         int64_t ret_ref = 0;
53304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53306         return ret_ref;
53307 }
53308
53309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1hash(JNIEnv *env, jclass clz, int64_t o) {
53310         LDKChannelPublicKeys o_conv;
53311         o_conv.inner = untag_ptr(o);
53312         o_conv.is_owned = ptr_is_owned(o);
53313         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53314         o_conv.is_owned = false;
53315         int64_t ret_conv = ChannelPublicKeys_hash(&o_conv);
53316         return ret_conv;
53317 }
53318
53319 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53320         LDKChannelPublicKeys a_conv;
53321         a_conv.inner = untag_ptr(a);
53322         a_conv.is_owned = ptr_is_owned(a);
53323         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53324         a_conv.is_owned = false;
53325         LDKChannelPublicKeys b_conv;
53326         b_conv.inner = untag_ptr(b);
53327         b_conv.is_owned = ptr_is_owned(b);
53328         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53329         b_conv.is_owned = false;
53330         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
53331         return ret_conv;
53332 }
53333
53334 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
53335         LDKChannelPublicKeys obj_conv;
53336         obj_conv.inner = untag_ptr(obj);
53337         obj_conv.is_owned = ptr_is_owned(obj);
53338         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53339         obj_conv.is_owned = false;
53340         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
53341         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53342         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53343         CVec_u8Z_free(ret_var);
53344         return ret_arr;
53345 }
53346
53347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
53348         LDKu8slice ser_ref;
53349         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
53350         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
53351         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
53352         *ret_conv = ChannelPublicKeys_read(ser_ref);
53353         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
53354         return tag_ptr(ret_conv, true);
53355 }
53356
53357 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) {
53358         LDKPublicKey per_commitment_point_ref;
53359         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
53360         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
53361         LDKPublicKey broadcaster_delayed_payment_base_ref;
53362         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
53363         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
53364         LDKPublicKey broadcaster_htlc_base_ref;
53365         CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
53366         (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
53367         LDKPublicKey countersignatory_revocation_base_ref;
53368         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
53369         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
53370         LDKPublicKey countersignatory_htlc_base_ref;
53371         CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
53372         (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
53373         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);
53374         int64_t ret_ref = 0;
53375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53377         return ret_ref;
53378 }
53379
53380 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) {
53381         LDKPublicKey per_commitment_point_ref;
53382         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
53383         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
53384         LDKChannelPublicKeys broadcaster_keys_conv;
53385         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
53386         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
53387         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
53388         broadcaster_keys_conv.is_owned = false;
53389         LDKChannelPublicKeys countersignatory_keys_conv;
53390         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
53391         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
53392         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
53393         countersignatory_keys_conv.is_owned = false;
53394         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
53395         int64_t ret_ref = 0;
53396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53398         return ret_ref;
53399 }
53400
53401 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) {
53402         LDKPublicKey revocation_key_ref;
53403         CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
53404         (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
53405         LDKPublicKey broadcaster_delayed_payment_key_ref;
53406         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
53407         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
53408         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
53409         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53410         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53411         CVec_u8Z_free(ret_var);
53412         return ret_arr;
53413 }
53414
53415 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) {
53416         LDKChannelTypeFeatures channel_type_features_conv;
53417         channel_type_features_conv.inner = untag_ptr(channel_type_features);
53418         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
53419         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
53420         channel_type_features_conv.is_owned = false;
53421         LDKPublicKey payment_key_ref;
53422         CHECK((*env)->GetArrayLength(env, payment_key) == 33);
53423         (*env)->GetByteArrayRegion(env, payment_key, 0, 33, payment_key_ref.compressed_form);
53424         LDKCVec_u8Z ret_var = get_counterparty_payment_script(&channel_type_features_conv, payment_key_ref);
53425         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53426         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53427         CVec_u8Z_free(ret_var);
53428         return ret_arr;
53429 }
53430
53431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53432         LDKHTLCOutputInCommitment this_obj_conv;
53433         this_obj_conv.inner = untag_ptr(this_obj);
53434         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53436         HTLCOutputInCommitment_free(this_obj_conv);
53437 }
53438
53439 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
53440         LDKHTLCOutputInCommitment this_ptr_conv;
53441         this_ptr_conv.inner = untag_ptr(this_ptr);
53442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53444         this_ptr_conv.is_owned = false;
53445         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
53446         return ret_conv;
53447 }
53448
53449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
53450         LDKHTLCOutputInCommitment this_ptr_conv;
53451         this_ptr_conv.inner = untag_ptr(this_ptr);
53452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53454         this_ptr_conv.is_owned = false;
53455         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
53456 }
53457
53458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
53459         LDKHTLCOutputInCommitment this_ptr_conv;
53460         this_ptr_conv.inner = untag_ptr(this_ptr);
53461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53463         this_ptr_conv.is_owned = false;
53464         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
53465         return ret_conv;
53466 }
53467
53468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53469         LDKHTLCOutputInCommitment this_ptr_conv;
53470         this_ptr_conv.inner = untag_ptr(this_ptr);
53471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53473         this_ptr_conv.is_owned = false;
53474         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
53475 }
53476
53477 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
53478         LDKHTLCOutputInCommitment this_ptr_conv;
53479         this_ptr_conv.inner = untag_ptr(this_ptr);
53480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53482         this_ptr_conv.is_owned = false;
53483         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
53484         return ret_conv;
53485 }
53486
53487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
53488         LDKHTLCOutputInCommitment this_ptr_conv;
53489         this_ptr_conv.inner = untag_ptr(this_ptr);
53490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53492         this_ptr_conv.is_owned = false;
53493         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
53494 }
53495
53496 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
53497         LDKHTLCOutputInCommitment this_ptr_conv;
53498         this_ptr_conv.inner = untag_ptr(this_ptr);
53499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53501         this_ptr_conv.is_owned = false;
53502         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
53503         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
53504         return ret_arr;
53505 }
53506
53507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53508         LDKHTLCOutputInCommitment this_ptr_conv;
53509         this_ptr_conv.inner = untag_ptr(this_ptr);
53510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53512         this_ptr_conv.is_owned = false;
53513         LDKThirtyTwoBytes val_ref;
53514         CHECK((*env)->GetArrayLength(env, val) == 32);
53515         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
53516         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
53517 }
53518
53519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
53520         LDKHTLCOutputInCommitment this_ptr_conv;
53521         this_ptr_conv.inner = untag_ptr(this_ptr);
53522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53524         this_ptr_conv.is_owned = false;
53525         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
53526         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
53527         int64_t ret_ref = tag_ptr(ret_copy, true);
53528         return ret_ref;
53529 }
53530
53531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53532         LDKHTLCOutputInCommitment this_ptr_conv;
53533         this_ptr_conv.inner = untag_ptr(this_ptr);
53534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53536         this_ptr_conv.is_owned = false;
53537         void* val_ptr = untag_ptr(val);
53538         CHECK_ACCESS(val_ptr);
53539         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
53540         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
53541         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
53542 }
53543
53544 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) {
53545         LDKThirtyTwoBytes payment_hash_arg_ref;
53546         CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
53547         (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
53548         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
53549         CHECK_ACCESS(transaction_output_index_arg_ptr);
53550         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
53551         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
53552         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
53553         int64_t ret_ref = 0;
53554         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53555         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53556         return ret_ref;
53557 }
53558
53559 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
53560         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
53561         int64_t ret_ref = 0;
53562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53564         return ret_ref;
53565 }
53566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53567         LDKHTLCOutputInCommitment arg_conv;
53568         arg_conv.inner = untag_ptr(arg);
53569         arg_conv.is_owned = ptr_is_owned(arg);
53570         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53571         arg_conv.is_owned = false;
53572         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
53573         return ret_conv;
53574 }
53575
53576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53577         LDKHTLCOutputInCommitment orig_conv;
53578         orig_conv.inner = untag_ptr(orig);
53579         orig_conv.is_owned = ptr_is_owned(orig);
53580         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53581         orig_conv.is_owned = false;
53582         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
53583         int64_t ret_ref = 0;
53584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53586         return ret_ref;
53587 }
53588
53589 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53590         LDKHTLCOutputInCommitment a_conv;
53591         a_conv.inner = untag_ptr(a);
53592         a_conv.is_owned = ptr_is_owned(a);
53593         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53594         a_conv.is_owned = false;
53595         LDKHTLCOutputInCommitment b_conv;
53596         b_conv.inner = untag_ptr(b);
53597         b_conv.is_owned = ptr_is_owned(b);
53598         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53599         b_conv.is_owned = false;
53600         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
53601         return ret_conv;
53602 }
53603
53604 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
53605         LDKHTLCOutputInCommitment obj_conv;
53606         obj_conv.inner = untag_ptr(obj);
53607         obj_conv.is_owned = ptr_is_owned(obj);
53608         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53609         obj_conv.is_owned = false;
53610         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
53611         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53612         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53613         CVec_u8Z_free(ret_var);
53614         return ret_arr;
53615 }
53616
53617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
53618         LDKu8slice ser_ref;
53619         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
53620         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
53621         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
53622         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
53623         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
53624         return tag_ptr(ret_conv, true);
53625 }
53626
53627 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) {
53628         LDKHTLCOutputInCommitment htlc_conv;
53629         htlc_conv.inner = untag_ptr(htlc);
53630         htlc_conv.is_owned = ptr_is_owned(htlc);
53631         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
53632         htlc_conv.is_owned = false;
53633         LDKChannelTypeFeatures channel_type_features_conv;
53634         channel_type_features_conv.inner = untag_ptr(channel_type_features);
53635         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
53636         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
53637         channel_type_features_conv.is_owned = false;
53638         LDKTxCreationKeys keys_conv;
53639         keys_conv.inner = untag_ptr(keys);
53640         keys_conv.is_owned = ptr_is_owned(keys);
53641         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
53642         keys_conv.is_owned = false;
53643         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &channel_type_features_conv, &keys_conv);
53644         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53645         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53646         CVec_u8Z_free(ret_var);
53647         return ret_arr;
53648 }
53649
53650 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
53651         LDKPublicKey broadcaster_ref;
53652         CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
53653         (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
53654         LDKPublicKey countersignatory_ref;
53655         CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
53656         (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
53657         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
53658         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53659         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53660         CVec_u8Z_free(ret_var);
53661         return ret_arr;
53662 }
53663
53664 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) {
53665         uint8_t commitment_txid_arr[32];
53666         CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
53667         (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
53668         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
53669         LDKHTLCOutputInCommitment htlc_conv;
53670         htlc_conv.inner = untag_ptr(htlc);
53671         htlc_conv.is_owned = ptr_is_owned(htlc);
53672         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
53673         htlc_conv.is_owned = false;
53674         LDKChannelTypeFeatures channel_type_features_conv;
53675         channel_type_features_conv.inner = untag_ptr(channel_type_features);
53676         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
53677         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
53678         channel_type_features_conv.is_owned = false;
53679         LDKPublicKey broadcaster_delayed_payment_key_ref;
53680         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
53681         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
53682         LDKPublicKey revocation_key_ref;
53683         CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
53684         (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
53685         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);
53686         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53687         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53688         Transaction_free(ret_var);
53689         return ret_arr;
53690 }
53691
53692 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) {
53693         LDKECDSASignature local_sig_ref;
53694         CHECK((*env)->GetArrayLength(env, local_sig) == 64);
53695         (*env)->GetByteArrayRegion(env, local_sig, 0, 64, local_sig_ref.compact_form);
53696         LDKECDSASignature remote_sig_ref;
53697         CHECK((*env)->GetArrayLength(env, remote_sig) == 64);
53698         (*env)->GetByteArrayRegion(env, remote_sig, 0, 64, remote_sig_ref.compact_form);
53699         void* preimage_ptr = untag_ptr(preimage);
53700         CHECK_ACCESS(preimage_ptr);
53701         LDKCOption_ThirtyTwoBytesZ preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(preimage_ptr);
53702         preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(preimage));
53703         LDKu8slice redeem_script_ref;
53704         redeem_script_ref.datalen = (*env)->GetArrayLength(env, redeem_script);
53705         redeem_script_ref.data = (*env)->GetByteArrayElements (env, redeem_script, NULL);
53706         LDKChannelTypeFeatures channel_type_features_conv;
53707         channel_type_features_conv.inner = untag_ptr(channel_type_features);
53708         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
53709         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
53710         channel_type_features_conv.is_owned = false;
53711         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_conv, redeem_script_ref, &channel_type_features_conv);
53712         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53713         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53714         Witness_free(ret_var);
53715         (*env)->ReleaseByteArrayElements(env, redeem_script, (int8_t*)redeem_script_ref.data, 0);
53716         return ret_arr;
53717 }
53718
53719 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1to_1countersignatory_1with_1anchors_1redeemscript(JNIEnv *env, jclass clz, int8_tArray payment_point) {
53720         LDKPublicKey payment_point_ref;
53721         CHECK((*env)->GetArrayLength(env, payment_point) == 33);
53722         (*env)->GetByteArrayRegion(env, payment_point, 0, 33, payment_point_ref.compressed_form);
53723         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
53724         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53725         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53726         CVec_u8Z_free(ret_var);
53727         return ret_arr;
53728 }
53729
53730 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1anchor_1redeemscript(JNIEnv *env, jclass clz, int8_tArray funding_pubkey) {
53731         LDKPublicKey funding_pubkey_ref;
53732         CHECK((*env)->GetArrayLength(env, funding_pubkey) == 33);
53733         (*env)->GetByteArrayRegion(env, funding_pubkey, 0, 33, funding_pubkey_ref.compressed_form);
53734         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
53735         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53736         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53737         CVec_u8Z_free(ret_var);
53738         return ret_arr;
53739 }
53740
53741 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) {
53742         LDKPublicKey funding_key_ref;
53743         CHECK((*env)->GetArrayLength(env, funding_key) == 33);
53744         (*env)->GetByteArrayRegion(env, funding_key, 0, 33, funding_key_ref.compressed_form);
53745         LDKECDSASignature funding_sig_ref;
53746         CHECK((*env)->GetArrayLength(env, funding_sig) == 64);
53747         (*env)->GetByteArrayRegion(env, funding_sig, 0, 64, funding_sig_ref.compact_form);
53748         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
53749         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53750         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53751         Witness_free(ret_var);
53752         return ret_arr;
53753 }
53754
53755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53756         LDKChannelTransactionParameters this_obj_conv;
53757         this_obj_conv.inner = untag_ptr(this_obj);
53758         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53760         ChannelTransactionParameters_free(this_obj_conv);
53761 }
53762
53763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
53764         LDKChannelTransactionParameters this_ptr_conv;
53765         this_ptr_conv.inner = untag_ptr(this_ptr);
53766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53768         this_ptr_conv.is_owned = false;
53769         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
53770         int64_t ret_ref = 0;
53771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53773         return ret_ref;
53774 }
53775
53776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53777         LDKChannelTransactionParameters this_ptr_conv;
53778         this_ptr_conv.inner = untag_ptr(this_ptr);
53779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53781         this_ptr_conv.is_owned = false;
53782         LDKChannelPublicKeys val_conv;
53783         val_conv.inner = untag_ptr(val);
53784         val_conv.is_owned = ptr_is_owned(val);
53785         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53786         val_conv = ChannelPublicKeys_clone(&val_conv);
53787         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
53788 }
53789
53790 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
53791         LDKChannelTransactionParameters this_ptr_conv;
53792         this_ptr_conv.inner = untag_ptr(this_ptr);
53793         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53795         this_ptr_conv.is_owned = false;
53796         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
53797         return ret_conv;
53798 }
53799
53800 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) {
53801         LDKChannelTransactionParameters this_ptr_conv;
53802         this_ptr_conv.inner = untag_ptr(this_ptr);
53803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53805         this_ptr_conv.is_owned = false;
53806         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
53807 }
53808
53809 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
53810         LDKChannelTransactionParameters this_ptr_conv;
53811         this_ptr_conv.inner = untag_ptr(this_ptr);
53812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53814         this_ptr_conv.is_owned = false;
53815         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
53816         return ret_conv;
53817 }
53818
53819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
53820         LDKChannelTransactionParameters this_ptr_conv;
53821         this_ptr_conv.inner = untag_ptr(this_ptr);
53822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53824         this_ptr_conv.is_owned = false;
53825         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
53826 }
53827
53828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
53829         LDKChannelTransactionParameters this_ptr_conv;
53830         this_ptr_conv.inner = untag_ptr(this_ptr);
53831         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53833         this_ptr_conv.is_owned = false;
53834         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
53835         int64_t ret_ref = 0;
53836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53838         return ret_ref;
53839 }
53840
53841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53842         LDKChannelTransactionParameters 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         LDKCounterpartyChannelTransactionParameters val_conv;
53848         val_conv.inner = untag_ptr(val);
53849         val_conv.is_owned = ptr_is_owned(val);
53850         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53851         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
53852         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
53853 }
53854
53855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
53856         LDKChannelTransactionParameters this_ptr_conv;
53857         this_ptr_conv.inner = untag_ptr(this_ptr);
53858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53860         this_ptr_conv.is_owned = false;
53861         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
53862         int64_t ret_ref = 0;
53863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53865         return ret_ref;
53866 }
53867
53868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53869         LDKChannelTransactionParameters this_ptr_conv;
53870         this_ptr_conv.inner = untag_ptr(this_ptr);
53871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53873         this_ptr_conv.is_owned = false;
53874         LDKOutPoint val_conv;
53875         val_conv.inner = untag_ptr(val);
53876         val_conv.is_owned = ptr_is_owned(val);
53877         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53878         val_conv = OutPoint_clone(&val_conv);
53879         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
53880 }
53881
53882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
53883         LDKChannelTransactionParameters this_ptr_conv;
53884         this_ptr_conv.inner = untag_ptr(this_ptr);
53885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53887         this_ptr_conv.is_owned = false;
53888         LDKChannelTypeFeatures ret_var = ChannelTransactionParameters_get_channel_type_features(&this_ptr_conv);
53889         int64_t ret_ref = 0;
53890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53892         return ret_ref;
53893 }
53894
53895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53896         LDKChannelTransactionParameters this_ptr_conv;
53897         this_ptr_conv.inner = untag_ptr(this_ptr);
53898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53900         this_ptr_conv.is_owned = false;
53901         LDKChannelTypeFeatures val_conv;
53902         val_conv.inner = untag_ptr(val);
53903         val_conv.is_owned = ptr_is_owned(val);
53904         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53905         val_conv = ChannelTypeFeatures_clone(&val_conv);
53906         ChannelTransactionParameters_set_channel_type_features(&this_ptr_conv, val_conv);
53907 }
53908
53909 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) {
53910         LDKChannelPublicKeys holder_pubkeys_arg_conv;
53911         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
53912         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
53913         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
53914         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
53915         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
53916         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
53917         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
53918         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
53919         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
53920         LDKOutPoint funding_outpoint_arg_conv;
53921         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
53922         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
53923         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
53924         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
53925         LDKChannelTypeFeatures channel_type_features_arg_conv;
53926         channel_type_features_arg_conv.inner = untag_ptr(channel_type_features_arg);
53927         channel_type_features_arg_conv.is_owned = ptr_is_owned(channel_type_features_arg);
53928         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_arg_conv);
53929         channel_type_features_arg_conv = ChannelTypeFeatures_clone(&channel_type_features_arg_conv);
53930         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);
53931         int64_t ret_ref = 0;
53932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53934         return ret_ref;
53935 }
53936
53937 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
53938         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
53939         int64_t ret_ref = 0;
53940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53942         return ret_ref;
53943 }
53944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53945         LDKChannelTransactionParameters arg_conv;
53946         arg_conv.inner = untag_ptr(arg);
53947         arg_conv.is_owned = ptr_is_owned(arg);
53948         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53949         arg_conv.is_owned = false;
53950         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
53951         return ret_conv;
53952 }
53953
53954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53955         LDKChannelTransactionParameters orig_conv;
53956         orig_conv.inner = untag_ptr(orig);
53957         orig_conv.is_owned = ptr_is_owned(orig);
53958         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53959         orig_conv.is_owned = false;
53960         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
53961         int64_t ret_ref = 0;
53962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53964         return ret_ref;
53965 }
53966
53967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
53968         LDKChannelTransactionParameters o_conv;
53969         o_conv.inner = untag_ptr(o);
53970         o_conv.is_owned = ptr_is_owned(o);
53971         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53972         o_conv.is_owned = false;
53973         int64_t ret_conv = ChannelTransactionParameters_hash(&o_conv);
53974         return ret_conv;
53975 }
53976
53977 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53978         LDKChannelTransactionParameters a_conv;
53979         a_conv.inner = untag_ptr(a);
53980         a_conv.is_owned = ptr_is_owned(a);
53981         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53982         a_conv.is_owned = false;
53983         LDKChannelTransactionParameters b_conv;
53984         b_conv.inner = untag_ptr(b);
53985         b_conv.is_owned = ptr_is_owned(b);
53986         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53987         b_conv.is_owned = false;
53988         jboolean ret_conv = ChannelTransactionParameters_eq(&a_conv, &b_conv);
53989         return ret_conv;
53990 }
53991
53992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53993         LDKCounterpartyChannelTransactionParameters this_obj_conv;
53994         this_obj_conv.inner = untag_ptr(this_obj);
53995         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53997         CounterpartyChannelTransactionParameters_free(this_obj_conv);
53998 }
53999
54000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
54001         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
54002         this_ptr_conv.inner = untag_ptr(this_ptr);
54003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54005         this_ptr_conv.is_owned = false;
54006         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
54007         int64_t ret_ref = 0;
54008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54010         return ret_ref;
54011 }
54012
54013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54014         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
54015         this_ptr_conv.inner = untag_ptr(this_ptr);
54016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54018         this_ptr_conv.is_owned = false;
54019         LDKChannelPublicKeys val_conv;
54020         val_conv.inner = untag_ptr(val);
54021         val_conv.is_owned = ptr_is_owned(val);
54022         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54023         val_conv = ChannelPublicKeys_clone(&val_conv);
54024         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
54025 }
54026
54027 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
54028         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
54029         this_ptr_conv.inner = untag_ptr(this_ptr);
54030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54032         this_ptr_conv.is_owned = false;
54033         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
54034         return ret_conv;
54035 }
54036
54037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
54038         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
54039         this_ptr_conv.inner = untag_ptr(this_ptr);
54040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54042         this_ptr_conv.is_owned = false;
54043         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
54044 }
54045
54046 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) {
54047         LDKChannelPublicKeys pubkeys_arg_conv;
54048         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
54049         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
54050         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
54051         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
54052         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
54053         int64_t ret_ref = 0;
54054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54055         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54056         return ret_ref;
54057 }
54058
54059 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
54060         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
54061         int64_t ret_ref = 0;
54062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54064         return ret_ref;
54065 }
54066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54067         LDKCounterpartyChannelTransactionParameters arg_conv;
54068         arg_conv.inner = untag_ptr(arg);
54069         arg_conv.is_owned = ptr_is_owned(arg);
54070         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54071         arg_conv.is_owned = false;
54072         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
54073         return ret_conv;
54074 }
54075
54076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54077         LDKCounterpartyChannelTransactionParameters orig_conv;
54078         orig_conv.inner = untag_ptr(orig);
54079         orig_conv.is_owned = ptr_is_owned(orig);
54080         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54081         orig_conv.is_owned = false;
54082         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
54083         int64_t ret_ref = 0;
54084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54086         return ret_ref;
54087 }
54088
54089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
54090         LDKCounterpartyChannelTransactionParameters o_conv;
54091         o_conv.inner = untag_ptr(o);
54092         o_conv.is_owned = ptr_is_owned(o);
54093         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54094         o_conv.is_owned = false;
54095         int64_t ret_conv = CounterpartyChannelTransactionParameters_hash(&o_conv);
54096         return ret_conv;
54097 }
54098
54099 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54100         LDKCounterpartyChannelTransactionParameters a_conv;
54101         a_conv.inner = untag_ptr(a);
54102         a_conv.is_owned = ptr_is_owned(a);
54103         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54104         a_conv.is_owned = false;
54105         LDKCounterpartyChannelTransactionParameters b_conv;
54106         b_conv.inner = untag_ptr(b);
54107         b_conv.is_owned = ptr_is_owned(b);
54108         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54109         b_conv.is_owned = false;
54110         jboolean ret_conv = CounterpartyChannelTransactionParameters_eq(&a_conv, &b_conv);
54111         return ret_conv;
54112 }
54113
54114 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
54115         LDKChannelTransactionParameters this_arg_conv;
54116         this_arg_conv.inner = untag_ptr(this_arg);
54117         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54119         this_arg_conv.is_owned = false;
54120         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
54121         return ret_conv;
54122 }
54123
54124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
54125         LDKChannelTransactionParameters this_arg_conv;
54126         this_arg_conv.inner = untag_ptr(this_arg);
54127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54129         this_arg_conv.is_owned = false;
54130         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
54131         int64_t ret_ref = 0;
54132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54134         return ret_ref;
54135 }
54136
54137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
54138         LDKChannelTransactionParameters this_arg_conv;
54139         this_arg_conv.inner = untag_ptr(this_arg);
54140         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54142         this_arg_conv.is_owned = false;
54143         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
54144         int64_t ret_ref = 0;
54145         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54146         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54147         return ret_ref;
54148 }
54149
54150 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
54151         LDKCounterpartyChannelTransactionParameters obj_conv;
54152         obj_conv.inner = untag_ptr(obj);
54153         obj_conv.is_owned = ptr_is_owned(obj);
54154         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54155         obj_conv.is_owned = false;
54156         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
54157         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54158         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54159         CVec_u8Z_free(ret_var);
54160         return ret_arr;
54161 }
54162
54163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
54164         LDKu8slice ser_ref;
54165         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
54166         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
54167         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
54168         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
54169         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
54170         return tag_ptr(ret_conv, true);
54171 }
54172
54173 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
54174         LDKChannelTransactionParameters obj_conv;
54175         obj_conv.inner = untag_ptr(obj);
54176         obj_conv.is_owned = ptr_is_owned(obj);
54177         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54178         obj_conv.is_owned = false;
54179         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
54180         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54181         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54182         CVec_u8Z_free(ret_var);
54183         return ret_arr;
54184 }
54185
54186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
54187         LDKu8slice ser_ref;
54188         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
54189         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
54190         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
54191         *ret_conv = ChannelTransactionParameters_read(ser_ref);
54192         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
54193         return tag_ptr(ret_conv, true);
54194 }
54195
54196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54197         LDKDirectedChannelTransactionParameters this_obj_conv;
54198         this_obj_conv.inner = untag_ptr(this_obj);
54199         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54201         DirectedChannelTransactionParameters_free(this_obj_conv);
54202 }
54203
54204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
54205         LDKDirectedChannelTransactionParameters this_arg_conv;
54206         this_arg_conv.inner = untag_ptr(this_arg);
54207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54209         this_arg_conv.is_owned = false;
54210         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
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
54217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
54218         LDKDirectedChannelTransactionParameters this_arg_conv;
54219         this_arg_conv.inner = untag_ptr(this_arg);
54220         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54222         this_arg_conv.is_owned = false;
54223         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
54224         int64_t ret_ref = 0;
54225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54227         return ret_ref;
54228 }
54229
54230 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
54231         LDKDirectedChannelTransactionParameters this_arg_conv;
54232         this_arg_conv.inner = untag_ptr(this_arg);
54233         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54235         this_arg_conv.is_owned = false;
54236         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
54237         return ret_conv;
54238 }
54239
54240 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
54241         LDKDirectedChannelTransactionParameters this_arg_conv;
54242         this_arg_conv.inner = untag_ptr(this_arg);
54243         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54245         this_arg_conv.is_owned = false;
54246         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
54247         return ret_conv;
54248 }
54249
54250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
54251         LDKDirectedChannelTransactionParameters this_arg_conv;
54252         this_arg_conv.inner = untag_ptr(this_arg);
54253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54255         this_arg_conv.is_owned = false;
54256         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
54257         int64_t ret_ref = 0;
54258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54260         return ret_ref;
54261 }
54262
54263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
54264         LDKDirectedChannelTransactionParameters this_arg_conv;
54265         this_arg_conv.inner = untag_ptr(this_arg);
54266         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54268         this_arg_conv.is_owned = false;
54269         LDKChannelTypeFeatures ret_var = DirectedChannelTransactionParameters_channel_type_features(&this_arg_conv);
54270         int64_t ret_ref = 0;
54271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54273         return ret_ref;
54274 }
54275
54276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54277         LDKHolderCommitmentTransaction this_obj_conv;
54278         this_obj_conv.inner = untag_ptr(this_obj);
54279         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54281         HolderCommitmentTransaction_free(this_obj_conv);
54282 }
54283
54284 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
54285         LDKHolderCommitmentTransaction this_ptr_conv;
54286         this_ptr_conv.inner = untag_ptr(this_ptr);
54287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54289         this_ptr_conv.is_owned = false;
54290         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
54291         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
54292         return ret_arr;
54293 }
54294
54295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54296         LDKHolderCommitmentTransaction this_ptr_conv;
54297         this_ptr_conv.inner = untag_ptr(this_ptr);
54298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54300         this_ptr_conv.is_owned = false;
54301         LDKECDSASignature val_ref;
54302         CHECK((*env)->GetArrayLength(env, val) == 64);
54303         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
54304         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
54305 }
54306
54307 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr) {
54308         LDKHolderCommitmentTransaction this_ptr_conv;
54309         this_ptr_conv.inner = untag_ptr(this_ptr);
54310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54312         this_ptr_conv.is_owned = false;
54313         LDKCVec_ECDSASignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
54314         jobjectArray ret_arr = NULL;
54315         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
54316         ;
54317         for (size_t i = 0; i < ret_var.datalen; i++) {
54318                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
54319                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
54320                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
54321         }
54322         
54323         FREE(ret_var.data);
54324         return ret_arr;
54325 }
54326
54327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
54328         LDKHolderCommitmentTransaction this_ptr_conv;
54329         this_ptr_conv.inner = untag_ptr(this_ptr);
54330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54332         this_ptr_conv.is_owned = false;
54333         LDKCVec_ECDSASignatureZ val_constr;
54334         val_constr.datalen = (*env)->GetArrayLength(env, val);
54335         if (val_constr.datalen > 0)
54336                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
54337         else
54338                 val_constr.data = NULL;
54339         for (size_t i = 0; i < val_constr.datalen; i++) {
54340                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
54341                 LDKECDSASignature val_conv_8_ref;
54342                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
54343                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
54344                 val_constr.data[i] = val_conv_8_ref;
54345         }
54346         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
54347 }
54348
54349 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
54350         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
54351         int64_t ret_ref = 0;
54352         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54353         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54354         return ret_ref;
54355 }
54356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54357         LDKHolderCommitmentTransaction arg_conv;
54358         arg_conv.inner = untag_ptr(arg);
54359         arg_conv.is_owned = ptr_is_owned(arg);
54360         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54361         arg_conv.is_owned = false;
54362         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
54363         return ret_conv;
54364 }
54365
54366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54367         LDKHolderCommitmentTransaction orig_conv;
54368         orig_conv.inner = untag_ptr(orig);
54369         orig_conv.is_owned = ptr_is_owned(orig);
54370         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54371         orig_conv.is_owned = false;
54372         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
54373         int64_t ret_ref = 0;
54374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54376         return ret_ref;
54377 }
54378
54379 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
54380         LDKHolderCommitmentTransaction obj_conv;
54381         obj_conv.inner = untag_ptr(obj);
54382         obj_conv.is_owned = ptr_is_owned(obj);
54383         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54384         obj_conv.is_owned = false;
54385         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
54386         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54387         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54388         CVec_u8Z_free(ret_var);
54389         return ret_arr;
54390 }
54391
54392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
54393         LDKu8slice ser_ref;
54394         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
54395         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
54396         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
54397         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
54398         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
54399         return tag_ptr(ret_conv, true);
54400 }
54401
54402 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) {
54403         LDKCommitmentTransaction commitment_tx_conv;
54404         commitment_tx_conv.inner = untag_ptr(commitment_tx);
54405         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
54406         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
54407         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
54408         LDKECDSASignature counterparty_sig_ref;
54409         CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
54410         (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
54411         LDKCVec_ECDSASignatureZ counterparty_htlc_sigs_constr;
54412         counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
54413         if (counterparty_htlc_sigs_constr.datalen > 0)
54414                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
54415         else
54416                 counterparty_htlc_sigs_constr.data = NULL;
54417         for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
54418                 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
54419                 LDKECDSASignature counterparty_htlc_sigs_conv_8_ref;
54420                 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
54421                 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
54422                 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
54423         }
54424         LDKPublicKey holder_funding_key_ref;
54425         CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
54426         (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
54427         LDKPublicKey counterparty_funding_key_ref;
54428         CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
54429         (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
54430         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
54431         int64_t ret_ref = 0;
54432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54434         return ret_ref;
54435 }
54436
54437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54438         LDKBuiltCommitmentTransaction this_obj_conv;
54439         this_obj_conv.inner = untag_ptr(this_obj);
54440         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54442         BuiltCommitmentTransaction_free(this_obj_conv);
54443 }
54444
54445 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
54446         LDKBuiltCommitmentTransaction this_ptr_conv;
54447         this_ptr_conv.inner = untag_ptr(this_ptr);
54448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54450         this_ptr_conv.is_owned = false;
54451         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
54452         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54453         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54454         Transaction_free(ret_var);
54455         return ret_arr;
54456 }
54457
54458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54459         LDKBuiltCommitmentTransaction this_ptr_conv;
54460         this_ptr_conv.inner = untag_ptr(this_ptr);
54461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54463         this_ptr_conv.is_owned = false;
54464         LDKTransaction val_ref;
54465         val_ref.datalen = (*env)->GetArrayLength(env, val);
54466         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
54467         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
54468         val_ref.data_is_owned = true;
54469         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
54470 }
54471
54472 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
54473         LDKBuiltCommitmentTransaction this_ptr_conv;
54474         this_ptr_conv.inner = untag_ptr(this_ptr);
54475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54477         this_ptr_conv.is_owned = false;
54478         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
54479         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
54480         return ret_arr;
54481 }
54482
54483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54484         LDKBuiltCommitmentTransaction this_ptr_conv;
54485         this_ptr_conv.inner = untag_ptr(this_ptr);
54486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54488         this_ptr_conv.is_owned = false;
54489         LDKThirtyTwoBytes val_ref;
54490         CHECK((*env)->GetArrayLength(env, val) == 32);
54491         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
54492         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
54493 }
54494
54495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
54496         LDKTransaction transaction_arg_ref;
54497         transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
54498         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
54499         (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
54500         transaction_arg_ref.data_is_owned = true;
54501         LDKThirtyTwoBytes txid_arg_ref;
54502         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
54503         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
54504         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
54505         int64_t ret_ref = 0;
54506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54508         return ret_ref;
54509 }
54510
54511 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
54512         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
54513         int64_t ret_ref = 0;
54514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54516         return ret_ref;
54517 }
54518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54519         LDKBuiltCommitmentTransaction arg_conv;
54520         arg_conv.inner = untag_ptr(arg);
54521         arg_conv.is_owned = ptr_is_owned(arg);
54522         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54523         arg_conv.is_owned = false;
54524         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
54525         return ret_conv;
54526 }
54527
54528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54529         LDKBuiltCommitmentTransaction orig_conv;
54530         orig_conv.inner = untag_ptr(orig);
54531         orig_conv.is_owned = ptr_is_owned(orig);
54532         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54533         orig_conv.is_owned = false;
54534         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
54535         int64_t ret_ref = 0;
54536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54538         return ret_ref;
54539 }
54540
54541 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
54542         LDKBuiltCommitmentTransaction obj_conv;
54543         obj_conv.inner = untag_ptr(obj);
54544         obj_conv.is_owned = ptr_is_owned(obj);
54545         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54546         obj_conv.is_owned = false;
54547         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
54548         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54549         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54550         CVec_u8Z_free(ret_var);
54551         return ret_arr;
54552 }
54553
54554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
54555         LDKu8slice ser_ref;
54556         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
54557         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
54558         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
54559         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
54560         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
54561         return tag_ptr(ret_conv, true);
54562 }
54563
54564 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) {
54565         LDKBuiltCommitmentTransaction this_arg_conv;
54566         this_arg_conv.inner = untag_ptr(this_arg);
54567         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54569         this_arg_conv.is_owned = false;
54570         LDKu8slice funding_redeemscript_ref;
54571         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
54572         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
54573         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
54574         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
54575         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
54576         return ret_arr;
54577 }
54578
54579 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) {
54580         LDKBuiltCommitmentTransaction this_arg_conv;
54581         this_arg_conv.inner = untag_ptr(this_arg);
54582         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54584         this_arg_conv.is_owned = false;
54585         uint8_t funding_key_arr[32];
54586         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
54587         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
54588         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
54589         LDKu8slice funding_redeemscript_ref;
54590         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
54591         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
54592         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
54593         (*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);
54594         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
54595         return ret_arr;
54596 }
54597
54598 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) {
54599         LDKBuiltCommitmentTransaction this_arg_conv;
54600         this_arg_conv.inner = untag_ptr(this_arg);
54601         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54603         this_arg_conv.is_owned = false;
54604         uint8_t funding_key_arr[32];
54605         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
54606         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
54607         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
54608         LDKu8slice funding_redeemscript_ref;
54609         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
54610         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
54611         void* entropy_source_ptr = untag_ptr(entropy_source);
54612         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
54613         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
54614         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
54615         (*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);
54616         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
54617         return ret_arr;
54618 }
54619
54620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54621         LDKClosingTransaction this_obj_conv;
54622         this_obj_conv.inner = untag_ptr(this_obj);
54623         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54625         ClosingTransaction_free(this_obj_conv);
54626 }
54627
54628 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
54629         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
54630         int64_t ret_ref = 0;
54631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54633         return ret_ref;
54634 }
54635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54636         LDKClosingTransaction arg_conv;
54637         arg_conv.inner = untag_ptr(arg);
54638         arg_conv.is_owned = ptr_is_owned(arg);
54639         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54640         arg_conv.is_owned = false;
54641         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
54642         return ret_conv;
54643 }
54644
54645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54646         LDKClosingTransaction orig_conv;
54647         orig_conv.inner = untag_ptr(orig);
54648         orig_conv.is_owned = ptr_is_owned(orig);
54649         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54650         orig_conv.is_owned = false;
54651         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
54652         int64_t ret_ref = 0;
54653         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54654         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54655         return ret_ref;
54656 }
54657
54658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1hash(JNIEnv *env, jclass clz, int64_t o) {
54659         LDKClosingTransaction o_conv;
54660         o_conv.inner = untag_ptr(o);
54661         o_conv.is_owned = ptr_is_owned(o);
54662         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54663         o_conv.is_owned = false;
54664         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
54665         return ret_conv;
54666 }
54667
54668 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54669         LDKClosingTransaction a_conv;
54670         a_conv.inner = untag_ptr(a);
54671         a_conv.is_owned = ptr_is_owned(a);
54672         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54673         a_conv.is_owned = false;
54674         LDKClosingTransaction b_conv;
54675         b_conv.inner = untag_ptr(b);
54676         b_conv.is_owned = ptr_is_owned(b);
54677         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54678         b_conv.is_owned = false;
54679         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
54680         return ret_conv;
54681 }
54682
54683 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) {
54684         LDKCVec_u8Z to_holder_script_ref;
54685         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
54686         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
54687         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
54688         LDKCVec_u8Z to_counterparty_script_ref;
54689         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
54690         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
54691         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
54692         LDKOutPoint funding_outpoint_conv;
54693         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
54694         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
54695         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
54696         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
54697         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
54698         int64_t ret_ref = 0;
54699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54701         return ret_ref;
54702 }
54703
54704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
54705         LDKClosingTransaction this_arg_conv;
54706         this_arg_conv.inner = untag_ptr(this_arg);
54707         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54709         this_arg_conv.is_owned = false;
54710         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
54711         int64_t ret_ref = 0;
54712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54714         return ret_ref;
54715 }
54716
54717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
54718         LDKClosingTransaction this_arg_conv;
54719         this_arg_conv.inner = untag_ptr(this_arg);
54720         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54722         this_arg_conv.is_owned = false;
54723         LDKOutPoint funding_outpoint_conv;
54724         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
54725         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
54726         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
54727         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
54728         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
54729         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
54730         return tag_ptr(ret_conv, true);
54731 }
54732
54733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
54734         LDKClosingTransaction this_arg_conv;
54735         this_arg_conv.inner = untag_ptr(this_arg);
54736         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54738         this_arg_conv.is_owned = false;
54739         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
54740         return ret_conv;
54741 }
54742
54743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
54744         LDKClosingTransaction this_arg_conv;
54745         this_arg_conv.inner = untag_ptr(this_arg);
54746         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54748         this_arg_conv.is_owned = false;
54749         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
54750         return ret_conv;
54751 }
54752
54753 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
54754         LDKClosingTransaction this_arg_conv;
54755         this_arg_conv.inner = untag_ptr(this_arg);
54756         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54758         this_arg_conv.is_owned = false;
54759         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
54760         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54761         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54762         return ret_arr;
54763 }
54764
54765 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
54766         LDKClosingTransaction this_arg_conv;
54767         this_arg_conv.inner = untag_ptr(this_arg);
54768         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54770         this_arg_conv.is_owned = false;
54771         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
54772         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54773         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54774         return ret_arr;
54775 }
54776
54777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54778         LDKTrustedClosingTransaction this_obj_conv;
54779         this_obj_conv.inner = untag_ptr(this_obj);
54780         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54782         TrustedClosingTransaction_free(this_obj_conv);
54783 }
54784
54785 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
54786         LDKTrustedClosingTransaction this_arg_conv;
54787         this_arg_conv.inner = untag_ptr(this_arg);
54788         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54790         this_arg_conv.is_owned = false;
54791         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
54792         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54793         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54794         Transaction_free(ret_var);
54795         return ret_arr;
54796 }
54797
54798 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) {
54799         LDKTrustedClosingTransaction this_arg_conv;
54800         this_arg_conv.inner = untag_ptr(this_arg);
54801         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54803         this_arg_conv.is_owned = false;
54804         LDKu8slice funding_redeemscript_ref;
54805         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
54806         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
54807         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
54808         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
54809         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
54810         return ret_arr;
54811 }
54812
54813 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) {
54814         LDKTrustedClosingTransaction this_arg_conv;
54815         this_arg_conv.inner = untag_ptr(this_arg);
54816         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54818         this_arg_conv.is_owned = false;
54819         uint8_t funding_key_arr[32];
54820         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
54821         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
54822         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
54823         LDKu8slice funding_redeemscript_ref;
54824         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
54825         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
54826         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
54827         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
54828         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
54829         return ret_arr;
54830 }
54831
54832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54833         LDKCommitmentTransaction this_obj_conv;
54834         this_obj_conv.inner = untag_ptr(this_obj);
54835         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54837         CommitmentTransaction_free(this_obj_conv);
54838 }
54839
54840 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
54841         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
54842         int64_t ret_ref = 0;
54843         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54844         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54845         return ret_ref;
54846 }
54847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54848         LDKCommitmentTransaction arg_conv;
54849         arg_conv.inner = untag_ptr(arg);
54850         arg_conv.is_owned = ptr_is_owned(arg);
54851         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54852         arg_conv.is_owned = false;
54853         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
54854         return ret_conv;
54855 }
54856
54857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54858         LDKCommitmentTransaction orig_conv;
54859         orig_conv.inner = untag_ptr(orig);
54860         orig_conv.is_owned = ptr_is_owned(orig);
54861         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54862         orig_conv.is_owned = false;
54863         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
54864         int64_t ret_ref = 0;
54865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54867         return ret_ref;
54868 }
54869
54870 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
54871         LDKCommitmentTransaction obj_conv;
54872         obj_conv.inner = untag_ptr(obj);
54873         obj_conv.is_owned = ptr_is_owned(obj);
54874         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54875         obj_conv.is_owned = false;
54876         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
54877         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54878         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54879         CVec_u8Z_free(ret_var);
54880         return ret_arr;
54881 }
54882
54883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
54884         LDKu8slice ser_ref;
54885         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
54886         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
54887         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
54888         *ret_conv = CommitmentTransaction_read(ser_ref);
54889         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
54890         return tag_ptr(ret_conv, true);
54891 }
54892
54893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
54894         LDKCommitmentTransaction this_arg_conv;
54895         this_arg_conv.inner = untag_ptr(this_arg);
54896         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54898         this_arg_conv.is_owned = false;
54899         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
54900         return ret_conv;
54901 }
54902
54903 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_arg) {
54904         LDKCommitmentTransaction this_arg_conv;
54905         this_arg_conv.inner = untag_ptr(this_arg);
54906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54908         this_arg_conv.is_owned = false;
54909         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
54910         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommitmentTransaction_per_commitment_point(&this_arg_conv).compressed_form);
54911         return ret_arr;
54912 }
54913
54914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
54915         LDKCommitmentTransaction this_arg_conv;
54916         this_arg_conv.inner = untag_ptr(this_arg);
54917         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54919         this_arg_conv.is_owned = false;
54920         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
54921         return ret_conv;
54922 }
54923
54924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
54925         LDKCommitmentTransaction this_arg_conv;
54926         this_arg_conv.inner = untag_ptr(this_arg);
54927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54929         this_arg_conv.is_owned = false;
54930         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
54931         return ret_conv;
54932 }
54933
54934 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
54935         LDKCommitmentTransaction this_arg_conv;
54936         this_arg_conv.inner = untag_ptr(this_arg);
54937         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54939         this_arg_conv.is_owned = false;
54940         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
54941         return ret_conv;
54942 }
54943
54944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
54945         LDKCommitmentTransaction this_arg_conv;
54946         this_arg_conv.inner = untag_ptr(this_arg);
54947         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54949         this_arg_conv.is_owned = false;
54950         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
54951         int64_t ret_ref = 0;
54952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54954         return ret_ref;
54955 }
54956
54957 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) {
54958         LDKCommitmentTransaction this_arg_conv;
54959         this_arg_conv.inner = untag_ptr(this_arg);
54960         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54962         this_arg_conv.is_owned = false;
54963         LDKDirectedChannelTransactionParameters channel_parameters_conv;
54964         channel_parameters_conv.inner = untag_ptr(channel_parameters);
54965         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
54966         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
54967         channel_parameters_conv.is_owned = false;
54968         LDKChannelPublicKeys broadcaster_keys_conv;
54969         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
54970         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
54971         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
54972         broadcaster_keys_conv.is_owned = false;
54973         LDKChannelPublicKeys countersignatory_keys_conv;
54974         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
54975         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
54976         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
54977         countersignatory_keys_conv.is_owned = false;
54978         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
54979         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
54980         return tag_ptr(ret_conv, true);
54981 }
54982
54983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54984         LDKTrustedCommitmentTransaction this_obj_conv;
54985         this_obj_conv.inner = untag_ptr(this_obj);
54986         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54988         TrustedCommitmentTransaction_free(this_obj_conv);
54989 }
54990
54991 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
54992         LDKTrustedCommitmentTransaction this_arg_conv;
54993         this_arg_conv.inner = untag_ptr(this_arg);
54994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54996         this_arg_conv.is_owned = false;
54997         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
54998         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
54999         return ret_arr;
55000 }
55001
55002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
55003         LDKTrustedCommitmentTransaction this_arg_conv;
55004         this_arg_conv.inner = untag_ptr(this_arg);
55005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55007         this_arg_conv.is_owned = false;
55008         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
55009         int64_t ret_ref = 0;
55010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55012         return ret_ref;
55013 }
55014
55015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
55016         LDKTrustedCommitmentTransaction this_arg_conv;
55017         this_arg_conv.inner = untag_ptr(this_arg);
55018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55020         this_arg_conv.is_owned = false;
55021         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
55022         int64_t ret_ref = 0;
55023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55025         return ret_ref;
55026 }
55027
55028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
55029         LDKTrustedCommitmentTransaction this_arg_conv;
55030         this_arg_conv.inner = untag_ptr(this_arg);
55031         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55033         this_arg_conv.is_owned = false;
55034         LDKChannelTypeFeatures ret_var = TrustedCommitmentTransaction_channel_type_features(&this_arg_conv);
55035         int64_t ret_ref = 0;
55036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55038         return ret_ref;
55039 }
55040
55041 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) {
55042         LDKTrustedCommitmentTransaction this_arg_conv;
55043         this_arg_conv.inner = untag_ptr(this_arg);
55044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55046         this_arg_conv.is_owned = false;
55047         uint8_t htlc_base_key_arr[32];
55048         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
55049         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
55050         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
55051         LDKDirectedChannelTransactionParameters channel_parameters_conv;
55052         channel_parameters_conv.inner = untag_ptr(channel_parameters);
55053         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
55054         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
55055         channel_parameters_conv.is_owned = false;
55056         void* entropy_source_ptr = untag_ptr(entropy_source);
55057         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
55058         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
55059         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
55060         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv, entropy_source_conv);
55061         return tag_ptr(ret_conv, true);
55062 }
55063
55064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1revokeable_1output_1index(JNIEnv *env, jclass clz, int64_t this_arg) {
55065         LDKTrustedCommitmentTransaction this_arg_conv;
55066         this_arg_conv.inner = untag_ptr(this_arg);
55067         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55069         this_arg_conv.is_owned = false;
55070         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
55071         *ret_copy = TrustedCommitmentTransaction_revokeable_output_index(&this_arg_conv);
55072         int64_t ret_ref = tag_ptr(ret_copy, true);
55073         return ret_ref;
55074 }
55075
55076 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) {
55077         LDKTrustedCommitmentTransaction this_arg_conv;
55078         this_arg_conv.inner = untag_ptr(this_arg);
55079         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55081         this_arg_conv.is_owned = false;
55082         LDKCVec_u8Z destination_script_ref;
55083         destination_script_ref.datalen = (*env)->GetArrayLength(env, destination_script);
55084         destination_script_ref.data = MALLOC(destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
55085         (*env)->GetByteArrayRegion(env, destination_script, 0, destination_script_ref.datalen, destination_script_ref.data);
55086         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
55087         *ret_conv = TrustedCommitmentTransaction_build_to_local_justice_tx(&this_arg_conv, feerate_per_kw, destination_script_ref);
55088         return tag_ptr(ret_conv, true);
55089 }
55090
55091 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) {
55092         LDKPublicKey broadcaster_payment_basepoint_ref;
55093         CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
55094         (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
55095         LDKPublicKey countersignatory_payment_basepoint_ref;
55096         CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
55097         (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
55098         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
55099         return ret_conv;
55100 }
55101
55102 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55103         LDKInitFeatures a_conv;
55104         a_conv.inner = untag_ptr(a);
55105         a_conv.is_owned = ptr_is_owned(a);
55106         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55107         a_conv.is_owned = false;
55108         LDKInitFeatures b_conv;
55109         b_conv.inner = untag_ptr(b);
55110         b_conv.is_owned = ptr_is_owned(b);
55111         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55112         b_conv.is_owned = false;
55113         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
55114         return ret_conv;
55115 }
55116
55117 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55118         LDKNodeFeatures a_conv;
55119         a_conv.inner = untag_ptr(a);
55120         a_conv.is_owned = ptr_is_owned(a);
55121         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55122         a_conv.is_owned = false;
55123         LDKNodeFeatures b_conv;
55124         b_conv.inner = untag_ptr(b);
55125         b_conv.is_owned = ptr_is_owned(b);
55126         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55127         b_conv.is_owned = false;
55128         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
55129         return ret_conv;
55130 }
55131
55132 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55133         LDKChannelFeatures a_conv;
55134         a_conv.inner = untag_ptr(a);
55135         a_conv.is_owned = ptr_is_owned(a);
55136         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55137         a_conv.is_owned = false;
55138         LDKChannelFeatures b_conv;
55139         b_conv.inner = untag_ptr(b);
55140         b_conv.is_owned = ptr_is_owned(b);
55141         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55142         b_conv.is_owned = false;
55143         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
55144         return ret_conv;
55145 }
55146
55147 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55148         LDKBolt11InvoiceFeatures a_conv;
55149         a_conv.inner = untag_ptr(a);
55150         a_conv.is_owned = ptr_is_owned(a);
55151         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55152         a_conv.is_owned = false;
55153         LDKBolt11InvoiceFeatures b_conv;
55154         b_conv.inner = untag_ptr(b);
55155         b_conv.is_owned = ptr_is_owned(b);
55156         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55157         b_conv.is_owned = false;
55158         jboolean ret_conv = Bolt11InvoiceFeatures_eq(&a_conv, &b_conv);
55159         return ret_conv;
55160 }
55161
55162 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55163         LDKOfferFeatures a_conv;
55164         a_conv.inner = untag_ptr(a);
55165         a_conv.is_owned = ptr_is_owned(a);
55166         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55167         a_conv.is_owned = false;
55168         LDKOfferFeatures b_conv;
55169         b_conv.inner = untag_ptr(b);
55170         b_conv.is_owned = ptr_is_owned(b);
55171         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55172         b_conv.is_owned = false;
55173         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
55174         return ret_conv;
55175 }
55176
55177 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55178         LDKInvoiceRequestFeatures a_conv;
55179         a_conv.inner = untag_ptr(a);
55180         a_conv.is_owned = ptr_is_owned(a);
55181         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55182         a_conv.is_owned = false;
55183         LDKInvoiceRequestFeatures b_conv;
55184         b_conv.inner = untag_ptr(b);
55185         b_conv.is_owned = ptr_is_owned(b);
55186         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55187         b_conv.is_owned = false;
55188         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
55189         return ret_conv;
55190 }
55191
55192 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55193         LDKBolt12InvoiceFeatures a_conv;
55194         a_conv.inner = untag_ptr(a);
55195         a_conv.is_owned = ptr_is_owned(a);
55196         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55197         a_conv.is_owned = false;
55198         LDKBolt12InvoiceFeatures b_conv;
55199         b_conv.inner = untag_ptr(b);
55200         b_conv.is_owned = ptr_is_owned(b);
55201         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55202         b_conv.is_owned = false;
55203         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
55204         return ret_conv;
55205 }
55206
55207 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55208         LDKBlindedHopFeatures a_conv;
55209         a_conv.inner = untag_ptr(a);
55210         a_conv.is_owned = ptr_is_owned(a);
55211         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55212         a_conv.is_owned = false;
55213         LDKBlindedHopFeatures b_conv;
55214         b_conv.inner = untag_ptr(b);
55215         b_conv.is_owned = ptr_is_owned(b);
55216         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55217         b_conv.is_owned = false;
55218         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
55219         return ret_conv;
55220 }
55221
55222 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55223         LDKChannelTypeFeatures a_conv;
55224         a_conv.inner = untag_ptr(a);
55225         a_conv.is_owned = ptr_is_owned(a);
55226         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55227         a_conv.is_owned = false;
55228         LDKChannelTypeFeatures b_conv;
55229         b_conv.inner = untag_ptr(b);
55230         b_conv.is_owned = ptr_is_owned(b);
55231         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55232         b_conv.is_owned = false;
55233         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
55234         return ret_conv;
55235 }
55236
55237 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
55238         LDKInitFeatures ret_var = InitFeatures_clone(arg);
55239         int64_t ret_ref = 0;
55240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55242         return ret_ref;
55243 }
55244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55245         LDKInitFeatures arg_conv;
55246         arg_conv.inner = untag_ptr(arg);
55247         arg_conv.is_owned = ptr_is_owned(arg);
55248         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55249         arg_conv.is_owned = false;
55250         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
55251         return ret_conv;
55252 }
55253
55254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55255         LDKInitFeatures orig_conv;
55256         orig_conv.inner = untag_ptr(orig);
55257         orig_conv.is_owned = ptr_is_owned(orig);
55258         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55259         orig_conv.is_owned = false;
55260         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
55261         int64_t ret_ref = 0;
55262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55264         return ret_ref;
55265 }
55266
55267 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
55268         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
55269         int64_t ret_ref = 0;
55270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55272         return ret_ref;
55273 }
55274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55275         LDKNodeFeatures arg_conv;
55276         arg_conv.inner = untag_ptr(arg);
55277         arg_conv.is_owned = ptr_is_owned(arg);
55278         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55279         arg_conv.is_owned = false;
55280         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
55281         return ret_conv;
55282 }
55283
55284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55285         LDKNodeFeatures orig_conv;
55286         orig_conv.inner = untag_ptr(orig);
55287         orig_conv.is_owned = ptr_is_owned(orig);
55288         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55289         orig_conv.is_owned = false;
55290         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
55291         int64_t ret_ref = 0;
55292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55294         return ret_ref;
55295 }
55296
55297 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
55298         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
55299         int64_t ret_ref = 0;
55300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55302         return ret_ref;
55303 }
55304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55305         LDKChannelFeatures arg_conv;
55306         arg_conv.inner = untag_ptr(arg);
55307         arg_conv.is_owned = ptr_is_owned(arg);
55308         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55309         arg_conv.is_owned = false;
55310         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
55311         return ret_conv;
55312 }
55313
55314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55315         LDKChannelFeatures orig_conv;
55316         orig_conv.inner = untag_ptr(orig);
55317         orig_conv.is_owned = ptr_is_owned(orig);
55318         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55319         orig_conv.is_owned = false;
55320         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
55321         int64_t ret_ref = 0;
55322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55324         return ret_ref;
55325 }
55326
55327 static inline uint64_t Bolt11InvoiceFeatures_clone_ptr(LDKBolt11InvoiceFeatures *NONNULL_PTR arg) {
55328         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(arg);
55329         int64_t ret_ref = 0;
55330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55332         return ret_ref;
55333 }
55334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55335         LDKBolt11InvoiceFeatures arg_conv;
55336         arg_conv.inner = untag_ptr(arg);
55337         arg_conv.is_owned = ptr_is_owned(arg);
55338         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55339         arg_conv.is_owned = false;
55340         int64_t ret_conv = Bolt11InvoiceFeatures_clone_ptr(&arg_conv);
55341         return ret_conv;
55342 }
55343
55344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55345         LDKBolt11InvoiceFeatures orig_conv;
55346         orig_conv.inner = untag_ptr(orig);
55347         orig_conv.is_owned = ptr_is_owned(orig);
55348         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55349         orig_conv.is_owned = false;
55350         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(&orig_conv);
55351         int64_t ret_ref = 0;
55352         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55353         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55354         return ret_ref;
55355 }
55356
55357 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
55358         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
55359         int64_t ret_ref = 0;
55360         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55361         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55362         return ret_ref;
55363 }
55364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55365         LDKOfferFeatures arg_conv;
55366         arg_conv.inner = untag_ptr(arg);
55367         arg_conv.is_owned = ptr_is_owned(arg);
55368         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55369         arg_conv.is_owned = false;
55370         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
55371         return ret_conv;
55372 }
55373
55374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55375         LDKOfferFeatures orig_conv;
55376         orig_conv.inner = untag_ptr(orig);
55377         orig_conv.is_owned = ptr_is_owned(orig);
55378         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55379         orig_conv.is_owned = false;
55380         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
55381         int64_t ret_ref = 0;
55382         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55383         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55384         return ret_ref;
55385 }
55386
55387 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
55388         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
55389         int64_t ret_ref = 0;
55390         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55391         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55392         return ret_ref;
55393 }
55394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55395         LDKInvoiceRequestFeatures arg_conv;
55396         arg_conv.inner = untag_ptr(arg);
55397         arg_conv.is_owned = ptr_is_owned(arg);
55398         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55399         arg_conv.is_owned = false;
55400         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
55401         return ret_conv;
55402 }
55403
55404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55405         LDKInvoiceRequestFeatures orig_conv;
55406         orig_conv.inner = untag_ptr(orig);
55407         orig_conv.is_owned = ptr_is_owned(orig);
55408         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55409         orig_conv.is_owned = false;
55410         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
55411         int64_t ret_ref = 0;
55412         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55413         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55414         return ret_ref;
55415 }
55416
55417 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
55418         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
55419         int64_t ret_ref = 0;
55420         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55421         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55422         return ret_ref;
55423 }
55424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55425         LDKBolt12InvoiceFeatures arg_conv;
55426         arg_conv.inner = untag_ptr(arg);
55427         arg_conv.is_owned = ptr_is_owned(arg);
55428         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55429         arg_conv.is_owned = false;
55430         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
55431         return ret_conv;
55432 }
55433
55434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55435         LDKBolt12InvoiceFeatures orig_conv;
55436         orig_conv.inner = untag_ptr(orig);
55437         orig_conv.is_owned = ptr_is_owned(orig);
55438         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55439         orig_conv.is_owned = false;
55440         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
55441         int64_t ret_ref = 0;
55442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55444         return ret_ref;
55445 }
55446
55447 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
55448         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
55449         int64_t ret_ref = 0;
55450         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55451         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55452         return ret_ref;
55453 }
55454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55455         LDKBlindedHopFeatures arg_conv;
55456         arg_conv.inner = untag_ptr(arg);
55457         arg_conv.is_owned = ptr_is_owned(arg);
55458         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55459         arg_conv.is_owned = false;
55460         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
55461         return ret_conv;
55462 }
55463
55464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55465         LDKBlindedHopFeatures orig_conv;
55466         orig_conv.inner = untag_ptr(orig);
55467         orig_conv.is_owned = ptr_is_owned(orig);
55468         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55469         orig_conv.is_owned = false;
55470         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv);
55471         int64_t ret_ref = 0;
55472         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55473         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55474         return ret_ref;
55475 }
55476
55477 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
55478         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
55479         int64_t ret_ref = 0;
55480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55482         return ret_ref;
55483 }
55484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55485         LDKChannelTypeFeatures arg_conv;
55486         arg_conv.inner = untag_ptr(arg);
55487         arg_conv.is_owned = ptr_is_owned(arg);
55488         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55489         arg_conv.is_owned = false;
55490         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
55491         return ret_conv;
55492 }
55493
55494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55495         LDKChannelTypeFeatures orig_conv;
55496         orig_conv.inner = untag_ptr(orig);
55497         orig_conv.is_owned = ptr_is_owned(orig);
55498         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55499         orig_conv.is_owned = false;
55500         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
55501         int64_t ret_ref = 0;
55502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55504         return ret_ref;
55505 }
55506
55507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55508         LDKInitFeatures this_obj_conv;
55509         this_obj_conv.inner = untag_ptr(this_obj);
55510         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55512         InitFeatures_free(this_obj_conv);
55513 }
55514
55515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55516         LDKNodeFeatures this_obj_conv;
55517         this_obj_conv.inner = untag_ptr(this_obj);
55518         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55520         NodeFeatures_free(this_obj_conv);
55521 }
55522
55523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55524         LDKChannelFeatures this_obj_conv;
55525         this_obj_conv.inner = untag_ptr(this_obj);
55526         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55528         ChannelFeatures_free(this_obj_conv);
55529 }
55530
55531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55532         LDKBolt11InvoiceFeatures this_obj_conv;
55533         this_obj_conv.inner = untag_ptr(this_obj);
55534         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55536         Bolt11InvoiceFeatures_free(this_obj_conv);
55537 }
55538
55539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55540         LDKOfferFeatures this_obj_conv;
55541         this_obj_conv.inner = untag_ptr(this_obj);
55542         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55544         OfferFeatures_free(this_obj_conv);
55545 }
55546
55547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55548         LDKInvoiceRequestFeatures this_obj_conv;
55549         this_obj_conv.inner = untag_ptr(this_obj);
55550         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55552         InvoiceRequestFeatures_free(this_obj_conv);
55553 }
55554
55555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55556         LDKBolt12InvoiceFeatures this_obj_conv;
55557         this_obj_conv.inner = untag_ptr(this_obj);
55558         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55560         Bolt12InvoiceFeatures_free(this_obj_conv);
55561 }
55562
55563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55564         LDKBlindedHopFeatures this_obj_conv;
55565         this_obj_conv.inner = untag_ptr(this_obj);
55566         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55568         BlindedHopFeatures_free(this_obj_conv);
55569 }
55570
55571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55572         LDKChannelTypeFeatures this_obj_conv;
55573         this_obj_conv.inner = untag_ptr(this_obj);
55574         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55576         ChannelTypeFeatures_free(this_obj_conv);
55577 }
55578
55579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
55580         LDKInitFeatures ret_var = InitFeatures_empty();
55581         int64_t ret_ref = 0;
55582         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55583         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55584         return ret_ref;
55585 }
55586
55587 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
55588         LDKInitFeatures this_arg_conv;
55589         this_arg_conv.inner = untag_ptr(this_arg);
55590         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55592         this_arg_conv.is_owned = false;
55593         LDKInitFeatures other_conv;
55594         other_conv.inner = untag_ptr(other);
55595         other_conv.is_owned = ptr_is_owned(other);
55596         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55597         other_conv.is_owned = false;
55598         jboolean ret_conv = InitFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55599         return ret_conv;
55600 }
55601
55602 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
55603         LDKInitFeatures this_arg_conv;
55604         this_arg_conv.inner = untag_ptr(this_arg);
55605         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55607         this_arg_conv.is_owned = false;
55608         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
55609         return ret_conv;
55610 }
55611
55612 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) {
55613         LDKInitFeatures this_arg_conv;
55614         this_arg_conv.inner = untag_ptr(this_arg);
55615         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55617         this_arg_conv.is_owned = false;
55618         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55619         *ret_conv = InitFeatures_set_required_feature_bit(&this_arg_conv, bit);
55620         return tag_ptr(ret_conv, true);
55621 }
55622
55623 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) {
55624         LDKInitFeatures this_arg_conv;
55625         this_arg_conv.inner = untag_ptr(this_arg);
55626         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55628         this_arg_conv.is_owned = false;
55629         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55630         *ret_conv = InitFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55631         return tag_ptr(ret_conv, true);
55632 }
55633
55634 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) {
55635         LDKInitFeatures this_arg_conv;
55636         this_arg_conv.inner = untag_ptr(this_arg);
55637         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55639         this_arg_conv.is_owned = false;
55640         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55641         *ret_conv = InitFeatures_set_required_custom_bit(&this_arg_conv, bit);
55642         return tag_ptr(ret_conv, true);
55643 }
55644
55645 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) {
55646         LDKInitFeatures this_arg_conv;
55647         this_arg_conv.inner = untag_ptr(this_arg);
55648         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55650         this_arg_conv.is_owned = false;
55651         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55652         *ret_conv = InitFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55653         return tag_ptr(ret_conv, true);
55654 }
55655
55656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
55657         LDKNodeFeatures ret_var = NodeFeatures_empty();
55658         int64_t ret_ref = 0;
55659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55661         return ret_ref;
55662 }
55663
55664 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
55665         LDKNodeFeatures this_arg_conv;
55666         this_arg_conv.inner = untag_ptr(this_arg);
55667         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55669         this_arg_conv.is_owned = false;
55670         LDKNodeFeatures other_conv;
55671         other_conv.inner = untag_ptr(other);
55672         other_conv.is_owned = ptr_is_owned(other);
55673         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55674         other_conv.is_owned = false;
55675         jboolean ret_conv = NodeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55676         return ret_conv;
55677 }
55678
55679 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
55680         LDKNodeFeatures this_arg_conv;
55681         this_arg_conv.inner = untag_ptr(this_arg);
55682         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55684         this_arg_conv.is_owned = false;
55685         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
55686         return ret_conv;
55687 }
55688
55689 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) {
55690         LDKNodeFeatures this_arg_conv;
55691         this_arg_conv.inner = untag_ptr(this_arg);
55692         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55694         this_arg_conv.is_owned = false;
55695         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55696         *ret_conv = NodeFeatures_set_required_feature_bit(&this_arg_conv, bit);
55697         return tag_ptr(ret_conv, true);
55698 }
55699
55700 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) {
55701         LDKNodeFeatures this_arg_conv;
55702         this_arg_conv.inner = untag_ptr(this_arg);
55703         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55705         this_arg_conv.is_owned = false;
55706         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55707         *ret_conv = NodeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55708         return tag_ptr(ret_conv, true);
55709 }
55710
55711 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) {
55712         LDKNodeFeatures this_arg_conv;
55713         this_arg_conv.inner = untag_ptr(this_arg);
55714         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55716         this_arg_conv.is_owned = false;
55717         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55718         *ret_conv = NodeFeatures_set_required_custom_bit(&this_arg_conv, bit);
55719         return tag_ptr(ret_conv, true);
55720 }
55721
55722 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) {
55723         LDKNodeFeatures this_arg_conv;
55724         this_arg_conv.inner = untag_ptr(this_arg);
55725         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55727         this_arg_conv.is_owned = false;
55728         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55729         *ret_conv = NodeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55730         return tag_ptr(ret_conv, true);
55731 }
55732
55733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
55734         LDKChannelFeatures ret_var = ChannelFeatures_empty();
55735         int64_t ret_ref = 0;
55736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55738         return ret_ref;
55739 }
55740
55741 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
55742         LDKChannelFeatures this_arg_conv;
55743         this_arg_conv.inner = untag_ptr(this_arg);
55744         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55746         this_arg_conv.is_owned = false;
55747         LDKChannelFeatures other_conv;
55748         other_conv.inner = untag_ptr(other);
55749         other_conv.is_owned = ptr_is_owned(other);
55750         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55751         other_conv.is_owned = false;
55752         jboolean ret_conv = ChannelFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55753         return ret_conv;
55754 }
55755
55756 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
55757         LDKChannelFeatures this_arg_conv;
55758         this_arg_conv.inner = untag_ptr(this_arg);
55759         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55761         this_arg_conv.is_owned = false;
55762         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
55763         return ret_conv;
55764 }
55765
55766 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) {
55767         LDKChannelFeatures this_arg_conv;
55768         this_arg_conv.inner = untag_ptr(this_arg);
55769         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55771         this_arg_conv.is_owned = false;
55772         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55773         *ret_conv = ChannelFeatures_set_required_feature_bit(&this_arg_conv, bit);
55774         return tag_ptr(ret_conv, true);
55775 }
55776
55777 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) {
55778         LDKChannelFeatures this_arg_conv;
55779         this_arg_conv.inner = untag_ptr(this_arg);
55780         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55782         this_arg_conv.is_owned = false;
55783         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55784         *ret_conv = ChannelFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55785         return tag_ptr(ret_conv, true);
55786 }
55787
55788 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) {
55789         LDKChannelFeatures this_arg_conv;
55790         this_arg_conv.inner = untag_ptr(this_arg);
55791         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55793         this_arg_conv.is_owned = false;
55794         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55795         *ret_conv = ChannelFeatures_set_required_custom_bit(&this_arg_conv, bit);
55796         return tag_ptr(ret_conv, true);
55797 }
55798
55799 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) {
55800         LDKChannelFeatures this_arg_conv;
55801         this_arg_conv.inner = untag_ptr(this_arg);
55802         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55804         this_arg_conv.is_owned = false;
55805         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55806         *ret_conv = ChannelFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55807         return tag_ptr(ret_conv, true);
55808 }
55809
55810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
55811         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_empty();
55812         int64_t ret_ref = 0;
55813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55815         return ret_ref;
55816 }
55817
55818 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
55819         LDKBolt11InvoiceFeatures this_arg_conv;
55820         this_arg_conv.inner = untag_ptr(this_arg);
55821         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55823         this_arg_conv.is_owned = false;
55824         LDKBolt11InvoiceFeatures other_conv;
55825         other_conv.inner = untag_ptr(other);
55826         other_conv.is_owned = ptr_is_owned(other);
55827         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55828         other_conv.is_owned = false;
55829         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55830         return ret_conv;
55831 }
55832
55833 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
55834         LDKBolt11InvoiceFeatures this_arg_conv;
55835         this_arg_conv.inner = untag_ptr(this_arg);
55836         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55838         this_arg_conv.is_owned = false;
55839         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
55840         return ret_conv;
55841 }
55842
55843 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) {
55844         LDKBolt11InvoiceFeatures this_arg_conv;
55845         this_arg_conv.inner = untag_ptr(this_arg);
55846         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55848         this_arg_conv.is_owned = false;
55849         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55850         *ret_conv = Bolt11InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
55851         return tag_ptr(ret_conv, true);
55852 }
55853
55854 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) {
55855         LDKBolt11InvoiceFeatures this_arg_conv;
55856         this_arg_conv.inner = untag_ptr(this_arg);
55857         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55859         this_arg_conv.is_owned = false;
55860         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55861         *ret_conv = Bolt11InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55862         return tag_ptr(ret_conv, true);
55863 }
55864
55865 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) {
55866         LDKBolt11InvoiceFeatures this_arg_conv;
55867         this_arg_conv.inner = untag_ptr(this_arg);
55868         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55870         this_arg_conv.is_owned = false;
55871         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55872         *ret_conv = Bolt11InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
55873         return tag_ptr(ret_conv, true);
55874 }
55875
55876 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) {
55877         LDKBolt11InvoiceFeatures 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         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55883         *ret_conv = Bolt11InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55884         return tag_ptr(ret_conv, true);
55885 }
55886
55887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1empty(JNIEnv *env, jclass clz) {
55888         LDKOfferFeatures ret_var = OfferFeatures_empty();
55889         int64_t ret_ref = 0;
55890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55892         return ret_ref;
55893 }
55894
55895 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
55896         LDKOfferFeatures 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         LDKOfferFeatures other_conv;
55902         other_conv.inner = untag_ptr(other);
55903         other_conv.is_owned = ptr_is_owned(other);
55904         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55905         other_conv.is_owned = false;
55906         jboolean ret_conv = OfferFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55907         return ret_conv;
55908 }
55909
55910 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
55911         LDKOfferFeatures this_arg_conv;
55912         this_arg_conv.inner = untag_ptr(this_arg);
55913         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55915         this_arg_conv.is_owned = false;
55916         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
55917         return ret_conv;
55918 }
55919
55920 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) {
55921         LDKOfferFeatures this_arg_conv;
55922         this_arg_conv.inner = untag_ptr(this_arg);
55923         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55925         this_arg_conv.is_owned = false;
55926         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55927         *ret_conv = OfferFeatures_set_required_feature_bit(&this_arg_conv, bit);
55928         return tag_ptr(ret_conv, true);
55929 }
55930
55931 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) {
55932         LDKOfferFeatures this_arg_conv;
55933         this_arg_conv.inner = untag_ptr(this_arg);
55934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55936         this_arg_conv.is_owned = false;
55937         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55938         *ret_conv = OfferFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55939         return tag_ptr(ret_conv, true);
55940 }
55941
55942 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) {
55943         LDKOfferFeatures this_arg_conv;
55944         this_arg_conv.inner = untag_ptr(this_arg);
55945         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55947         this_arg_conv.is_owned = false;
55948         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55949         *ret_conv = OfferFeatures_set_required_custom_bit(&this_arg_conv, bit);
55950         return tag_ptr(ret_conv, true);
55951 }
55952
55953 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) {
55954         LDKOfferFeatures this_arg_conv;
55955         this_arg_conv.inner = untag_ptr(this_arg);
55956         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55958         this_arg_conv.is_owned = false;
55959         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55960         *ret_conv = OfferFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55961         return tag_ptr(ret_conv, true);
55962 }
55963
55964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1empty(JNIEnv *env, jclass clz) {
55965         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
55966         int64_t ret_ref = 0;
55967         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55968         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55969         return ret_ref;
55970 }
55971
55972 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
55973         LDKInvoiceRequestFeatures this_arg_conv;
55974         this_arg_conv.inner = untag_ptr(this_arg);
55975         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55977         this_arg_conv.is_owned = false;
55978         LDKInvoiceRequestFeatures other_conv;
55979         other_conv.inner = untag_ptr(other);
55980         other_conv.is_owned = ptr_is_owned(other);
55981         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55982         other_conv.is_owned = false;
55983         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55984         return ret_conv;
55985 }
55986
55987 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
55988         LDKInvoiceRequestFeatures this_arg_conv;
55989         this_arg_conv.inner = untag_ptr(this_arg);
55990         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55992         this_arg_conv.is_owned = false;
55993         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
55994         return ret_conv;
55995 }
55996
55997 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) {
55998         LDKInvoiceRequestFeatures this_arg_conv;
55999         this_arg_conv.inner = untag_ptr(this_arg);
56000         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56002         this_arg_conv.is_owned = false;
56003         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56004         *ret_conv = InvoiceRequestFeatures_set_required_feature_bit(&this_arg_conv, bit);
56005         return tag_ptr(ret_conv, true);
56006 }
56007
56008 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) {
56009         LDKInvoiceRequestFeatures 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         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56015         *ret_conv = InvoiceRequestFeatures_set_optional_feature_bit(&this_arg_conv, bit);
56016         return tag_ptr(ret_conv, true);
56017 }
56018
56019 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) {
56020         LDKInvoiceRequestFeatures this_arg_conv;
56021         this_arg_conv.inner = untag_ptr(this_arg);
56022         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56024         this_arg_conv.is_owned = false;
56025         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56026         *ret_conv = InvoiceRequestFeatures_set_required_custom_bit(&this_arg_conv, bit);
56027         return tag_ptr(ret_conv, true);
56028 }
56029
56030 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) {
56031         LDKInvoiceRequestFeatures this_arg_conv;
56032         this_arg_conv.inner = untag_ptr(this_arg);
56033         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56035         this_arg_conv.is_owned = false;
56036         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56037         *ret_conv = InvoiceRequestFeatures_set_optional_custom_bit(&this_arg_conv, bit);
56038         return tag_ptr(ret_conv, true);
56039 }
56040
56041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
56042         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
56043         int64_t ret_ref = 0;
56044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56046         return ret_ref;
56047 }
56048
56049 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
56050         LDKBolt12InvoiceFeatures this_arg_conv;
56051         this_arg_conv.inner = untag_ptr(this_arg);
56052         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56054         this_arg_conv.is_owned = false;
56055         LDKBolt12InvoiceFeatures other_conv;
56056         other_conv.inner = untag_ptr(other);
56057         other_conv.is_owned = ptr_is_owned(other);
56058         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
56059         other_conv.is_owned = false;
56060         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
56061         return ret_conv;
56062 }
56063
56064 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
56065         LDKBolt12InvoiceFeatures this_arg_conv;
56066         this_arg_conv.inner = untag_ptr(this_arg);
56067         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56069         this_arg_conv.is_owned = false;
56070         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
56071         return ret_conv;
56072 }
56073
56074 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) {
56075         LDKBolt12InvoiceFeatures this_arg_conv;
56076         this_arg_conv.inner = untag_ptr(this_arg);
56077         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56079         this_arg_conv.is_owned = false;
56080         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56081         *ret_conv = Bolt12InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
56082         return tag_ptr(ret_conv, true);
56083 }
56084
56085 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) {
56086         LDKBolt12InvoiceFeatures this_arg_conv;
56087         this_arg_conv.inner = untag_ptr(this_arg);
56088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56090         this_arg_conv.is_owned = false;
56091         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56092         *ret_conv = Bolt12InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
56093         return tag_ptr(ret_conv, true);
56094 }
56095
56096 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) {
56097         LDKBolt12InvoiceFeatures this_arg_conv;
56098         this_arg_conv.inner = untag_ptr(this_arg);
56099         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56101         this_arg_conv.is_owned = false;
56102         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56103         *ret_conv = Bolt12InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
56104         return tag_ptr(ret_conv, true);
56105 }
56106
56107 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) {
56108         LDKBolt12InvoiceFeatures this_arg_conv;
56109         this_arg_conv.inner = untag_ptr(this_arg);
56110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56112         this_arg_conv.is_owned = false;
56113         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56114         *ret_conv = Bolt12InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
56115         return tag_ptr(ret_conv, true);
56116 }
56117
56118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1empty(JNIEnv *env, jclass clz) {
56119         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
56120         int64_t ret_ref = 0;
56121         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56122         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56123         return ret_ref;
56124 }
56125
56126 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
56127         LDKBlindedHopFeatures this_arg_conv;
56128         this_arg_conv.inner = untag_ptr(this_arg);
56129         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56131         this_arg_conv.is_owned = false;
56132         LDKBlindedHopFeatures other_conv;
56133         other_conv.inner = untag_ptr(other);
56134         other_conv.is_owned = ptr_is_owned(other);
56135         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
56136         other_conv.is_owned = false;
56137         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
56138         return ret_conv;
56139 }
56140
56141 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
56142         LDKBlindedHopFeatures 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 = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
56148         return ret_conv;
56149 }
56150
56151 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) {
56152         LDKBlindedHopFeatures 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         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56158         *ret_conv = BlindedHopFeatures_set_required_feature_bit(&this_arg_conv, bit);
56159         return tag_ptr(ret_conv, true);
56160 }
56161
56162 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) {
56163         LDKBlindedHopFeatures this_arg_conv;
56164         this_arg_conv.inner = untag_ptr(this_arg);
56165         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56167         this_arg_conv.is_owned = false;
56168         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56169         *ret_conv = BlindedHopFeatures_set_optional_feature_bit(&this_arg_conv, bit);
56170         return tag_ptr(ret_conv, true);
56171 }
56172
56173 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) {
56174         LDKBlindedHopFeatures this_arg_conv;
56175         this_arg_conv.inner = untag_ptr(this_arg);
56176         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56178         this_arg_conv.is_owned = false;
56179         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56180         *ret_conv = BlindedHopFeatures_set_required_custom_bit(&this_arg_conv, bit);
56181         return tag_ptr(ret_conv, true);
56182 }
56183
56184 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) {
56185         LDKBlindedHopFeatures this_arg_conv;
56186         this_arg_conv.inner = untag_ptr(this_arg);
56187         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56189         this_arg_conv.is_owned = false;
56190         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56191         *ret_conv = BlindedHopFeatures_set_optional_custom_bit(&this_arg_conv, bit);
56192         return tag_ptr(ret_conv, true);
56193 }
56194
56195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty(JNIEnv *env, jclass clz) {
56196         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
56197         int64_t ret_ref = 0;
56198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56200         return ret_ref;
56201 }
56202
56203 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
56204         LDKChannelTypeFeatures this_arg_conv;
56205         this_arg_conv.inner = untag_ptr(this_arg);
56206         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56208         this_arg_conv.is_owned = false;
56209         LDKChannelTypeFeatures other_conv;
56210         other_conv.inner = untag_ptr(other);
56211         other_conv.is_owned = ptr_is_owned(other);
56212         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
56213         other_conv.is_owned = false;
56214         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
56215         return ret_conv;
56216 }
56217
56218 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
56219         LDKChannelTypeFeatures this_arg_conv;
56220         this_arg_conv.inner = untag_ptr(this_arg);
56221         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56223         this_arg_conv.is_owned = false;
56224         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
56225         return ret_conv;
56226 }
56227
56228 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) {
56229         LDKChannelTypeFeatures this_arg_conv;
56230         this_arg_conv.inner = untag_ptr(this_arg);
56231         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56233         this_arg_conv.is_owned = false;
56234         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56235         *ret_conv = ChannelTypeFeatures_set_required_feature_bit(&this_arg_conv, bit);
56236         return tag_ptr(ret_conv, true);
56237 }
56238
56239 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) {
56240         LDKChannelTypeFeatures this_arg_conv;
56241         this_arg_conv.inner = untag_ptr(this_arg);
56242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56244         this_arg_conv.is_owned = false;
56245         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56246         *ret_conv = ChannelTypeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
56247         return tag_ptr(ret_conv, true);
56248 }
56249
56250 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) {
56251         LDKChannelTypeFeatures this_arg_conv;
56252         this_arg_conv.inner = untag_ptr(this_arg);
56253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56255         this_arg_conv.is_owned = false;
56256         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56257         *ret_conv = ChannelTypeFeatures_set_required_custom_bit(&this_arg_conv, bit);
56258         return tag_ptr(ret_conv, true);
56259 }
56260
56261 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) {
56262         LDKChannelTypeFeatures this_arg_conv;
56263         this_arg_conv.inner = untag_ptr(this_arg);
56264         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56266         this_arg_conv.is_owned = false;
56267         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56268         *ret_conv = ChannelTypeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
56269         return tag_ptr(ret_conv, true);
56270 }
56271
56272 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
56273         LDKInitFeatures obj_conv;
56274         obj_conv.inner = untag_ptr(obj);
56275         obj_conv.is_owned = ptr_is_owned(obj);
56276         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56277         obj_conv.is_owned = false;
56278         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
56279         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56280         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56281         CVec_u8Z_free(ret_var);
56282         return ret_arr;
56283 }
56284
56285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56286         LDKu8slice ser_ref;
56287         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56288         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56289         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
56290         *ret_conv = InitFeatures_read(ser_ref);
56291         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56292         return tag_ptr(ret_conv, true);
56293 }
56294
56295 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
56296         LDKChannelFeatures obj_conv;
56297         obj_conv.inner = untag_ptr(obj);
56298         obj_conv.is_owned = ptr_is_owned(obj);
56299         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56300         obj_conv.is_owned = false;
56301         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
56302         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56303         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56304         CVec_u8Z_free(ret_var);
56305         return ret_arr;
56306 }
56307
56308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56309         LDKu8slice ser_ref;
56310         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56311         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56312         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
56313         *ret_conv = ChannelFeatures_read(ser_ref);
56314         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56315         return tag_ptr(ret_conv, true);
56316 }
56317
56318 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
56319         LDKNodeFeatures obj_conv;
56320         obj_conv.inner = untag_ptr(obj);
56321         obj_conv.is_owned = ptr_is_owned(obj);
56322         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56323         obj_conv.is_owned = false;
56324         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
56325         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56326         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56327         CVec_u8Z_free(ret_var);
56328         return ret_arr;
56329 }
56330
56331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56332         LDKu8slice ser_ref;
56333         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56334         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56335         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
56336         *ret_conv = NodeFeatures_read(ser_ref);
56337         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56338         return tag_ptr(ret_conv, true);
56339 }
56340
56341 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
56342         LDKBolt11InvoiceFeatures obj_conv;
56343         obj_conv.inner = untag_ptr(obj);
56344         obj_conv.is_owned = ptr_is_owned(obj);
56345         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56346         obj_conv.is_owned = false;
56347         LDKCVec_u8Z ret_var = Bolt11InvoiceFeatures_write(&obj_conv);
56348         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56349         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56350         CVec_u8Z_free(ret_var);
56351         return ret_arr;
56352 }
56353
56354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56355         LDKu8slice ser_ref;
56356         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56357         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56358         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
56359         *ret_conv = Bolt11InvoiceFeatures_read(ser_ref);
56360         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56361         return tag_ptr(ret_conv, true);
56362 }
56363
56364 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
56365         LDKBolt12InvoiceFeatures obj_conv;
56366         obj_conv.inner = untag_ptr(obj);
56367         obj_conv.is_owned = ptr_is_owned(obj);
56368         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56369         obj_conv.is_owned = false;
56370         LDKCVec_u8Z ret_var = Bolt12InvoiceFeatures_write(&obj_conv);
56371         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56372         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56373         CVec_u8Z_free(ret_var);
56374         return ret_arr;
56375 }
56376
56377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56378         LDKu8slice ser_ref;
56379         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56380         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56381         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
56382         *ret_conv = Bolt12InvoiceFeatures_read(ser_ref);
56383         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56384         return tag_ptr(ret_conv, true);
56385 }
56386
56387 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
56388         LDKBlindedHopFeatures obj_conv;
56389         obj_conv.inner = untag_ptr(obj);
56390         obj_conv.is_owned = ptr_is_owned(obj);
56391         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56392         obj_conv.is_owned = false;
56393         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
56394         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56395         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56396         CVec_u8Z_free(ret_var);
56397         return ret_arr;
56398 }
56399
56400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56401         LDKu8slice ser_ref;
56402         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56403         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56404         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
56405         *ret_conv = BlindedHopFeatures_read(ser_ref);
56406         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56407         return tag_ptr(ret_conv, true);
56408 }
56409
56410 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
56411         LDKChannelTypeFeatures obj_conv;
56412         obj_conv.inner = untag_ptr(obj);
56413         obj_conv.is_owned = ptr_is_owned(obj);
56414         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56415         obj_conv.is_owned = false;
56416         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
56417         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56418         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56419         CVec_u8Z_free(ret_var);
56420         return ret_arr;
56421 }
56422
56423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56424         LDKu8slice ser_ref;
56425         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56426         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56427         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
56428         *ret_conv = ChannelTypeFeatures_read(ser_ref);
56429         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56430         return tag_ptr(ret_conv, true);
56431 }
56432
56433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56434         LDKInitFeatures this_arg_conv;
56435         this_arg_conv.inner = untag_ptr(this_arg);
56436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56438         this_arg_conv.is_owned = false;
56439         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
56440 }
56441
56442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56443         LDKInitFeatures this_arg_conv;
56444         this_arg_conv.inner = untag_ptr(this_arg);
56445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56447         this_arg_conv.is_owned = false;
56448         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
56449 }
56450
56451 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
56452         LDKInitFeatures this_arg_conv;
56453         this_arg_conv.inner = untag_ptr(this_arg);
56454         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56456         this_arg_conv.is_owned = false;
56457         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
56458         return ret_conv;
56459 }
56460
56461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56462         LDKNodeFeatures this_arg_conv;
56463         this_arg_conv.inner = untag_ptr(this_arg);
56464         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56466         this_arg_conv.is_owned = false;
56467         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
56468 }
56469
56470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56471         LDKNodeFeatures this_arg_conv;
56472         this_arg_conv.inner = untag_ptr(this_arg);
56473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56475         this_arg_conv.is_owned = false;
56476         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
56477 }
56478
56479 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
56480         LDKNodeFeatures this_arg_conv;
56481         this_arg_conv.inner = untag_ptr(this_arg);
56482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56484         this_arg_conv.is_owned = false;
56485         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
56486         return ret_conv;
56487 }
56488
56489 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
56490         LDKInitFeatures this_arg_conv;
56491         this_arg_conv.inner = untag_ptr(this_arg);
56492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56494         this_arg_conv.is_owned = false;
56495         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
56496         return ret_conv;
56497 }
56498
56499 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
56500         LDKNodeFeatures this_arg_conv;
56501         this_arg_conv.inner = untag_ptr(this_arg);
56502         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56504         this_arg_conv.is_owned = false;
56505         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
56506         return ret_conv;
56507 }
56508
56509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56510         LDKInitFeatures this_arg_conv;
56511         this_arg_conv.inner = untag_ptr(this_arg);
56512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56514         this_arg_conv.is_owned = false;
56515         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
56516 }
56517
56518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56519         LDKInitFeatures this_arg_conv;
56520         this_arg_conv.inner = untag_ptr(this_arg);
56521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56523         this_arg_conv.is_owned = false;
56524         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
56525 }
56526
56527 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1initial_1routing_1sync(JNIEnv *env, jclass clz, int64_t this_arg) {
56528         LDKInitFeatures this_arg_conv;
56529         this_arg_conv.inner = untag_ptr(this_arg);
56530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56532         this_arg_conv.is_owned = false;
56533         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
56534         return ret_conv;
56535 }
56536
56537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56538         LDKInitFeatures this_arg_conv;
56539         this_arg_conv.inner = untag_ptr(this_arg);
56540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56542         this_arg_conv.is_owned = false;
56543         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
56544 }
56545
56546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56547         LDKInitFeatures this_arg_conv;
56548         this_arg_conv.inner = untag_ptr(this_arg);
56549         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56551         this_arg_conv.is_owned = false;
56552         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
56553 }
56554
56555 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
56556         LDKInitFeatures this_arg_conv;
56557         this_arg_conv.inner = untag_ptr(this_arg);
56558         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56560         this_arg_conv.is_owned = false;
56561         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
56562         return ret_conv;
56563 }
56564
56565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56566         LDKNodeFeatures this_arg_conv;
56567         this_arg_conv.inner = untag_ptr(this_arg);
56568         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56570         this_arg_conv.is_owned = false;
56571         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
56572 }
56573
56574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56575         LDKNodeFeatures this_arg_conv;
56576         this_arg_conv.inner = untag_ptr(this_arg);
56577         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56579         this_arg_conv.is_owned = false;
56580         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
56581 }
56582
56583 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
56584         LDKNodeFeatures this_arg_conv;
56585         this_arg_conv.inner = untag_ptr(this_arg);
56586         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56588         this_arg_conv.is_owned = false;
56589         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
56590         return ret_conv;
56591 }
56592
56593 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
56594         LDKInitFeatures this_arg_conv;
56595         this_arg_conv.inner = untag_ptr(this_arg);
56596         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56598         this_arg_conv.is_owned = false;
56599         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
56600         return ret_conv;
56601 }
56602
56603 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
56604         LDKNodeFeatures this_arg_conv;
56605         this_arg_conv.inner = untag_ptr(this_arg);
56606         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56608         this_arg_conv.is_owned = false;
56609         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
56610         return ret_conv;
56611 }
56612
56613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56614         LDKInitFeatures this_arg_conv;
56615         this_arg_conv.inner = untag_ptr(this_arg);
56616         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56618         this_arg_conv.is_owned = false;
56619         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
56620 }
56621
56622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56623         LDKInitFeatures this_arg_conv;
56624         this_arg_conv.inner = untag_ptr(this_arg);
56625         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56627         this_arg_conv.is_owned = false;
56628         InitFeatures_set_gossip_queries_required(&this_arg_conv);
56629 }
56630
56631 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
56632         LDKInitFeatures this_arg_conv;
56633         this_arg_conv.inner = untag_ptr(this_arg);
56634         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56636         this_arg_conv.is_owned = false;
56637         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
56638         return ret_conv;
56639 }
56640
56641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56642         LDKNodeFeatures this_arg_conv;
56643         this_arg_conv.inner = untag_ptr(this_arg);
56644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56646         this_arg_conv.is_owned = false;
56647         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
56648 }
56649
56650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56651         LDKNodeFeatures this_arg_conv;
56652         this_arg_conv.inner = untag_ptr(this_arg);
56653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56655         this_arg_conv.is_owned = false;
56656         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
56657 }
56658
56659 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
56660         LDKNodeFeatures this_arg_conv;
56661         this_arg_conv.inner = untag_ptr(this_arg);
56662         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56664         this_arg_conv.is_owned = false;
56665         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
56666         return ret_conv;
56667 }
56668
56669 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
56670         LDKInitFeatures this_arg_conv;
56671         this_arg_conv.inner = untag_ptr(this_arg);
56672         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56674         this_arg_conv.is_owned = false;
56675         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
56676         return ret_conv;
56677 }
56678
56679 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
56680         LDKNodeFeatures this_arg_conv;
56681         this_arg_conv.inner = untag_ptr(this_arg);
56682         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56684         this_arg_conv.is_owned = false;
56685         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
56686         return ret_conv;
56687 }
56688
56689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56690         LDKInitFeatures this_arg_conv;
56691         this_arg_conv.inner = untag_ptr(this_arg);
56692         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56694         this_arg_conv.is_owned = false;
56695         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
56696 }
56697
56698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56699         LDKInitFeatures this_arg_conv;
56700         this_arg_conv.inner = untag_ptr(this_arg);
56701         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56703         this_arg_conv.is_owned = false;
56704         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
56705 }
56706
56707 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
56708         LDKInitFeatures this_arg_conv;
56709         this_arg_conv.inner = untag_ptr(this_arg);
56710         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56712         this_arg_conv.is_owned = false;
56713         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
56714         return ret_conv;
56715 }
56716
56717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56718         LDKNodeFeatures this_arg_conv;
56719         this_arg_conv.inner = untag_ptr(this_arg);
56720         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56722         this_arg_conv.is_owned = false;
56723         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
56724 }
56725
56726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56727         LDKNodeFeatures this_arg_conv;
56728         this_arg_conv.inner = untag_ptr(this_arg);
56729         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56731         this_arg_conv.is_owned = false;
56732         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
56733 }
56734
56735 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
56736         LDKNodeFeatures this_arg_conv;
56737         this_arg_conv.inner = untag_ptr(this_arg);
56738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56740         this_arg_conv.is_owned = false;
56741         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
56742         return ret_conv;
56743 }
56744
56745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56746         LDKBolt11InvoiceFeatures this_arg_conv;
56747         this_arg_conv.inner = untag_ptr(this_arg);
56748         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56750         this_arg_conv.is_owned = false;
56751         Bolt11InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
56752 }
56753
56754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56755         LDKBolt11InvoiceFeatures this_arg_conv;
56756         this_arg_conv.inner = untag_ptr(this_arg);
56757         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56759         this_arg_conv.is_owned = false;
56760         Bolt11InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
56761 }
56762
56763 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
56764         LDKBolt11InvoiceFeatures this_arg_conv;
56765         this_arg_conv.inner = untag_ptr(this_arg);
56766         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56768         this_arg_conv.is_owned = false;
56769         jboolean ret_conv = Bolt11InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
56770         return ret_conv;
56771 }
56772
56773 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
56774         LDKInitFeatures this_arg_conv;
56775         this_arg_conv.inner = untag_ptr(this_arg);
56776         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56778         this_arg_conv.is_owned = false;
56779         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
56780         return ret_conv;
56781 }
56782
56783 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
56784         LDKNodeFeatures this_arg_conv;
56785         this_arg_conv.inner = untag_ptr(this_arg);
56786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56788         this_arg_conv.is_owned = false;
56789         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
56790         return ret_conv;
56791 }
56792
56793 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
56794         LDKBolt11InvoiceFeatures this_arg_conv;
56795         this_arg_conv.inner = untag_ptr(this_arg);
56796         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56798         this_arg_conv.is_owned = false;
56799         jboolean ret_conv = Bolt11InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
56800         return ret_conv;
56801 }
56802
56803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56804         LDKInitFeatures this_arg_conv;
56805         this_arg_conv.inner = untag_ptr(this_arg);
56806         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56808         this_arg_conv.is_owned = false;
56809         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
56810 }
56811
56812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56813         LDKInitFeatures this_arg_conv;
56814         this_arg_conv.inner = untag_ptr(this_arg);
56815         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56817         this_arg_conv.is_owned = false;
56818         InitFeatures_set_static_remote_key_required(&this_arg_conv);
56819 }
56820
56821 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
56822         LDKInitFeatures this_arg_conv;
56823         this_arg_conv.inner = untag_ptr(this_arg);
56824         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56826         this_arg_conv.is_owned = false;
56827         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
56828         return ret_conv;
56829 }
56830
56831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56832         LDKNodeFeatures this_arg_conv;
56833         this_arg_conv.inner = untag_ptr(this_arg);
56834         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56836         this_arg_conv.is_owned = false;
56837         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
56838 }
56839
56840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56841         LDKNodeFeatures this_arg_conv;
56842         this_arg_conv.inner = untag_ptr(this_arg);
56843         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56845         this_arg_conv.is_owned = false;
56846         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
56847 }
56848
56849 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
56850         LDKNodeFeatures this_arg_conv;
56851         this_arg_conv.inner = untag_ptr(this_arg);
56852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56854         this_arg_conv.is_owned = false;
56855         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
56856         return ret_conv;
56857 }
56858
56859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56860         LDKChannelTypeFeatures this_arg_conv;
56861         this_arg_conv.inner = untag_ptr(this_arg);
56862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56864         this_arg_conv.is_owned = false;
56865         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
56866 }
56867
56868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56869         LDKChannelTypeFeatures this_arg_conv;
56870         this_arg_conv.inner = untag_ptr(this_arg);
56871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56873         this_arg_conv.is_owned = false;
56874         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
56875 }
56876
56877 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
56878         LDKChannelTypeFeatures this_arg_conv;
56879         this_arg_conv.inner = untag_ptr(this_arg);
56880         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56882         this_arg_conv.is_owned = false;
56883         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
56884         return ret_conv;
56885 }
56886
56887 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
56888         LDKInitFeatures this_arg_conv;
56889         this_arg_conv.inner = untag_ptr(this_arg);
56890         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56892         this_arg_conv.is_owned = false;
56893         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
56894         return ret_conv;
56895 }
56896
56897 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
56898         LDKNodeFeatures this_arg_conv;
56899         this_arg_conv.inner = untag_ptr(this_arg);
56900         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56902         this_arg_conv.is_owned = false;
56903         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
56904         return ret_conv;
56905 }
56906
56907 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
56908         LDKChannelTypeFeatures this_arg_conv;
56909         this_arg_conv.inner = untag_ptr(this_arg);
56910         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56912         this_arg_conv.is_owned = false;
56913         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
56914         return ret_conv;
56915 }
56916
56917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56918         LDKInitFeatures this_arg_conv;
56919         this_arg_conv.inner = untag_ptr(this_arg);
56920         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56922         this_arg_conv.is_owned = false;
56923         InitFeatures_set_payment_secret_optional(&this_arg_conv);
56924 }
56925
56926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56927         LDKInitFeatures this_arg_conv;
56928         this_arg_conv.inner = untag_ptr(this_arg);
56929         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56931         this_arg_conv.is_owned = false;
56932         InitFeatures_set_payment_secret_required(&this_arg_conv);
56933 }
56934
56935 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
56936         LDKInitFeatures this_arg_conv;
56937         this_arg_conv.inner = untag_ptr(this_arg);
56938         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56940         this_arg_conv.is_owned = false;
56941         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
56942         return ret_conv;
56943 }
56944
56945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56946         LDKNodeFeatures this_arg_conv;
56947         this_arg_conv.inner = untag_ptr(this_arg);
56948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56950         this_arg_conv.is_owned = false;
56951         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
56952 }
56953
56954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56955         LDKNodeFeatures this_arg_conv;
56956         this_arg_conv.inner = untag_ptr(this_arg);
56957         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56959         this_arg_conv.is_owned = false;
56960         NodeFeatures_set_payment_secret_required(&this_arg_conv);
56961 }
56962
56963 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
56964         LDKNodeFeatures this_arg_conv;
56965         this_arg_conv.inner = untag_ptr(this_arg);
56966         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56968         this_arg_conv.is_owned = false;
56969         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
56970         return ret_conv;
56971 }
56972
56973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56974         LDKBolt11InvoiceFeatures this_arg_conv;
56975         this_arg_conv.inner = untag_ptr(this_arg);
56976         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56978         this_arg_conv.is_owned = false;
56979         Bolt11InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
56980 }
56981
56982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56983         LDKBolt11InvoiceFeatures this_arg_conv;
56984         this_arg_conv.inner = untag_ptr(this_arg);
56985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56987         this_arg_conv.is_owned = false;
56988         Bolt11InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
56989 }
56990
56991 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
56992         LDKBolt11InvoiceFeatures this_arg_conv;
56993         this_arg_conv.inner = untag_ptr(this_arg);
56994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56996         this_arg_conv.is_owned = false;
56997         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_secret(&this_arg_conv);
56998         return ret_conv;
56999 }
57000
57001 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
57002         LDKInitFeatures this_arg_conv;
57003         this_arg_conv.inner = untag_ptr(this_arg);
57004         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57006         this_arg_conv.is_owned = false;
57007         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
57008         return ret_conv;
57009 }
57010
57011 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
57012         LDKNodeFeatures this_arg_conv;
57013         this_arg_conv.inner = untag_ptr(this_arg);
57014         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57016         this_arg_conv.is_owned = false;
57017         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
57018         return ret_conv;
57019 }
57020
57021 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
57022         LDKBolt11InvoiceFeatures this_arg_conv;
57023         this_arg_conv.inner = untag_ptr(this_arg);
57024         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57026         this_arg_conv.is_owned = false;
57027         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_secret(&this_arg_conv);
57028         return ret_conv;
57029 }
57030
57031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57032         LDKInitFeatures this_arg_conv;
57033         this_arg_conv.inner = untag_ptr(this_arg);
57034         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57036         this_arg_conv.is_owned = false;
57037         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
57038 }
57039
57040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57041         LDKInitFeatures this_arg_conv;
57042         this_arg_conv.inner = untag_ptr(this_arg);
57043         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57045         this_arg_conv.is_owned = false;
57046         InitFeatures_set_basic_mpp_required(&this_arg_conv);
57047 }
57048
57049 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
57050         LDKInitFeatures this_arg_conv;
57051         this_arg_conv.inner = untag_ptr(this_arg);
57052         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57054         this_arg_conv.is_owned = false;
57055         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
57056         return ret_conv;
57057 }
57058
57059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57060         LDKNodeFeatures this_arg_conv;
57061         this_arg_conv.inner = untag_ptr(this_arg);
57062         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57064         this_arg_conv.is_owned = false;
57065         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
57066 }
57067
57068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57069         LDKNodeFeatures this_arg_conv;
57070         this_arg_conv.inner = untag_ptr(this_arg);
57071         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57073         this_arg_conv.is_owned = false;
57074         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
57075 }
57076
57077 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
57078         LDKNodeFeatures this_arg_conv;
57079         this_arg_conv.inner = untag_ptr(this_arg);
57080         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57082         this_arg_conv.is_owned = false;
57083         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
57084         return ret_conv;
57085 }
57086
57087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57088         LDKBolt11InvoiceFeatures this_arg_conv;
57089         this_arg_conv.inner = untag_ptr(this_arg);
57090         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57092         this_arg_conv.is_owned = false;
57093         Bolt11InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
57094 }
57095
57096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57097         LDKBolt11InvoiceFeatures this_arg_conv;
57098         this_arg_conv.inner = untag_ptr(this_arg);
57099         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57101         this_arg_conv.is_owned = false;
57102         Bolt11InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
57103 }
57104
57105 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
57106         LDKBolt11InvoiceFeatures this_arg_conv;
57107         this_arg_conv.inner = untag_ptr(this_arg);
57108         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57110         this_arg_conv.is_owned = false;
57111         jboolean ret_conv = Bolt11InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
57112         return ret_conv;
57113 }
57114
57115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57116         LDKBolt12InvoiceFeatures this_arg_conv;
57117         this_arg_conv.inner = untag_ptr(this_arg);
57118         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57120         this_arg_conv.is_owned = false;
57121         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
57122 }
57123
57124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57125         LDKBolt12InvoiceFeatures this_arg_conv;
57126         this_arg_conv.inner = untag_ptr(this_arg);
57127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57129         this_arg_conv.is_owned = false;
57130         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
57131 }
57132
57133 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
57134         LDKBolt12InvoiceFeatures this_arg_conv;
57135         this_arg_conv.inner = untag_ptr(this_arg);
57136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57138         this_arg_conv.is_owned = false;
57139         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
57140         return ret_conv;
57141 }
57142
57143 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
57144         LDKInitFeatures this_arg_conv;
57145         this_arg_conv.inner = untag_ptr(this_arg);
57146         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57148         this_arg_conv.is_owned = false;
57149         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
57150         return ret_conv;
57151 }
57152
57153 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
57154         LDKNodeFeatures this_arg_conv;
57155         this_arg_conv.inner = untag_ptr(this_arg);
57156         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57158         this_arg_conv.is_owned = false;
57159         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
57160         return ret_conv;
57161 }
57162
57163 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
57164         LDKBolt11InvoiceFeatures this_arg_conv;
57165         this_arg_conv.inner = untag_ptr(this_arg);
57166         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57168         this_arg_conv.is_owned = false;
57169         jboolean ret_conv = Bolt11InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
57170         return ret_conv;
57171 }
57172
57173 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
57174         LDKBolt12InvoiceFeatures this_arg_conv;
57175         this_arg_conv.inner = untag_ptr(this_arg);
57176         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57178         this_arg_conv.is_owned = false;
57179         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
57180         return ret_conv;
57181 }
57182
57183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57184         LDKInitFeatures this_arg_conv;
57185         this_arg_conv.inner = untag_ptr(this_arg);
57186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57188         this_arg_conv.is_owned = false;
57189         InitFeatures_set_wumbo_optional(&this_arg_conv);
57190 }
57191
57192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57193         LDKInitFeatures this_arg_conv;
57194         this_arg_conv.inner = untag_ptr(this_arg);
57195         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57197         this_arg_conv.is_owned = false;
57198         InitFeatures_set_wumbo_required(&this_arg_conv);
57199 }
57200
57201 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
57202         LDKInitFeatures this_arg_conv;
57203         this_arg_conv.inner = untag_ptr(this_arg);
57204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57206         this_arg_conv.is_owned = false;
57207         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
57208         return ret_conv;
57209 }
57210
57211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57212         LDKNodeFeatures this_arg_conv;
57213         this_arg_conv.inner = untag_ptr(this_arg);
57214         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57216         this_arg_conv.is_owned = false;
57217         NodeFeatures_set_wumbo_optional(&this_arg_conv);
57218 }
57219
57220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57221         LDKNodeFeatures this_arg_conv;
57222         this_arg_conv.inner = untag_ptr(this_arg);
57223         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57225         this_arg_conv.is_owned = false;
57226         NodeFeatures_set_wumbo_required(&this_arg_conv);
57227 }
57228
57229 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
57230         LDKNodeFeatures this_arg_conv;
57231         this_arg_conv.inner = untag_ptr(this_arg);
57232         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57234         this_arg_conv.is_owned = false;
57235         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
57236         return ret_conv;
57237 }
57238
57239 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
57240         LDKInitFeatures this_arg_conv;
57241         this_arg_conv.inner = untag_ptr(this_arg);
57242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57244         this_arg_conv.is_owned = false;
57245         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
57246         return ret_conv;
57247 }
57248
57249 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
57250         LDKNodeFeatures this_arg_conv;
57251         this_arg_conv.inner = untag_ptr(this_arg);
57252         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57254         this_arg_conv.is_owned = false;
57255         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
57256         return ret_conv;
57257 }
57258
57259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57260         LDKInitFeatures this_arg_conv;
57261         this_arg_conv.inner = untag_ptr(this_arg);
57262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57264         this_arg_conv.is_owned = false;
57265         InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
57266 }
57267
57268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57269         LDKInitFeatures this_arg_conv;
57270         this_arg_conv.inner = untag_ptr(this_arg);
57271         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57273         this_arg_conv.is_owned = false;
57274         InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
57275 }
57276
57277 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
57278         LDKInitFeatures this_arg_conv;
57279         this_arg_conv.inner = untag_ptr(this_arg);
57280         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57282         this_arg_conv.is_owned = false;
57283         jboolean ret_conv = InitFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57284         return ret_conv;
57285 }
57286
57287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57288         LDKNodeFeatures this_arg_conv;
57289         this_arg_conv.inner = untag_ptr(this_arg);
57290         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57292         this_arg_conv.is_owned = false;
57293         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
57294 }
57295
57296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57297         LDKNodeFeatures this_arg_conv;
57298         this_arg_conv.inner = untag_ptr(this_arg);
57299         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57301         this_arg_conv.is_owned = false;
57302         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
57303 }
57304
57305 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
57306         LDKNodeFeatures this_arg_conv;
57307         this_arg_conv.inner = untag_ptr(this_arg);
57308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57310         this_arg_conv.is_owned = false;
57311         jboolean ret_conv = NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57312         return ret_conv;
57313 }
57314
57315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57316         LDKChannelTypeFeatures this_arg_conv;
57317         this_arg_conv.inner = untag_ptr(this_arg);
57318         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57320         this_arg_conv.is_owned = false;
57321         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
57322 }
57323
57324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57325         LDKChannelTypeFeatures this_arg_conv;
57326         this_arg_conv.inner = untag_ptr(this_arg);
57327         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57329         this_arg_conv.is_owned = false;
57330         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
57331 }
57332
57333 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
57334         LDKChannelTypeFeatures this_arg_conv;
57335         this_arg_conv.inner = untag_ptr(this_arg);
57336         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57338         this_arg_conv.is_owned = false;
57339         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57340         return ret_conv;
57341 }
57342
57343 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
57344         LDKInitFeatures this_arg_conv;
57345         this_arg_conv.inner = untag_ptr(this_arg);
57346         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57348         this_arg_conv.is_owned = false;
57349         jboolean ret_conv = InitFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57350         return ret_conv;
57351 }
57352
57353 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
57354         LDKNodeFeatures this_arg_conv;
57355         this_arg_conv.inner = untag_ptr(this_arg);
57356         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57358         this_arg_conv.is_owned = false;
57359         jboolean ret_conv = NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57360         return ret_conv;
57361 }
57362
57363 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
57364         LDKChannelTypeFeatures this_arg_conv;
57365         this_arg_conv.inner = untag_ptr(this_arg);
57366         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57368         this_arg_conv.is_owned = false;
57369         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57370         return ret_conv;
57371 }
57372
57373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57374         LDKInitFeatures this_arg_conv;
57375         this_arg_conv.inner = untag_ptr(this_arg);
57376         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57378         this_arg_conv.is_owned = false;
57379         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
57380 }
57381
57382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57383         LDKInitFeatures this_arg_conv;
57384         this_arg_conv.inner = untag_ptr(this_arg);
57385         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57387         this_arg_conv.is_owned = false;
57388         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
57389 }
57390
57391 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
57392         LDKInitFeatures this_arg_conv;
57393         this_arg_conv.inner = untag_ptr(this_arg);
57394         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57396         this_arg_conv.is_owned = false;
57397         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
57398         return ret_conv;
57399 }
57400
57401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57402         LDKNodeFeatures this_arg_conv;
57403         this_arg_conv.inner = untag_ptr(this_arg);
57404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57406         this_arg_conv.is_owned = false;
57407         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
57408 }
57409
57410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57411         LDKNodeFeatures this_arg_conv;
57412         this_arg_conv.inner = untag_ptr(this_arg);
57413         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57415         this_arg_conv.is_owned = false;
57416         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
57417 }
57418
57419 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
57420         LDKNodeFeatures this_arg_conv;
57421         this_arg_conv.inner = untag_ptr(this_arg);
57422         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57424         this_arg_conv.is_owned = false;
57425         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
57426         return ret_conv;
57427 }
57428
57429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57430         LDKChannelTypeFeatures this_arg_conv;
57431         this_arg_conv.inner = untag_ptr(this_arg);
57432         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57434         this_arg_conv.is_owned = false;
57435         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
57436 }
57437
57438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57439         LDKChannelTypeFeatures this_arg_conv;
57440         this_arg_conv.inner = untag_ptr(this_arg);
57441         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57443         this_arg_conv.is_owned = false;
57444         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
57445 }
57446
57447 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
57448         LDKChannelTypeFeatures this_arg_conv;
57449         this_arg_conv.inner = untag_ptr(this_arg);
57450         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57452         this_arg_conv.is_owned = false;
57453         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
57454         return ret_conv;
57455 }
57456
57457 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
57458         LDKInitFeatures this_arg_conv;
57459         this_arg_conv.inner = untag_ptr(this_arg);
57460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57462         this_arg_conv.is_owned = false;
57463         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
57464         return ret_conv;
57465 }
57466
57467 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
57468         LDKNodeFeatures this_arg_conv;
57469         this_arg_conv.inner = untag_ptr(this_arg);
57470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57472         this_arg_conv.is_owned = false;
57473         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
57474         return ret_conv;
57475 }
57476
57477 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
57478         LDKChannelTypeFeatures this_arg_conv;
57479         this_arg_conv.inner = untag_ptr(this_arg);
57480         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57482         this_arg_conv.is_owned = false;
57483         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
57484         return ret_conv;
57485 }
57486
57487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57488         LDKInitFeatures this_arg_conv;
57489         this_arg_conv.inner = untag_ptr(this_arg);
57490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57492         this_arg_conv.is_owned = false;
57493         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
57494 }
57495
57496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57497         LDKInitFeatures this_arg_conv;
57498         this_arg_conv.inner = untag_ptr(this_arg);
57499         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57501         this_arg_conv.is_owned = false;
57502         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
57503 }
57504
57505 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
57506         LDKInitFeatures this_arg_conv;
57507         this_arg_conv.inner = untag_ptr(this_arg);
57508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57510         this_arg_conv.is_owned = false;
57511         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
57512         return ret_conv;
57513 }
57514
57515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57516         LDKNodeFeatures this_arg_conv;
57517         this_arg_conv.inner = untag_ptr(this_arg);
57518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57520         this_arg_conv.is_owned = false;
57521         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
57522 }
57523
57524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57525         LDKNodeFeatures this_arg_conv;
57526         this_arg_conv.inner = untag_ptr(this_arg);
57527         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57529         this_arg_conv.is_owned = false;
57530         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
57531 }
57532
57533 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
57534         LDKNodeFeatures this_arg_conv;
57535         this_arg_conv.inner = untag_ptr(this_arg);
57536         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57538         this_arg_conv.is_owned = false;
57539         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
57540         return ret_conv;
57541 }
57542
57543 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
57544         LDKInitFeatures this_arg_conv;
57545         this_arg_conv.inner = untag_ptr(this_arg);
57546         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57548         this_arg_conv.is_owned = false;
57549         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
57550         return ret_conv;
57551 }
57552
57553 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
57554         LDKNodeFeatures this_arg_conv;
57555         this_arg_conv.inner = untag_ptr(this_arg);
57556         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57558         this_arg_conv.is_owned = false;
57559         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
57560         return ret_conv;
57561 }
57562
57563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1taproot_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57564         LDKInitFeatures this_arg_conv;
57565         this_arg_conv.inner = untag_ptr(this_arg);
57566         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57568         this_arg_conv.is_owned = false;
57569         InitFeatures_set_taproot_optional(&this_arg_conv);
57570 }
57571
57572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1taproot_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57573         LDKInitFeatures this_arg_conv;
57574         this_arg_conv.inner = untag_ptr(this_arg);
57575         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57577         this_arg_conv.is_owned = false;
57578         InitFeatures_set_taproot_required(&this_arg_conv);
57579 }
57580
57581 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
57582         LDKInitFeatures this_arg_conv;
57583         this_arg_conv.inner = untag_ptr(this_arg);
57584         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57586         this_arg_conv.is_owned = false;
57587         jboolean ret_conv = InitFeatures_supports_taproot(&this_arg_conv);
57588         return ret_conv;
57589 }
57590
57591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1taproot_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57592         LDKNodeFeatures this_arg_conv;
57593         this_arg_conv.inner = untag_ptr(this_arg);
57594         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57596         this_arg_conv.is_owned = false;
57597         NodeFeatures_set_taproot_optional(&this_arg_conv);
57598 }
57599
57600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1taproot_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57601         LDKNodeFeatures this_arg_conv;
57602         this_arg_conv.inner = untag_ptr(this_arg);
57603         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57605         this_arg_conv.is_owned = false;
57606         NodeFeatures_set_taproot_required(&this_arg_conv);
57607 }
57608
57609 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
57610         LDKNodeFeatures this_arg_conv;
57611         this_arg_conv.inner = untag_ptr(this_arg);
57612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57614         this_arg_conv.is_owned = false;
57615         jboolean ret_conv = NodeFeatures_supports_taproot(&this_arg_conv);
57616         return ret_conv;
57617 }
57618
57619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1taproot_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57620         LDKChannelTypeFeatures this_arg_conv;
57621         this_arg_conv.inner = untag_ptr(this_arg);
57622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57624         this_arg_conv.is_owned = false;
57625         ChannelTypeFeatures_set_taproot_optional(&this_arg_conv);
57626 }
57627
57628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1taproot_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57629         LDKChannelTypeFeatures this_arg_conv;
57630         this_arg_conv.inner = untag_ptr(this_arg);
57631         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57633         this_arg_conv.is_owned = false;
57634         ChannelTypeFeatures_set_taproot_required(&this_arg_conv);
57635 }
57636
57637 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
57638         LDKChannelTypeFeatures this_arg_conv;
57639         this_arg_conv.inner = untag_ptr(this_arg);
57640         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57642         this_arg_conv.is_owned = false;
57643         jboolean ret_conv = ChannelTypeFeatures_supports_taproot(&this_arg_conv);
57644         return ret_conv;
57645 }
57646
57647 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
57648         LDKInitFeatures this_arg_conv;
57649         this_arg_conv.inner = untag_ptr(this_arg);
57650         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57652         this_arg_conv.is_owned = false;
57653         jboolean ret_conv = InitFeatures_requires_taproot(&this_arg_conv);
57654         return ret_conv;
57655 }
57656
57657 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
57658         LDKNodeFeatures this_arg_conv;
57659         this_arg_conv.inner = untag_ptr(this_arg);
57660         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57662         this_arg_conv.is_owned = false;
57663         jboolean ret_conv = NodeFeatures_requires_taproot(&this_arg_conv);
57664         return ret_conv;
57665 }
57666
57667 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
57668         LDKChannelTypeFeatures this_arg_conv;
57669         this_arg_conv.inner = untag_ptr(this_arg);
57670         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57672         this_arg_conv.is_owned = false;
57673         jboolean ret_conv = ChannelTypeFeatures_requires_taproot(&this_arg_conv);
57674         return ret_conv;
57675 }
57676
57677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1onion_1messages_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57678         LDKInitFeatures 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.is_owned = false;
57683         InitFeatures_set_onion_messages_optional(&this_arg_conv);
57684 }
57685
57686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1onion_1messages_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57687         LDKInitFeatures this_arg_conv;
57688         this_arg_conv.inner = untag_ptr(this_arg);
57689         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57691         this_arg_conv.is_owned = false;
57692         InitFeatures_set_onion_messages_required(&this_arg_conv);
57693 }
57694
57695 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
57696         LDKInitFeatures this_arg_conv;
57697         this_arg_conv.inner = untag_ptr(this_arg);
57698         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57700         this_arg_conv.is_owned = false;
57701         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
57702         return ret_conv;
57703 }
57704
57705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1onion_1messages_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57706         LDKNodeFeatures this_arg_conv;
57707         this_arg_conv.inner = untag_ptr(this_arg);
57708         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57710         this_arg_conv.is_owned = false;
57711         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
57712 }
57713
57714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1onion_1messages_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57715         LDKNodeFeatures this_arg_conv;
57716         this_arg_conv.inner = untag_ptr(this_arg);
57717         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57719         this_arg_conv.is_owned = false;
57720         NodeFeatures_set_onion_messages_required(&this_arg_conv);
57721 }
57722
57723 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
57724         LDKNodeFeatures this_arg_conv;
57725         this_arg_conv.inner = untag_ptr(this_arg);
57726         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57728         this_arg_conv.is_owned = false;
57729         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
57730         return ret_conv;
57731 }
57732
57733 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
57734         LDKInitFeatures this_arg_conv;
57735         this_arg_conv.inner = untag_ptr(this_arg);
57736         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57738         this_arg_conv.is_owned = false;
57739         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
57740         return ret_conv;
57741 }
57742
57743 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
57744         LDKNodeFeatures this_arg_conv;
57745         this_arg_conv.inner = untag_ptr(this_arg);
57746         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57748         this_arg_conv.is_owned = false;
57749         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
57750         return ret_conv;
57751 }
57752
57753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57754         LDKInitFeatures this_arg_conv;
57755         this_arg_conv.inner = untag_ptr(this_arg);
57756         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57758         this_arg_conv.is_owned = false;
57759         InitFeatures_set_channel_type_optional(&this_arg_conv);
57760 }
57761
57762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57763         LDKInitFeatures this_arg_conv;
57764         this_arg_conv.inner = untag_ptr(this_arg);
57765         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57767         this_arg_conv.is_owned = false;
57768         InitFeatures_set_channel_type_required(&this_arg_conv);
57769 }
57770
57771 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
57772         LDKInitFeatures this_arg_conv;
57773         this_arg_conv.inner = untag_ptr(this_arg);
57774         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57776         this_arg_conv.is_owned = false;
57777         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
57778         return ret_conv;
57779 }
57780
57781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57782         LDKNodeFeatures this_arg_conv;
57783         this_arg_conv.inner = untag_ptr(this_arg);
57784         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57786         this_arg_conv.is_owned = false;
57787         NodeFeatures_set_channel_type_optional(&this_arg_conv);
57788 }
57789
57790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57791         LDKNodeFeatures this_arg_conv;
57792         this_arg_conv.inner = untag_ptr(this_arg);
57793         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57795         this_arg_conv.is_owned = false;
57796         NodeFeatures_set_channel_type_required(&this_arg_conv);
57797 }
57798
57799 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
57800         LDKNodeFeatures this_arg_conv;
57801         this_arg_conv.inner = untag_ptr(this_arg);
57802         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57804         this_arg_conv.is_owned = false;
57805         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
57806         return ret_conv;
57807 }
57808
57809 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
57810         LDKInitFeatures this_arg_conv;
57811         this_arg_conv.inner = untag_ptr(this_arg);
57812         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57814         this_arg_conv.is_owned = false;
57815         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
57816         return ret_conv;
57817 }
57818
57819 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
57820         LDKNodeFeatures this_arg_conv;
57821         this_arg_conv.inner = untag_ptr(this_arg);
57822         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57824         this_arg_conv.is_owned = false;
57825         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
57826         return ret_conv;
57827 }
57828
57829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57830         LDKInitFeatures this_arg_conv;
57831         this_arg_conv.inner = untag_ptr(this_arg);
57832         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57834         this_arg_conv.is_owned = false;
57835         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
57836 }
57837
57838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57839         LDKInitFeatures this_arg_conv;
57840         this_arg_conv.inner = untag_ptr(this_arg);
57841         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57843         this_arg_conv.is_owned = false;
57844         InitFeatures_set_scid_privacy_required(&this_arg_conv);
57845 }
57846
57847 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
57848         LDKInitFeatures this_arg_conv;
57849         this_arg_conv.inner = untag_ptr(this_arg);
57850         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57852         this_arg_conv.is_owned = false;
57853         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
57854         return ret_conv;
57855 }
57856
57857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57858         LDKNodeFeatures this_arg_conv;
57859         this_arg_conv.inner = untag_ptr(this_arg);
57860         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57862         this_arg_conv.is_owned = false;
57863         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
57864 }
57865
57866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57867         LDKNodeFeatures this_arg_conv;
57868         this_arg_conv.inner = untag_ptr(this_arg);
57869         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57871         this_arg_conv.is_owned = false;
57872         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
57873 }
57874
57875 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
57876         LDKNodeFeatures this_arg_conv;
57877         this_arg_conv.inner = untag_ptr(this_arg);
57878         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57880         this_arg_conv.is_owned = false;
57881         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
57882         return ret_conv;
57883 }
57884
57885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57886         LDKChannelTypeFeatures this_arg_conv;
57887         this_arg_conv.inner = untag_ptr(this_arg);
57888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57890         this_arg_conv.is_owned = false;
57891         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
57892 }
57893
57894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57895         LDKChannelTypeFeatures this_arg_conv;
57896         this_arg_conv.inner = untag_ptr(this_arg);
57897         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57899         this_arg_conv.is_owned = false;
57900         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
57901 }
57902
57903 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
57904         LDKChannelTypeFeatures this_arg_conv;
57905         this_arg_conv.inner = untag_ptr(this_arg);
57906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57908         this_arg_conv.is_owned = false;
57909         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
57910         return ret_conv;
57911 }
57912
57913 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
57914         LDKInitFeatures this_arg_conv;
57915         this_arg_conv.inner = untag_ptr(this_arg);
57916         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57918         this_arg_conv.is_owned = false;
57919         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
57920         return ret_conv;
57921 }
57922
57923 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
57924         LDKNodeFeatures this_arg_conv;
57925         this_arg_conv.inner = untag_ptr(this_arg);
57926         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57928         this_arg_conv.is_owned = false;
57929         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
57930         return ret_conv;
57931 }
57932
57933 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
57934         LDKChannelTypeFeatures this_arg_conv;
57935         this_arg_conv.inner = untag_ptr(this_arg);
57936         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57938         this_arg_conv.is_owned = false;
57939         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
57940         return ret_conv;
57941 }
57942
57943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1metadata_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57944         LDKBolt11InvoiceFeatures this_arg_conv;
57945         this_arg_conv.inner = untag_ptr(this_arg);
57946         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57948         this_arg_conv.is_owned = false;
57949         Bolt11InvoiceFeatures_set_payment_metadata_optional(&this_arg_conv);
57950 }
57951
57952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1metadata_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57953         LDKBolt11InvoiceFeatures this_arg_conv;
57954         this_arg_conv.inner = untag_ptr(this_arg);
57955         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57957         this_arg_conv.is_owned = false;
57958         Bolt11InvoiceFeatures_set_payment_metadata_required(&this_arg_conv);
57959 }
57960
57961 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
57962         LDKBolt11InvoiceFeatures this_arg_conv;
57963         this_arg_conv.inner = untag_ptr(this_arg);
57964         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57966         this_arg_conv.is_owned = false;
57967         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_metadata(&this_arg_conv);
57968         return ret_conv;
57969 }
57970
57971 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
57972         LDKBolt11InvoiceFeatures this_arg_conv;
57973         this_arg_conv.inner = untag_ptr(this_arg);
57974         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57976         this_arg_conv.is_owned = false;
57977         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_metadata(&this_arg_conv);
57978         return ret_conv;
57979 }
57980
57981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57982         LDKInitFeatures this_arg_conv;
57983         this_arg_conv.inner = untag_ptr(this_arg);
57984         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57986         this_arg_conv.is_owned = false;
57987         InitFeatures_set_zero_conf_optional(&this_arg_conv);
57988 }
57989
57990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57991         LDKInitFeatures this_arg_conv;
57992         this_arg_conv.inner = untag_ptr(this_arg);
57993         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57995         this_arg_conv.is_owned = false;
57996         InitFeatures_set_zero_conf_required(&this_arg_conv);
57997 }
57998
57999 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
58000         LDKInitFeatures this_arg_conv;
58001         this_arg_conv.inner = untag_ptr(this_arg);
58002         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58004         this_arg_conv.is_owned = false;
58005         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
58006         return ret_conv;
58007 }
58008
58009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
58010         LDKNodeFeatures this_arg_conv;
58011         this_arg_conv.inner = untag_ptr(this_arg);
58012         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58014         this_arg_conv.is_owned = false;
58015         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
58016 }
58017
58018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
58019         LDKNodeFeatures this_arg_conv;
58020         this_arg_conv.inner = untag_ptr(this_arg);
58021         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58023         this_arg_conv.is_owned = false;
58024         NodeFeatures_set_zero_conf_required(&this_arg_conv);
58025 }
58026
58027 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
58028         LDKNodeFeatures this_arg_conv;
58029         this_arg_conv.inner = untag_ptr(this_arg);
58030         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58032         this_arg_conv.is_owned = false;
58033         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
58034         return ret_conv;
58035 }
58036
58037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
58038         LDKChannelTypeFeatures this_arg_conv;
58039         this_arg_conv.inner = untag_ptr(this_arg);
58040         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58042         this_arg_conv.is_owned = false;
58043         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
58044 }
58045
58046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
58047         LDKChannelTypeFeatures this_arg_conv;
58048         this_arg_conv.inner = untag_ptr(this_arg);
58049         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58051         this_arg_conv.is_owned = false;
58052         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
58053 }
58054
58055 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
58056         LDKChannelTypeFeatures this_arg_conv;
58057         this_arg_conv.inner = untag_ptr(this_arg);
58058         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58060         this_arg_conv.is_owned = false;
58061         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
58062         return ret_conv;
58063 }
58064
58065 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
58066         LDKInitFeatures this_arg_conv;
58067         this_arg_conv.inner = untag_ptr(this_arg);
58068         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58070         this_arg_conv.is_owned = false;
58071         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
58072         return ret_conv;
58073 }
58074
58075 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
58076         LDKNodeFeatures this_arg_conv;
58077         this_arg_conv.inner = untag_ptr(this_arg);
58078         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58080         this_arg_conv.is_owned = false;
58081         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
58082         return ret_conv;
58083 }
58084
58085 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
58086         LDKChannelTypeFeatures this_arg_conv;
58087         this_arg_conv.inner = untag_ptr(this_arg);
58088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58090         this_arg_conv.is_owned = false;
58091         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
58092         return ret_conv;
58093 }
58094
58095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
58096         LDKNodeFeatures this_arg_conv;
58097         this_arg_conv.inner = untag_ptr(this_arg);
58098         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58100         this_arg_conv.is_owned = false;
58101         NodeFeatures_set_keysend_optional(&this_arg_conv);
58102 }
58103
58104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
58105         LDKNodeFeatures this_arg_conv;
58106         this_arg_conv.inner = untag_ptr(this_arg);
58107         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58109         this_arg_conv.is_owned = false;
58110         NodeFeatures_set_keysend_required(&this_arg_conv);
58111 }
58112
58113 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
58114         LDKNodeFeatures this_arg_conv;
58115         this_arg_conv.inner = untag_ptr(this_arg);
58116         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58118         this_arg_conv.is_owned = false;
58119         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
58120         return ret_conv;
58121 }
58122
58123 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
58124         LDKNodeFeatures this_arg_conv;
58125         this_arg_conv.inner = untag_ptr(this_arg);
58126         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58128         this_arg_conv.is_owned = false;
58129         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
58130         return ret_conv;
58131 }
58132
58133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58134         LDKShutdownScript this_obj_conv;
58135         this_obj_conv.inner = untag_ptr(this_obj);
58136         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58138         ShutdownScript_free(this_obj_conv);
58139 }
58140
58141 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
58142         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
58143         int64_t ret_ref = 0;
58144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58146         return ret_ref;
58147 }
58148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58149         LDKShutdownScript arg_conv;
58150         arg_conv.inner = untag_ptr(arg);
58151         arg_conv.is_owned = ptr_is_owned(arg);
58152         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58153         arg_conv.is_owned = false;
58154         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
58155         return ret_conv;
58156 }
58157
58158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58159         LDKShutdownScript orig_conv;
58160         orig_conv.inner = untag_ptr(orig);
58161         orig_conv.is_owned = ptr_is_owned(orig);
58162         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58163         orig_conv.is_owned = false;
58164         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
58165         int64_t ret_ref = 0;
58166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58168         return ret_ref;
58169 }
58170
58171 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58172         LDKShutdownScript a_conv;
58173         a_conv.inner = untag_ptr(a);
58174         a_conv.is_owned = ptr_is_owned(a);
58175         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58176         a_conv.is_owned = false;
58177         LDKShutdownScript b_conv;
58178         b_conv.inner = untag_ptr(b);
58179         b_conv.is_owned = ptr_is_owned(b);
58180         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58181         b_conv.is_owned = false;
58182         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
58183         return ret_conv;
58184 }
58185
58186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58187         LDKInvalidShutdownScript this_obj_conv;
58188         this_obj_conv.inner = untag_ptr(this_obj);
58189         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58191         InvalidShutdownScript_free(this_obj_conv);
58192 }
58193
58194 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
58195         LDKInvalidShutdownScript this_ptr_conv;
58196         this_ptr_conv.inner = untag_ptr(this_ptr);
58197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58199         this_ptr_conv.is_owned = false;
58200         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
58201         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58202         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58203         return ret_arr;
58204 }
58205
58206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58207         LDKInvalidShutdownScript this_ptr_conv;
58208         this_ptr_conv.inner = untag_ptr(this_ptr);
58209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58211         this_ptr_conv.is_owned = false;
58212         LDKCVec_u8Z val_ref;
58213         val_ref.datalen = (*env)->GetArrayLength(env, val);
58214         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
58215         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
58216         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
58217 }
58218
58219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
58220         LDKCVec_u8Z script_arg_ref;
58221         script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
58222         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
58223         (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
58224         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
58225         int64_t ret_ref = 0;
58226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58228         return ret_ref;
58229 }
58230
58231 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
58232         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
58233         int64_t ret_ref = 0;
58234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58236         return ret_ref;
58237 }
58238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58239         LDKInvalidShutdownScript arg_conv;
58240         arg_conv.inner = untag_ptr(arg);
58241         arg_conv.is_owned = ptr_is_owned(arg);
58242         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58243         arg_conv.is_owned = false;
58244         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
58245         return ret_conv;
58246 }
58247
58248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58249         LDKInvalidShutdownScript orig_conv;
58250         orig_conv.inner = untag_ptr(orig);
58251         orig_conv.is_owned = ptr_is_owned(orig);
58252         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58253         orig_conv.is_owned = false;
58254         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
58255         int64_t ret_ref = 0;
58256         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58257         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58258         return ret_ref;
58259 }
58260
58261 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
58262         LDKShutdownScript obj_conv;
58263         obj_conv.inner = untag_ptr(obj);
58264         obj_conv.is_owned = ptr_is_owned(obj);
58265         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58266         obj_conv.is_owned = false;
58267         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
58268         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58269         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58270         CVec_u8Z_free(ret_var);
58271         return ret_arr;
58272 }
58273
58274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
58275         LDKu8slice ser_ref;
58276         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
58277         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
58278         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
58279         *ret_conv = ShutdownScript_read(ser_ref);
58280         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
58281         return tag_ptr(ret_conv, true);
58282 }
58283
58284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
58285         uint8_t pubkey_hash_arr[20];
58286         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
58287         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
58288         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
58289         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
58290         int64_t ret_ref = 0;
58291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58293         return ret_ref;
58294 }
58295
58296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
58297         uint8_t script_hash_arr[32];
58298         CHECK((*env)->GetArrayLength(env, script_hash) == 32);
58299         (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
58300         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
58301         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
58302         int64_t ret_ref = 0;
58303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58305         return ret_ref;
58306 }
58307
58308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
58309         
58310         LDKu8slice program_ref;
58311         program_ref.datalen = (*env)->GetArrayLength(env, program);
58312         program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
58313         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
58314         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
58315         (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
58316         return tag_ptr(ret_conv, true);
58317 }
58318
58319 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
58320         LDKShutdownScript this_arg_conv;
58321         this_arg_conv.inner = untag_ptr(this_arg);
58322         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58324         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
58325         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
58326         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58327         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58328         CVec_u8Z_free(ret_var);
58329         return ret_arr;
58330 }
58331
58332 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
58333         LDKShutdownScript this_arg_conv;
58334         this_arg_conv.inner = untag_ptr(this_arg);
58335         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58337         this_arg_conv.is_owned = false;
58338         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
58339         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
58340         return ret_arr;
58341 }
58342
58343 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
58344         LDKShutdownScript this_arg_conv;
58345         this_arg_conv.inner = untag_ptr(this_arg);
58346         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58348         this_arg_conv.is_owned = false;
58349         LDKInitFeatures features_conv;
58350         features_conv.inner = untag_ptr(features);
58351         features_conv.is_owned = ptr_is_owned(features);
58352         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
58353         features_conv.is_owned = false;
58354         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
58355         return ret_conv;
58356 }
58357
58358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Retry_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
58359         if (!ptr_is_owned(this_ptr)) return;
58360         void* this_ptr_ptr = untag_ptr(this_ptr);
58361         CHECK_ACCESS(this_ptr_ptr);
58362         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
58363         FREE(untag_ptr(this_ptr));
58364         Retry_free(this_ptr_conv);
58365 }
58366
58367 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
58368         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
58369         *ret_copy = Retry_clone(arg);
58370         int64_t ret_ref = tag_ptr(ret_copy, true);
58371         return ret_ref;
58372 }
58373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58374         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
58375         int64_t ret_conv = Retry_clone_ptr(arg_conv);
58376         return ret_conv;
58377 }
58378
58379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58380         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
58381         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
58382         *ret_copy = Retry_clone(orig_conv);
58383         int64_t ret_ref = tag_ptr(ret_copy, true);
58384         return ret_ref;
58385 }
58386
58387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1attempts(JNIEnv *env, jclass clz, int32_t a) {
58388         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
58389         *ret_copy = Retry_attempts(a);
58390         int64_t ret_ref = tag_ptr(ret_copy, true);
58391         return ret_ref;
58392 }
58393
58394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1timeout(JNIEnv *env, jclass clz, int64_t a) {
58395         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
58396         *ret_copy = Retry_timeout(a);
58397         int64_t ret_ref = tag_ptr(ret_copy, true);
58398         return ret_ref;
58399 }
58400
58401 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Retry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58402         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
58403         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
58404         jboolean ret_conv = Retry_eq(a_conv, b_conv);
58405         return ret_conv;
58406 }
58407
58408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1hash(JNIEnv *env, jclass clz, int64_t o) {
58409         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
58410         int64_t ret_conv = Retry_hash(o_conv);
58411         return ret_conv;
58412 }
58413
58414 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Retry_1write(JNIEnv *env, jclass clz, int64_t obj) {
58415         LDKRetry* obj_conv = (LDKRetry*)untag_ptr(obj);
58416         LDKCVec_u8Z ret_var = Retry_write(obj_conv);
58417         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58418         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58419         CVec_u8Z_free(ret_var);
58420         return ret_arr;
58421 }
58422
58423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
58424         LDKu8slice ser_ref;
58425         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
58426         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
58427         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
58428         *ret_conv = Retry_read(ser_ref);
58429         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
58430         return tag_ptr(ret_conv, true);
58431 }
58432
58433 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58434         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
58435         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_clone(orig_conv));
58436         return ret_conv;
58437 }
58438
58439 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1payment_1expired(JNIEnv *env, jclass clz) {
58440         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_payment_expired());
58441         return ret_conv;
58442 }
58443
58444 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1route_1not_1found(JNIEnv *env, jclass clz) {
58445         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_route_not_found());
58446         return ret_conv;
58447 }
58448
58449 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1duplicate_1payment(JNIEnv *env, jclass clz) {
58450         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_duplicate_payment());
58451         return ret_conv;
58452 }
58453
58454 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58455         LDKRetryableSendFailure* a_conv = (LDKRetryableSendFailure*)untag_ptr(a);
58456         LDKRetryableSendFailure* b_conv = (LDKRetryableSendFailure*)untag_ptr(b);
58457         jboolean ret_conv = RetryableSendFailure_eq(a_conv, b_conv);
58458         return ret_conv;
58459 }
58460
58461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
58462         if (!ptr_is_owned(this_ptr)) return;
58463         void* this_ptr_ptr = untag_ptr(this_ptr);
58464         CHECK_ACCESS(this_ptr_ptr);
58465         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
58466         FREE(untag_ptr(this_ptr));
58467         PaymentSendFailure_free(this_ptr_conv);
58468 }
58469
58470 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
58471         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58472         *ret_copy = PaymentSendFailure_clone(arg);
58473         int64_t ret_ref = tag_ptr(ret_copy, true);
58474         return ret_ref;
58475 }
58476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58477         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
58478         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
58479         return ret_conv;
58480 }
58481
58482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58483         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
58484         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58485         *ret_copy = PaymentSendFailure_clone(orig_conv);
58486         int64_t ret_ref = tag_ptr(ret_copy, true);
58487         return ret_ref;
58488 }
58489
58490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
58491         void* a_ptr = untag_ptr(a);
58492         CHECK_ACCESS(a_ptr);
58493         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
58494         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
58495         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58496         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
58497         int64_t ret_ref = tag_ptr(ret_copy, true);
58498         return ret_ref;
58499 }
58500
58501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
58502         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
58503         a_constr.datalen = (*env)->GetArrayLength(env, a);
58504         if (a_constr.datalen > 0)
58505                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
58506         else
58507                 a_constr.data = NULL;
58508         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
58509         for (size_t w = 0; w < a_constr.datalen; w++) {
58510                 int64_t a_conv_22 = a_vals[w];
58511                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
58512                 CHECK_ACCESS(a_conv_22_ptr);
58513                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
58514                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
58515                 a_constr.data[w] = a_conv_22_conv;
58516         }
58517         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
58518         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58519         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
58520         int64_t ret_ref = tag_ptr(ret_copy, true);
58521         return ret_ref;
58522 }
58523
58524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1resend_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
58525         LDKCVec_APIErrorZ a_constr;
58526         a_constr.datalen = (*env)->GetArrayLength(env, a);
58527         if (a_constr.datalen > 0)
58528                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
58529         else
58530                 a_constr.data = NULL;
58531         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
58532         for (size_t k = 0; k < a_constr.datalen; k++) {
58533                 int64_t a_conv_10 = a_vals[k];
58534                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
58535                 CHECK_ACCESS(a_conv_10_ptr);
58536                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
58537                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
58538                 a_constr.data[k] = a_conv_10_conv;
58539         }
58540         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
58541         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58542         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
58543         int64_t ret_ref = tag_ptr(ret_copy, true);
58544         return ret_ref;
58545 }
58546
58547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1duplicate_1payment(JNIEnv *env, jclass clz) {
58548         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58549         *ret_copy = PaymentSendFailure_duplicate_payment();
58550         int64_t ret_ref = tag_ptr(ret_copy, true);
58551         return ret_ref;
58552 }
58553
58554 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) {
58555         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
58556         results_constr.datalen = (*env)->GetArrayLength(env, results);
58557         if (results_constr.datalen > 0)
58558                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
58559         else
58560                 results_constr.data = NULL;
58561         int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL);
58562         for (size_t w = 0; w < results_constr.datalen; w++) {
58563                 int64_t results_conv_22 = results_vals[w];
58564                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
58565                 CHECK_ACCESS(results_conv_22_ptr);
58566                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
58567                 results_constr.data[w] = results_conv_22_conv;
58568         }
58569         (*env)->ReleaseLongArrayElements(env, results, results_vals, 0);
58570         LDKRouteParameters failed_paths_retry_conv;
58571         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
58572         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
58573         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
58574         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
58575         LDKThirtyTwoBytes payment_id_ref;
58576         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
58577         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
58578         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58579         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
58580         int64_t ret_ref = tag_ptr(ret_copy, true);
58581         return ret_ref;
58582 }
58583
58584 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58585         LDKPaymentSendFailure* a_conv = (LDKPaymentSendFailure*)untag_ptr(a);
58586         LDKPaymentSendFailure* b_conv = (LDKPaymentSendFailure*)untag_ptr(b);
58587         jboolean ret_conv = PaymentSendFailure_eq(a_conv, b_conv);
58588         return ret_conv;
58589 }
58590
58591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
58592         if (!ptr_is_owned(this_ptr)) return;
58593         void* this_ptr_ptr = untag_ptr(this_ptr);
58594         CHECK_ACCESS(this_ptr_ptr);
58595         LDKProbeSendFailure this_ptr_conv = *(LDKProbeSendFailure*)(this_ptr_ptr);
58596         FREE(untag_ptr(this_ptr));
58597         ProbeSendFailure_free(this_ptr_conv);
58598 }
58599
58600 static inline uint64_t ProbeSendFailure_clone_ptr(LDKProbeSendFailure *NONNULL_PTR arg) {
58601         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
58602         *ret_copy = ProbeSendFailure_clone(arg);
58603         int64_t ret_ref = tag_ptr(ret_copy, true);
58604         return ret_ref;
58605 }
58606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58607         LDKProbeSendFailure* arg_conv = (LDKProbeSendFailure*)untag_ptr(arg);
58608         int64_t ret_conv = ProbeSendFailure_clone_ptr(arg_conv);
58609         return ret_conv;
58610 }
58611
58612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58613         LDKProbeSendFailure* orig_conv = (LDKProbeSendFailure*)untag_ptr(orig);
58614         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
58615         *ret_copy = ProbeSendFailure_clone(orig_conv);
58616         int64_t ret_ref = tag_ptr(ret_copy, true);
58617         return ret_ref;
58618 }
58619
58620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1route_1not_1found(JNIEnv *env, jclass clz) {
58621         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
58622         *ret_copy = ProbeSendFailure_route_not_found();
58623         int64_t ret_ref = tag_ptr(ret_copy, true);
58624         return ret_ref;
58625 }
58626
58627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1sending_1failed(JNIEnv *env, jclass clz, int64_t a) {
58628         void* a_ptr = untag_ptr(a);
58629         CHECK_ACCESS(a_ptr);
58630         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
58631         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
58632         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
58633         *ret_copy = ProbeSendFailure_sending_failed(a_conv);
58634         int64_t ret_ref = tag_ptr(ret_copy, true);
58635         return ret_ref;
58636 }
58637
58638 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58639         LDKProbeSendFailure* a_conv = (LDKProbeSendFailure*)untag_ptr(a);
58640         LDKProbeSendFailure* b_conv = (LDKProbeSendFailure*)untag_ptr(b);
58641         jboolean ret_conv = ProbeSendFailure_eq(a_conv, b_conv);
58642         return ret_conv;
58643 }
58644
58645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58646         LDKRecipientOnionFields this_obj_conv;
58647         this_obj_conv.inner = untag_ptr(this_obj);
58648         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58650         RecipientOnionFields_free(this_obj_conv);
58651 }
58652
58653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1get_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
58654         LDKRecipientOnionFields this_ptr_conv;
58655         this_ptr_conv.inner = untag_ptr(this_ptr);
58656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58658         this_ptr_conv.is_owned = false;
58659         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
58660         *ret_copy = RecipientOnionFields_get_payment_secret(&this_ptr_conv);
58661         int64_t ret_ref = tag_ptr(ret_copy, true);
58662         return ret_ref;
58663 }
58664
58665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1set_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58666         LDKRecipientOnionFields this_ptr_conv;
58667         this_ptr_conv.inner = untag_ptr(this_ptr);
58668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58670         this_ptr_conv.is_owned = false;
58671         void* val_ptr = untag_ptr(val);
58672         CHECK_ACCESS(val_ptr);
58673         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
58674         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
58675         RecipientOnionFields_set_payment_secret(&this_ptr_conv, val_conv);
58676 }
58677
58678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1get_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_ptr) {
58679         LDKRecipientOnionFields this_ptr_conv;
58680         this_ptr_conv.inner = untag_ptr(this_ptr);
58681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58683         this_ptr_conv.is_owned = false;
58684         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
58685         *ret_copy = RecipientOnionFields_get_payment_metadata(&this_ptr_conv);
58686         int64_t ret_ref = tag_ptr(ret_copy, true);
58687         return ret_ref;
58688 }
58689
58690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1set_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58691         LDKRecipientOnionFields this_ptr_conv;
58692         this_ptr_conv.inner = untag_ptr(this_ptr);
58693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58695         this_ptr_conv.is_owned = false;
58696         void* val_ptr = untag_ptr(val);
58697         CHECK_ACCESS(val_ptr);
58698         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
58699         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
58700         RecipientOnionFields_set_payment_metadata(&this_ptr_conv, val_conv);
58701 }
58702
58703 static inline uint64_t RecipientOnionFields_clone_ptr(LDKRecipientOnionFields *NONNULL_PTR arg) {
58704         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(arg);
58705         int64_t ret_ref = 0;
58706         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58707         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58708         return ret_ref;
58709 }
58710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58711         LDKRecipientOnionFields arg_conv;
58712         arg_conv.inner = untag_ptr(arg);
58713         arg_conv.is_owned = ptr_is_owned(arg);
58714         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58715         arg_conv.is_owned = false;
58716         int64_t ret_conv = RecipientOnionFields_clone_ptr(&arg_conv);
58717         return ret_conv;
58718 }
58719
58720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58721         LDKRecipientOnionFields orig_conv;
58722         orig_conv.inner = untag_ptr(orig);
58723         orig_conv.is_owned = ptr_is_owned(orig);
58724         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58725         orig_conv.is_owned = false;
58726         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(&orig_conv);
58727         int64_t ret_ref = 0;
58728         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58729         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58730         return ret_ref;
58731 }
58732
58733 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58734         LDKRecipientOnionFields a_conv;
58735         a_conv.inner = untag_ptr(a);
58736         a_conv.is_owned = ptr_is_owned(a);
58737         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58738         a_conv.is_owned = false;
58739         LDKRecipientOnionFields b_conv;
58740         b_conv.inner = untag_ptr(b);
58741         b_conv.is_owned = ptr_is_owned(b);
58742         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58743         b_conv.is_owned = false;
58744         jboolean ret_conv = RecipientOnionFields_eq(&a_conv, &b_conv);
58745         return ret_conv;
58746 }
58747
58748 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1write(JNIEnv *env, jclass clz, int64_t obj) {
58749         LDKRecipientOnionFields obj_conv;
58750         obj_conv.inner = untag_ptr(obj);
58751         obj_conv.is_owned = ptr_is_owned(obj);
58752         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58753         obj_conv.is_owned = false;
58754         LDKCVec_u8Z ret_var = RecipientOnionFields_write(&obj_conv);
58755         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58756         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58757         CVec_u8Z_free(ret_var);
58758         return ret_arr;
58759 }
58760
58761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
58762         LDKu8slice ser_ref;
58763         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
58764         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
58765         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
58766         *ret_conv = RecipientOnionFields_read(ser_ref);
58767         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
58768         return tag_ptr(ret_conv, true);
58769 }
58770
58771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1secret_1only(JNIEnv *env, jclass clz, int8_tArray payment_secret) {
58772         LDKThirtyTwoBytes payment_secret_ref;
58773         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
58774         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
58775         LDKRecipientOnionFields ret_var = RecipientOnionFields_secret_only(payment_secret_ref);
58776         int64_t ret_ref = 0;
58777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58779         return ret_ref;
58780 }
58781
58782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1spontaneous_1empty(JNIEnv *env, jclass clz) {
58783         LDKRecipientOnionFields ret_var = RecipientOnionFields_spontaneous_empty();
58784         int64_t ret_ref = 0;
58785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58787         return ret_ref;
58788 }
58789
58790 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) {
58791         LDKRecipientOnionFields this_arg_conv;
58792         this_arg_conv.inner = untag_ptr(this_arg);
58793         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58795         this_arg_conv = RecipientOnionFields_clone(&this_arg_conv);
58796         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
58797         custom_tlvs_constr.datalen = (*env)->GetArrayLength(env, custom_tlvs);
58798         if (custom_tlvs_constr.datalen > 0)
58799                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
58800         else
58801                 custom_tlvs_constr.data = NULL;
58802         int64_t* custom_tlvs_vals = (*env)->GetLongArrayElements (env, custom_tlvs, NULL);
58803         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
58804                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
58805                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
58806                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
58807                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
58808                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
58809                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
58810         }
58811         (*env)->ReleaseLongArrayElements(env, custom_tlvs, custom_tlvs_vals, 0);
58812         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
58813         *ret_conv = RecipientOnionFields_with_custom_tlvs(this_arg_conv, custom_tlvs_constr);
58814         return tag_ptr(ret_conv, true);
58815 }
58816
58817 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1custom_1tlvs(JNIEnv *env, jclass clz, int64_t this_arg) {
58818         LDKRecipientOnionFields this_arg_conv;
58819         this_arg_conv.inner = untag_ptr(this_arg);
58820         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58822         this_arg_conv.is_owned = false;
58823         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret_var = RecipientOnionFields_custom_tlvs(&this_arg_conv);
58824         int64_tArray ret_arr = NULL;
58825         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
58826         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
58827         for (size_t x = 0; x < ret_var.datalen; x++) {
58828                 LDKC2Tuple_u64CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
58829                 *ret_conv_23_conv = ret_var.data[x];
58830                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
58831         }
58832         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
58833         FREE(ret_var.data);
58834         return ret_arr;
58835 }
58836
58837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
58838         if (!ptr_is_owned(this_ptr)) return;
58839         void* this_ptr_ptr = untag_ptr(this_ptr);
58840         CHECK_ACCESS(this_ptr_ptr);
58841         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
58842         FREE(untag_ptr(this_ptr));
58843         CustomMessageReader_free(this_ptr_conv);
58844 }
58845
58846 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
58847         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
58848         *ret_ret = Type_clone(arg);
58849         return tag_ptr(ret_ret, true);
58850 }
58851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58852         void* arg_ptr = untag_ptr(arg);
58853         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
58854         LDKType* arg_conv = (LDKType*)arg_ptr;
58855         int64_t ret_conv = Type_clone_ptr(arg_conv);
58856         return ret_conv;
58857 }
58858
58859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58860         void* orig_ptr = untag_ptr(orig);
58861         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
58862         LDKType* orig_conv = (LDKType*)orig_ptr;
58863         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
58864         *ret_ret = Type_clone(orig_conv);
58865         return tag_ptr(ret_ret, true);
58866 }
58867
58868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
58869         if (!ptr_is_owned(this_ptr)) return;
58870         void* this_ptr_ptr = untag_ptr(this_ptr);
58871         CHECK_ACCESS(this_ptr_ptr);
58872         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
58873         FREE(untag_ptr(this_ptr));
58874         Type_free(this_ptr_conv);
58875 }
58876
58877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Offer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58878         LDKOffer this_obj_conv;
58879         this_obj_conv.inner = untag_ptr(this_obj);
58880         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58882         Offer_free(this_obj_conv);
58883 }
58884
58885 static inline uint64_t Offer_clone_ptr(LDKOffer *NONNULL_PTR arg) {
58886         LDKOffer ret_var = Offer_clone(arg);
58887         int64_t ret_ref = 0;
58888         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58889         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58890         return ret_ref;
58891 }
58892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58893         LDKOffer arg_conv;
58894         arg_conv.inner = untag_ptr(arg);
58895         arg_conv.is_owned = ptr_is_owned(arg);
58896         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58897         arg_conv.is_owned = false;
58898         int64_t ret_conv = Offer_clone_ptr(&arg_conv);
58899         return ret_conv;
58900 }
58901
58902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58903         LDKOffer orig_conv;
58904         orig_conv.inner = untag_ptr(orig);
58905         orig_conv.is_owned = ptr_is_owned(orig);
58906         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58907         orig_conv.is_owned = false;
58908         LDKOffer ret_var = Offer_clone(&orig_conv);
58909         int64_t ret_ref = 0;
58910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58912         return ret_ref;
58913 }
58914
58915 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Offer_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
58916         LDKOffer this_arg_conv;
58917         this_arg_conv.inner = untag_ptr(this_arg);
58918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58920         this_arg_conv.is_owned = false;
58921         LDKCVec_ThirtyTwoBytesZ ret_var = Offer_chains(&this_arg_conv);
58922         jobjectArray ret_arr = NULL;
58923         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
58924         ;
58925         for (size_t i = 0; i < ret_var.datalen; i++) {
58926                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
58927                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
58928                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
58929         }
58930         
58931         FREE(ret_var.data);
58932         return ret_arr;
58933 }
58934
58935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
58936         LDKOffer this_arg_conv;
58937         this_arg_conv.inner = untag_ptr(this_arg);
58938         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58940         this_arg_conv.is_owned = false;
58941         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
58942         *ret_copy = Offer_metadata(&this_arg_conv);
58943         int64_t ret_ref = tag_ptr(ret_copy, true);
58944         return ret_ref;
58945 }
58946
58947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
58948         LDKOffer this_arg_conv;
58949         this_arg_conv.inner = untag_ptr(this_arg);
58950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58952         this_arg_conv.is_owned = false;
58953         LDKAmount ret_var = Offer_amount(&this_arg_conv);
58954         int64_t ret_ref = 0;
58955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58957         return ret_ref;
58958 }
58959
58960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
58961         LDKOffer this_arg_conv;
58962         this_arg_conv.inner = untag_ptr(this_arg);
58963         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58965         this_arg_conv.is_owned = false;
58966         LDKPrintableString ret_var = Offer_description(&this_arg_conv);
58967         int64_t ret_ref = 0;
58968         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58969         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58970         return ret_ref;
58971 }
58972
58973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
58974         LDKOffer this_arg_conv;
58975         this_arg_conv.inner = untag_ptr(this_arg);
58976         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58978         this_arg_conv.is_owned = false;
58979         LDKOfferFeatures ret_var = Offer_offer_features(&this_arg_conv);
58980         int64_t ret_ref = 0;
58981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58983         return ret_ref;
58984 }
58985
58986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
58987         LDKOffer this_arg_conv;
58988         this_arg_conv.inner = untag_ptr(this_arg);
58989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58991         this_arg_conv.is_owned = false;
58992         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
58993         *ret_copy = Offer_absolute_expiry(&this_arg_conv);
58994         int64_t ret_ref = tag_ptr(ret_copy, true);
58995         return ret_ref;
58996 }
58997
58998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
58999         LDKOffer this_arg_conv;
59000         this_arg_conv.inner = untag_ptr(this_arg);
59001         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59003         this_arg_conv.is_owned = false;
59004         LDKPrintableString ret_var = Offer_issuer(&this_arg_conv);
59005         int64_t ret_ref = 0;
59006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59008         return ret_ref;
59009 }
59010
59011 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
59012         LDKOffer this_arg_conv;
59013         this_arg_conv.inner = untag_ptr(this_arg);
59014         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59016         this_arg_conv.is_owned = false;
59017         LDKCVec_BlindedPathZ ret_var = Offer_paths(&this_arg_conv);
59018         int64_tArray ret_arr = NULL;
59019         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
59020         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
59021         for (size_t n = 0; n < ret_var.datalen; n++) {
59022                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
59023                 int64_t ret_conv_13_ref = 0;
59024                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
59025                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
59026                 ret_arr_ptr[n] = ret_conv_13_ref;
59027         }
59028         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
59029         FREE(ret_var.data);
59030         return ret_arr;
59031 }
59032
59033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
59034         LDKOffer this_arg_conv;
59035         this_arg_conv.inner = untag_ptr(this_arg);
59036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59038         this_arg_conv.is_owned = false;
59039         LDKQuantity ret_var = Offer_supported_quantity(&this_arg_conv);
59040         int64_t ret_ref = 0;
59041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59043         return ret_ref;
59044 }
59045
59046 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
59047         LDKOffer this_arg_conv;
59048         this_arg_conv.inner = untag_ptr(this_arg);
59049         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59051         this_arg_conv.is_owned = false;
59052         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
59053         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Offer_signing_pubkey(&this_arg_conv).compressed_form);
59054         return ret_arr;
59055 }
59056
59057 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1supports_1chain(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray chain) {
59058         LDKOffer this_arg_conv;
59059         this_arg_conv.inner = untag_ptr(this_arg);
59060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59062         this_arg_conv.is_owned = false;
59063         LDKThirtyTwoBytes chain_ref;
59064         CHECK((*env)->GetArrayLength(env, chain) == 32);
59065         (*env)->GetByteArrayRegion(env, chain, 0, 32, chain_ref.data);
59066         jboolean ret_conv = Offer_supports_chain(&this_arg_conv, chain_ref);
59067         return ret_conv;
59068 }
59069
59070 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
59071         LDKOffer this_arg_conv;
59072         this_arg_conv.inner = untag_ptr(this_arg);
59073         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59075         this_arg_conv.is_owned = false;
59076         jboolean ret_conv = Offer_is_expired(&this_arg_conv);
59077         return ret_conv;
59078 }
59079
59080 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1is_1valid_1quantity(JNIEnv *env, jclass clz, int64_t this_arg, int64_t quantity) {
59081         LDKOffer this_arg_conv;
59082         this_arg_conv.inner = untag_ptr(this_arg);
59083         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59085         this_arg_conv.is_owned = false;
59086         jboolean ret_conv = Offer_is_valid_quantity(&this_arg_conv, quantity);
59087         return ret_conv;
59088 }
59089
59090 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1expects_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
59091         LDKOffer this_arg_conv;
59092         this_arg_conv.inner = untag_ptr(this_arg);
59093         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59095         this_arg_conv.is_owned = false;
59096         jboolean ret_conv = Offer_expects_quantity(&this_arg_conv);
59097         return ret_conv;
59098 }
59099
59100 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1write(JNIEnv *env, jclass clz, int64_t obj) {
59101         LDKOffer obj_conv;
59102         obj_conv.inner = untag_ptr(obj);
59103         obj_conv.is_owned = ptr_is_owned(obj);
59104         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59105         obj_conv.is_owned = false;
59106         LDKCVec_u8Z ret_var = Offer_write(&obj_conv);
59107         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59108         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59109         CVec_u8Z_free(ret_var);
59110         return ret_arr;
59111 }
59112
59113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Amount_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59114         LDKAmount this_obj_conv;
59115         this_obj_conv.inner = untag_ptr(this_obj);
59116         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59118         Amount_free(this_obj_conv);
59119 }
59120
59121 static inline uint64_t Amount_clone_ptr(LDKAmount *NONNULL_PTR arg) {
59122         LDKAmount ret_var = Amount_clone(arg);
59123         int64_t ret_ref = 0;
59124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59126         return ret_ref;
59127 }
59128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Amount_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59129         LDKAmount arg_conv;
59130         arg_conv.inner = untag_ptr(arg);
59131         arg_conv.is_owned = ptr_is_owned(arg);
59132         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59133         arg_conv.is_owned = false;
59134         int64_t ret_conv = Amount_clone_ptr(&arg_conv);
59135         return ret_conv;
59136 }
59137
59138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Amount_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59139         LDKAmount orig_conv;
59140         orig_conv.inner = untag_ptr(orig);
59141         orig_conv.is_owned = ptr_is_owned(orig);
59142         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59143         orig_conv.is_owned = false;
59144         LDKAmount ret_var = Amount_clone(&orig_conv);
59145         int64_t ret_ref = 0;
59146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59148         return ret_ref;
59149 }
59150
59151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Quantity_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59152         LDKQuantity this_obj_conv;
59153         this_obj_conv.inner = untag_ptr(this_obj);
59154         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59156         Quantity_free(this_obj_conv);
59157 }
59158
59159 static inline uint64_t Quantity_clone_ptr(LDKQuantity *NONNULL_PTR arg) {
59160         LDKQuantity ret_var = Quantity_clone(arg);
59161         int64_t ret_ref = 0;
59162         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59163         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59164         return ret_ref;
59165 }
59166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59167         LDKQuantity arg_conv;
59168         arg_conv.inner = untag_ptr(arg);
59169         arg_conv.is_owned = ptr_is_owned(arg);
59170         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59171         arg_conv.is_owned = false;
59172         int64_t ret_conv = Quantity_clone_ptr(&arg_conv);
59173         return ret_conv;
59174 }
59175
59176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59177         LDKQuantity orig_conv;
59178         orig_conv.inner = untag_ptr(orig);
59179         orig_conv.is_owned = ptr_is_owned(orig);
59180         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59181         orig_conv.is_owned = false;
59182         LDKQuantity ret_var = Quantity_clone(&orig_conv);
59183         int64_t ret_ref = 0;
59184         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59185         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59186         return ret_ref;
59187 }
59188
59189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1from_1str(JNIEnv *env, jclass clz, jstring s) {
59190         LDKStr s_conv = java_to_owned_str(env, s);
59191         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
59192         *ret_conv = Offer_from_str(s_conv);
59193         return tag_ptr(ret_conv, true);
59194 }
59195
59196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59197         LDKUnsignedBolt12Invoice this_obj_conv;
59198         this_obj_conv.inner = untag_ptr(this_obj);
59199         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59201         UnsignedBolt12Invoice_free(this_obj_conv);
59202 }
59203
59204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1tagged_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
59205         LDKUnsignedBolt12Invoice this_arg_conv;
59206         this_arg_conv.inner = untag_ptr(this_arg);
59207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59209         this_arg_conv.is_owned = false;
59210         LDKTaggedHash ret_var = UnsignedBolt12Invoice_tagged_hash(&this_arg_conv);
59211         int64_t ret_ref = 0;
59212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59214         return ret_ref;
59215 }
59216
59217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59218         LDKBolt12Invoice 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         Bolt12Invoice_free(this_obj_conv);
59223 }
59224
59225 static inline uint64_t Bolt12Invoice_clone_ptr(LDKBolt12Invoice *NONNULL_PTR arg) {
59226         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(arg);
59227         int64_t ret_ref = 0;
59228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59230         return ret_ref;
59231 }
59232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59233         LDKBolt12Invoice arg_conv;
59234         arg_conv.inner = untag_ptr(arg);
59235         arg_conv.is_owned = ptr_is_owned(arg);
59236         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59237         arg_conv.is_owned = false;
59238         int64_t ret_conv = Bolt12Invoice_clone_ptr(&arg_conv);
59239         return ret_conv;
59240 }
59241
59242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59243         LDKBolt12Invoice orig_conv;
59244         orig_conv.inner = untag_ptr(orig);
59245         orig_conv.is_owned = ptr_is_owned(orig);
59246         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59247         orig_conv.is_owned = false;
59248         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(&orig_conv);
59249         int64_t ret_ref = 0;
59250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59252         return ret_ref;
59253 }
59254
59255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1offer_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
59256         LDKUnsignedBolt12Invoice this_arg_conv;
59257         this_arg_conv.inner = untag_ptr(this_arg);
59258         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59260         this_arg_conv.is_owned = false;
59261         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
59262         *ret_copy = UnsignedBolt12Invoice_offer_chains(&this_arg_conv);
59263         int64_t ret_ref = tag_ptr(ret_copy, true);
59264         return ret_ref;
59265 }
59266
59267 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
59268         LDKUnsignedBolt12Invoice this_arg_conv;
59269         this_arg_conv.inner = untag_ptr(this_arg);
59270         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59272         this_arg_conv.is_owned = false;
59273         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
59274         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, UnsignedBolt12Invoice_chain(&this_arg_conv).data);
59275         return ret_arr;
59276 }
59277
59278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
59279         LDKUnsignedBolt12Invoice this_arg_conv;
59280         this_arg_conv.inner = untag_ptr(this_arg);
59281         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59283         this_arg_conv.is_owned = false;
59284         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
59285         *ret_copy = UnsignedBolt12Invoice_metadata(&this_arg_conv);
59286         int64_t ret_ref = tag_ptr(ret_copy, true);
59287         return ret_ref;
59288 }
59289
59290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
59291         LDKUnsignedBolt12Invoice this_arg_conv;
59292         this_arg_conv.inner = untag_ptr(this_arg);
59293         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59295         this_arg_conv.is_owned = false;
59296         LDKAmount ret_var = UnsignedBolt12Invoice_amount(&this_arg_conv);
59297         int64_t ret_ref = 0;
59298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59300         return ret_ref;
59301 }
59302
59303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
59304         LDKUnsignedBolt12Invoice this_arg_conv;
59305         this_arg_conv.inner = untag_ptr(this_arg);
59306         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59308         this_arg_conv.is_owned = false;
59309         LDKOfferFeatures ret_var = UnsignedBolt12Invoice_offer_features(&this_arg_conv);
59310         int64_t ret_ref = 0;
59311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59313         return ret_ref;
59314 }
59315
59316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
59317         LDKUnsignedBolt12Invoice this_arg_conv;
59318         this_arg_conv.inner = untag_ptr(this_arg);
59319         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59321         this_arg_conv.is_owned = false;
59322         LDKPrintableString ret_var = UnsignedBolt12Invoice_description(&this_arg_conv);
59323         int64_t ret_ref = 0;
59324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59326         return ret_ref;
59327 }
59328
59329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
59330         LDKUnsignedBolt12Invoice this_arg_conv;
59331         this_arg_conv.inner = untag_ptr(this_arg);
59332         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59334         this_arg_conv.is_owned = false;
59335         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59336         *ret_copy = UnsignedBolt12Invoice_absolute_expiry(&this_arg_conv);
59337         int64_t ret_ref = tag_ptr(ret_copy, true);
59338         return ret_ref;
59339 }
59340
59341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
59342         LDKUnsignedBolt12Invoice this_arg_conv;
59343         this_arg_conv.inner = untag_ptr(this_arg);
59344         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59346         this_arg_conv.is_owned = false;
59347         LDKPrintableString ret_var = UnsignedBolt12Invoice_issuer(&this_arg_conv);
59348         int64_t ret_ref = 0;
59349         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59350         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59351         return ret_ref;
59352 }
59353
59354 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1message_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
59355         LDKUnsignedBolt12Invoice this_arg_conv;
59356         this_arg_conv.inner = untag_ptr(this_arg);
59357         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59359         this_arg_conv.is_owned = false;
59360         LDKCVec_BlindedPathZ ret_var = UnsignedBolt12Invoice_message_paths(&this_arg_conv);
59361         int64_tArray ret_arr = NULL;
59362         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
59363         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
59364         for (size_t n = 0; n < ret_var.datalen; n++) {
59365                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
59366                 int64_t ret_conv_13_ref = 0;
59367                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
59368                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
59369                 ret_arr_ptr[n] = ret_conv_13_ref;
59370         }
59371         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
59372         FREE(ret_var.data);
59373         return ret_arr;
59374 }
59375
59376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
59377         LDKUnsignedBolt12Invoice this_arg_conv;
59378         this_arg_conv.inner = untag_ptr(this_arg);
59379         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59381         this_arg_conv.is_owned = false;
59382         LDKQuantity ret_var = UnsignedBolt12Invoice_supported_quantity(&this_arg_conv);
59383         int64_t ret_ref = 0;
59384         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59385         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59386         return ret_ref;
59387 }
59388
59389 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
59390         LDKUnsignedBolt12Invoice this_arg_conv;
59391         this_arg_conv.inner = untag_ptr(this_arg);
59392         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59394         this_arg_conv.is_owned = false;
59395         LDKu8slice ret_var = UnsignedBolt12Invoice_payer_metadata(&this_arg_conv);
59396         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59397         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59398         return ret_arr;
59399 }
59400
59401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
59402         LDKUnsignedBolt12Invoice this_arg_conv;
59403         this_arg_conv.inner = untag_ptr(this_arg);
59404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59406         this_arg_conv.is_owned = false;
59407         LDKInvoiceRequestFeatures ret_var = UnsignedBolt12Invoice_invoice_request_features(&this_arg_conv);
59408         int64_t ret_ref = 0;
59409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59411         return ret_ref;
59412 }
59413
59414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
59415         LDKUnsignedBolt12Invoice this_arg_conv;
59416         this_arg_conv.inner = untag_ptr(this_arg);
59417         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59419         this_arg_conv.is_owned = false;
59420         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59421         *ret_copy = UnsignedBolt12Invoice_quantity(&this_arg_conv);
59422         int64_t ret_ref = tag_ptr(ret_copy, true);
59423         return ret_ref;
59424 }
59425
59426 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
59427         LDKUnsignedBolt12Invoice this_arg_conv;
59428         this_arg_conv.inner = untag_ptr(this_arg);
59429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59431         this_arg_conv.is_owned = false;
59432         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
59433         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedBolt12Invoice_payer_id(&this_arg_conv).compressed_form);
59434         return ret_arr;
59435 }
59436
59437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
59438         LDKUnsignedBolt12Invoice this_arg_conv;
59439         this_arg_conv.inner = untag_ptr(this_arg);
59440         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59442         this_arg_conv.is_owned = false;
59443         LDKPrintableString ret_var = UnsignedBolt12Invoice_payer_note(&this_arg_conv);
59444         int64_t ret_ref = 0;
59445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59447         return ret_ref;
59448 }
59449
59450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1created_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
59451         LDKUnsignedBolt12Invoice this_arg_conv;
59452         this_arg_conv.inner = untag_ptr(this_arg);
59453         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59455         this_arg_conv.is_owned = false;
59456         int64_t ret_conv = UnsignedBolt12Invoice_created_at(&this_arg_conv);
59457         return ret_conv;
59458 }
59459
59460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1relative_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
59461         LDKUnsignedBolt12Invoice this_arg_conv;
59462         this_arg_conv.inner = untag_ptr(this_arg);
59463         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59465         this_arg_conv.is_owned = false;
59466         int64_t ret_conv = UnsignedBolt12Invoice_relative_expiry(&this_arg_conv);
59467         return ret_conv;
59468 }
59469
59470 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
59471         LDKUnsignedBolt12Invoice this_arg_conv;
59472         this_arg_conv.inner = untag_ptr(this_arg);
59473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59475         this_arg_conv.is_owned = false;
59476         jboolean ret_conv = UnsignedBolt12Invoice_is_expired(&this_arg_conv);
59477         return ret_conv;
59478 }
59479
59480 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
59481         LDKUnsignedBolt12Invoice this_arg_conv;
59482         this_arg_conv.inner = untag_ptr(this_arg);
59483         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59485         this_arg_conv.is_owned = false;
59486         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
59487         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, UnsignedBolt12Invoice_payment_hash(&this_arg_conv).data);
59488         return ret_arr;
59489 }
59490
59491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
59492         LDKUnsignedBolt12Invoice this_arg_conv;
59493         this_arg_conv.inner = untag_ptr(this_arg);
59494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59496         this_arg_conv.is_owned = false;
59497         int64_t ret_conv = UnsignedBolt12Invoice_amount_msats(&this_arg_conv);
59498         return ret_conv;
59499 }
59500
59501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
59502         LDKUnsignedBolt12Invoice this_arg_conv;
59503         this_arg_conv.inner = untag_ptr(this_arg);
59504         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59506         this_arg_conv.is_owned = false;
59507         LDKBolt12InvoiceFeatures ret_var = UnsignedBolt12Invoice_invoice_features(&this_arg_conv);
59508         int64_t ret_ref = 0;
59509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59511         return ret_ref;
59512 }
59513
59514 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
59515         LDKUnsignedBolt12Invoice this_arg_conv;
59516         this_arg_conv.inner = untag_ptr(this_arg);
59517         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59519         this_arg_conv.is_owned = false;
59520         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
59521         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedBolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form);
59522         return ret_arr;
59523 }
59524
59525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1offer_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
59526         LDKBolt12Invoice this_arg_conv;
59527         this_arg_conv.inner = untag_ptr(this_arg);
59528         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59530         this_arg_conv.is_owned = false;
59531         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
59532         *ret_copy = Bolt12Invoice_offer_chains(&this_arg_conv);
59533         int64_t ret_ref = tag_ptr(ret_copy, true);
59534         return ret_ref;
59535 }
59536
59537 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
59538         LDKBolt12Invoice this_arg_conv;
59539         this_arg_conv.inner = untag_ptr(this_arg);
59540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59542         this_arg_conv.is_owned = false;
59543         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
59544         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_chain(&this_arg_conv).data);
59545         return ret_arr;
59546 }
59547
59548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
59549         LDKBolt12Invoice this_arg_conv;
59550         this_arg_conv.inner = untag_ptr(this_arg);
59551         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59553         this_arg_conv.is_owned = false;
59554         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
59555         *ret_copy = Bolt12Invoice_metadata(&this_arg_conv);
59556         int64_t ret_ref = tag_ptr(ret_copy, true);
59557         return ret_ref;
59558 }
59559
59560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
59561         LDKBolt12Invoice this_arg_conv;
59562         this_arg_conv.inner = untag_ptr(this_arg);
59563         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59565         this_arg_conv.is_owned = false;
59566         LDKAmount ret_var = Bolt12Invoice_amount(&this_arg_conv);
59567         int64_t ret_ref = 0;
59568         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59569         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59570         return ret_ref;
59571 }
59572
59573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
59574         LDKBolt12Invoice this_arg_conv;
59575         this_arg_conv.inner = untag_ptr(this_arg);
59576         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59578         this_arg_conv.is_owned = false;
59579         LDKOfferFeatures ret_var = Bolt12Invoice_offer_features(&this_arg_conv);
59580         int64_t ret_ref = 0;
59581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59583         return ret_ref;
59584 }
59585
59586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
59587         LDKBolt12Invoice this_arg_conv;
59588         this_arg_conv.inner = untag_ptr(this_arg);
59589         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59591         this_arg_conv.is_owned = false;
59592         LDKPrintableString ret_var = Bolt12Invoice_description(&this_arg_conv);
59593         int64_t ret_ref = 0;
59594         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59595         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59596         return ret_ref;
59597 }
59598
59599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
59600         LDKBolt12Invoice this_arg_conv;
59601         this_arg_conv.inner = untag_ptr(this_arg);
59602         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59604         this_arg_conv.is_owned = false;
59605         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59606         *ret_copy = Bolt12Invoice_absolute_expiry(&this_arg_conv);
59607         int64_t ret_ref = tag_ptr(ret_copy, true);
59608         return ret_ref;
59609 }
59610
59611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
59612         LDKBolt12Invoice this_arg_conv;
59613         this_arg_conv.inner = untag_ptr(this_arg);
59614         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59616         this_arg_conv.is_owned = false;
59617         LDKPrintableString ret_var = Bolt12Invoice_issuer(&this_arg_conv);
59618         int64_t ret_ref = 0;
59619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59620         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59621         return ret_ref;
59622 }
59623
59624 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1message_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
59625         LDKBolt12Invoice this_arg_conv;
59626         this_arg_conv.inner = untag_ptr(this_arg);
59627         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59629         this_arg_conv.is_owned = false;
59630         LDKCVec_BlindedPathZ ret_var = Bolt12Invoice_message_paths(&this_arg_conv);
59631         int64_tArray ret_arr = NULL;
59632         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
59633         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
59634         for (size_t n = 0; n < ret_var.datalen; n++) {
59635                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
59636                 int64_t ret_conv_13_ref = 0;
59637                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
59638                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
59639                 ret_arr_ptr[n] = ret_conv_13_ref;
59640         }
59641         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
59642         FREE(ret_var.data);
59643         return ret_arr;
59644 }
59645
59646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
59647         LDKBolt12Invoice this_arg_conv;
59648         this_arg_conv.inner = untag_ptr(this_arg);
59649         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59651         this_arg_conv.is_owned = false;
59652         LDKQuantity ret_var = Bolt12Invoice_supported_quantity(&this_arg_conv);
59653         int64_t ret_ref = 0;
59654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59656         return ret_ref;
59657 }
59658
59659 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
59660         LDKBolt12Invoice this_arg_conv;
59661         this_arg_conv.inner = untag_ptr(this_arg);
59662         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59664         this_arg_conv.is_owned = false;
59665         LDKu8slice ret_var = Bolt12Invoice_payer_metadata(&this_arg_conv);
59666         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59667         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59668         return ret_arr;
59669 }
59670
59671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
59672         LDKBolt12Invoice this_arg_conv;
59673         this_arg_conv.inner = untag_ptr(this_arg);
59674         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59676         this_arg_conv.is_owned = false;
59677         LDKInvoiceRequestFeatures ret_var = Bolt12Invoice_invoice_request_features(&this_arg_conv);
59678         int64_t ret_ref = 0;
59679         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59680         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59681         return ret_ref;
59682 }
59683
59684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
59685         LDKBolt12Invoice this_arg_conv;
59686         this_arg_conv.inner = untag_ptr(this_arg);
59687         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59689         this_arg_conv.is_owned = false;
59690         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59691         *ret_copy = Bolt12Invoice_quantity(&this_arg_conv);
59692         int64_t ret_ref = tag_ptr(ret_copy, true);
59693         return ret_ref;
59694 }
59695
59696 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
59697         LDKBolt12Invoice this_arg_conv;
59698         this_arg_conv.inner = untag_ptr(this_arg);
59699         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59701         this_arg_conv.is_owned = false;
59702         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
59703         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt12Invoice_payer_id(&this_arg_conv).compressed_form);
59704         return ret_arr;
59705 }
59706
59707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
59708         LDKBolt12Invoice this_arg_conv;
59709         this_arg_conv.inner = untag_ptr(this_arg);
59710         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59712         this_arg_conv.is_owned = false;
59713         LDKPrintableString ret_var = Bolt12Invoice_payer_note(&this_arg_conv);
59714         int64_t ret_ref = 0;
59715         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59716         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59717         return ret_ref;
59718 }
59719
59720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1created_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
59721         LDKBolt12Invoice this_arg_conv;
59722         this_arg_conv.inner = untag_ptr(this_arg);
59723         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59725         this_arg_conv.is_owned = false;
59726         int64_t ret_conv = Bolt12Invoice_created_at(&this_arg_conv);
59727         return ret_conv;
59728 }
59729
59730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1relative_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
59731         LDKBolt12Invoice this_arg_conv;
59732         this_arg_conv.inner = untag_ptr(this_arg);
59733         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59735         this_arg_conv.is_owned = false;
59736         int64_t ret_conv = Bolt12Invoice_relative_expiry(&this_arg_conv);
59737         return ret_conv;
59738 }
59739
59740 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
59741         LDKBolt12Invoice this_arg_conv;
59742         this_arg_conv.inner = untag_ptr(this_arg);
59743         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59745         this_arg_conv.is_owned = false;
59746         jboolean ret_conv = Bolt12Invoice_is_expired(&this_arg_conv);
59747         return ret_conv;
59748 }
59749
59750 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
59751         LDKBolt12Invoice this_arg_conv;
59752         this_arg_conv.inner = untag_ptr(this_arg);
59753         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59755         this_arg_conv.is_owned = false;
59756         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
59757         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_payment_hash(&this_arg_conv).data);
59758         return ret_arr;
59759 }
59760
59761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
59762         LDKBolt12Invoice this_arg_conv;
59763         this_arg_conv.inner = untag_ptr(this_arg);
59764         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59766         this_arg_conv.is_owned = false;
59767         int64_t ret_conv = Bolt12Invoice_amount_msats(&this_arg_conv);
59768         return ret_conv;
59769 }
59770
59771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
59772         LDKBolt12Invoice this_arg_conv;
59773         this_arg_conv.inner = untag_ptr(this_arg);
59774         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59776         this_arg_conv.is_owned = false;
59777         LDKBolt12InvoiceFeatures ret_var = Bolt12Invoice_invoice_features(&this_arg_conv);
59778         int64_t ret_ref = 0;
59779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59781         return ret_ref;
59782 }
59783
59784 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
59785         LDKBolt12Invoice this_arg_conv;
59786         this_arg_conv.inner = untag_ptr(this_arg);
59787         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59789         this_arg_conv.is_owned = false;
59790         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
59791         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form);
59792         return ret_arr;
59793 }
59794
59795 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
59796         LDKBolt12Invoice this_arg_conv;
59797         this_arg_conv.inner = untag_ptr(this_arg);
59798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59800         this_arg_conv.is_owned = false;
59801         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
59802         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, Bolt12Invoice_signature(&this_arg_conv).compact_form);
59803         return ret_arr;
59804 }
59805
59806 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
59807         LDKBolt12Invoice this_arg_conv;
59808         this_arg_conv.inner = untag_ptr(this_arg);
59809         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59811         this_arg_conv.is_owned = false;
59812         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
59813         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_signable_hash(&this_arg_conv).data);
59814         return ret_arr;
59815 }
59816
59817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t key) {
59818         LDKBolt12Invoice this_arg_conv;
59819         this_arg_conv.inner = untag_ptr(this_arg);
59820         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59822         this_arg_conv.is_owned = false;
59823         LDKExpandedKey key_conv;
59824         key_conv.inner = untag_ptr(key);
59825         key_conv.is_owned = ptr_is_owned(key);
59826         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
59827         key_conv.is_owned = false;
59828         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
59829         *ret_conv = Bolt12Invoice_verify(&this_arg_conv, &key_conv);
59830         return tag_ptr(ret_conv, true);
59831 }
59832
59833 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1write(JNIEnv *env, jclass clz, int64_t obj) {
59834         LDKUnsignedBolt12Invoice obj_conv;
59835         obj_conv.inner = untag_ptr(obj);
59836         obj_conv.is_owned = ptr_is_owned(obj);
59837         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59838         obj_conv.is_owned = false;
59839         LDKCVec_u8Z ret_var = UnsignedBolt12Invoice_write(&obj_conv);
59840         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59841         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59842         CVec_u8Z_free(ret_var);
59843         return ret_arr;
59844 }
59845
59846 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1write(JNIEnv *env, jclass clz, int64_t obj) {
59847         LDKBolt12Invoice obj_conv;
59848         obj_conv.inner = untag_ptr(obj);
59849         obj_conv.is_owned = ptr_is_owned(obj);
59850         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59851         obj_conv.is_owned = false;
59852         LDKCVec_u8Z ret_var = Bolt12Invoice_write(&obj_conv);
59853         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59854         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59855         CVec_u8Z_free(ret_var);
59856         return ret_arr;
59857 }
59858
59859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59860         LDKBlindedPayInfo this_obj_conv;
59861         this_obj_conv.inner = untag_ptr(this_obj);
59862         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59864         BlindedPayInfo_free(this_obj_conv);
59865 }
59866
59867 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
59868         LDKBlindedPayInfo this_ptr_conv;
59869         this_ptr_conv.inner = untag_ptr(this_ptr);
59870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59872         this_ptr_conv.is_owned = false;
59873         int32_t ret_conv = BlindedPayInfo_get_fee_base_msat(&this_ptr_conv);
59874         return ret_conv;
59875 }
59876
59877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
59878         LDKBlindedPayInfo this_ptr_conv;
59879         this_ptr_conv.inner = untag_ptr(this_ptr);
59880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59882         this_ptr_conv.is_owned = false;
59883         BlindedPayInfo_set_fee_base_msat(&this_ptr_conv, val);
59884 }
59885
59886 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
59887         LDKBlindedPayInfo this_ptr_conv;
59888         this_ptr_conv.inner = untag_ptr(this_ptr);
59889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59891         this_ptr_conv.is_owned = false;
59892         int32_t ret_conv = BlindedPayInfo_get_fee_proportional_millionths(&this_ptr_conv);
59893         return ret_conv;
59894 }
59895
59896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
59897         LDKBlindedPayInfo this_ptr_conv;
59898         this_ptr_conv.inner = untag_ptr(this_ptr);
59899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59901         this_ptr_conv.is_owned = false;
59902         BlindedPayInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
59903 }
59904
59905 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
59906         LDKBlindedPayInfo this_ptr_conv;
59907         this_ptr_conv.inner = untag_ptr(this_ptr);
59908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59910         this_ptr_conv.is_owned = false;
59911         int16_t ret_conv = BlindedPayInfo_get_cltv_expiry_delta(&this_ptr_conv);
59912         return ret_conv;
59913 }
59914
59915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
59916         LDKBlindedPayInfo this_ptr_conv;
59917         this_ptr_conv.inner = untag_ptr(this_ptr);
59918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59920         this_ptr_conv.is_owned = false;
59921         BlindedPayInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
59922 }
59923
59924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
59925         LDKBlindedPayInfo this_ptr_conv;
59926         this_ptr_conv.inner = untag_ptr(this_ptr);
59927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59929         this_ptr_conv.is_owned = false;
59930         int64_t ret_conv = BlindedPayInfo_get_htlc_minimum_msat(&this_ptr_conv);
59931         return ret_conv;
59932 }
59933
59934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59935         LDKBlindedPayInfo this_ptr_conv;
59936         this_ptr_conv.inner = untag_ptr(this_ptr);
59937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59939         this_ptr_conv.is_owned = false;
59940         BlindedPayInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
59941 }
59942
59943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
59944         LDKBlindedPayInfo this_ptr_conv;
59945         this_ptr_conv.inner = untag_ptr(this_ptr);
59946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59948         this_ptr_conv.is_owned = false;
59949         int64_t ret_conv = BlindedPayInfo_get_htlc_maximum_msat(&this_ptr_conv);
59950         return ret_conv;
59951 }
59952
59953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59954         LDKBlindedPayInfo this_ptr_conv;
59955         this_ptr_conv.inner = untag_ptr(this_ptr);
59956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59958         this_ptr_conv.is_owned = false;
59959         BlindedPayInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
59960 }
59961
59962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
59963         LDKBlindedPayInfo this_ptr_conv;
59964         this_ptr_conv.inner = untag_ptr(this_ptr);
59965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59967         this_ptr_conv.is_owned = false;
59968         LDKBlindedHopFeatures ret_var = BlindedPayInfo_get_features(&this_ptr_conv);
59969         int64_t ret_ref = 0;
59970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59972         return ret_ref;
59973 }
59974
59975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59976         LDKBlindedPayInfo this_ptr_conv;
59977         this_ptr_conv.inner = untag_ptr(this_ptr);
59978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59980         this_ptr_conv.is_owned = false;
59981         LDKBlindedHopFeatures val_conv;
59982         val_conv.inner = untag_ptr(val);
59983         val_conv.is_owned = ptr_is_owned(val);
59984         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59985         val_conv = BlindedHopFeatures_clone(&val_conv);
59986         BlindedPayInfo_set_features(&this_ptr_conv, val_conv);
59987 }
59988
59989 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) {
59990         LDKBlindedHopFeatures features_arg_conv;
59991         features_arg_conv.inner = untag_ptr(features_arg);
59992         features_arg_conv.is_owned = ptr_is_owned(features_arg);
59993         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
59994         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
59995         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);
59996         int64_t ret_ref = 0;
59997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59999         return ret_ref;
60000 }
60001
60002 static inline uint64_t BlindedPayInfo_clone_ptr(LDKBlindedPayInfo *NONNULL_PTR arg) {
60003         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(arg);
60004         int64_t ret_ref = 0;
60005         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60006         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60007         return ret_ref;
60008 }
60009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60010         LDKBlindedPayInfo arg_conv;
60011         arg_conv.inner = untag_ptr(arg);
60012         arg_conv.is_owned = ptr_is_owned(arg);
60013         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60014         arg_conv.is_owned = false;
60015         int64_t ret_conv = BlindedPayInfo_clone_ptr(&arg_conv);
60016         return ret_conv;
60017 }
60018
60019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60020         LDKBlindedPayInfo orig_conv;
60021         orig_conv.inner = untag_ptr(orig);
60022         orig_conv.is_owned = ptr_is_owned(orig);
60023         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60024         orig_conv.is_owned = false;
60025         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(&orig_conv);
60026         int64_t ret_ref = 0;
60027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60029         return ret_ref;
60030 }
60031
60032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1hash(JNIEnv *env, jclass clz, int64_t o) {
60033         LDKBlindedPayInfo o_conv;
60034         o_conv.inner = untag_ptr(o);
60035         o_conv.is_owned = ptr_is_owned(o);
60036         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60037         o_conv.is_owned = false;
60038         int64_t ret_conv = BlindedPayInfo_hash(&o_conv);
60039         return ret_conv;
60040 }
60041
60042 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60043         LDKBlindedPayInfo a_conv;
60044         a_conv.inner = untag_ptr(a);
60045         a_conv.is_owned = ptr_is_owned(a);
60046         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60047         a_conv.is_owned = false;
60048         LDKBlindedPayInfo b_conv;
60049         b_conv.inner = untag_ptr(b);
60050         b_conv.is_owned = ptr_is_owned(b);
60051         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60052         b_conv.is_owned = false;
60053         jboolean ret_conv = BlindedPayInfo_eq(&a_conv, &b_conv);
60054         return ret_conv;
60055 }
60056
60057 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
60058         LDKBlindedPayInfo obj_conv;
60059         obj_conv.inner = untag_ptr(obj);
60060         obj_conv.is_owned = ptr_is_owned(obj);
60061         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60062         obj_conv.is_owned = false;
60063         LDKCVec_u8Z ret_var = BlindedPayInfo_write(&obj_conv);
60064         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60065         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60066         CVec_u8Z_free(ret_var);
60067         return ret_arr;
60068 }
60069
60070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60071         LDKu8slice ser_ref;
60072         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60073         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60074         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
60075         *ret_conv = BlindedPayInfo_read(ser_ref);
60076         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60077         return tag_ptr(ret_conv, true);
60078 }
60079
60080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60081         LDKInvoiceError this_obj_conv;
60082         this_obj_conv.inner = untag_ptr(this_obj);
60083         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60085         InvoiceError_free(this_obj_conv);
60086 }
60087
60088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1get_1erroneous_1field(JNIEnv *env, jclass clz, int64_t this_ptr) {
60089         LDKInvoiceError this_ptr_conv;
60090         this_ptr_conv.inner = untag_ptr(this_ptr);
60091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60093         this_ptr_conv.is_owned = false;
60094         LDKErroneousField ret_var = InvoiceError_get_erroneous_field(&this_ptr_conv);
60095         int64_t ret_ref = 0;
60096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60098         return ret_ref;
60099 }
60100
60101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1set_1erroneous_1field(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60102         LDKInvoiceError this_ptr_conv;
60103         this_ptr_conv.inner = untag_ptr(this_ptr);
60104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60106         this_ptr_conv.is_owned = false;
60107         LDKErroneousField val_conv;
60108         val_conv.inner = untag_ptr(val);
60109         val_conv.is_owned = ptr_is_owned(val);
60110         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60111         val_conv = ErroneousField_clone(&val_conv);
60112         InvoiceError_set_erroneous_field(&this_ptr_conv, val_conv);
60113 }
60114
60115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1get_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
60116         LDKInvoiceError this_ptr_conv;
60117         this_ptr_conv.inner = untag_ptr(this_ptr);
60118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60120         this_ptr_conv.is_owned = false;
60121         LDKUntrustedString ret_var = InvoiceError_get_message(&this_ptr_conv);
60122         int64_t ret_ref = 0;
60123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60125         return ret_ref;
60126 }
60127
60128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1set_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60129         LDKInvoiceError this_ptr_conv;
60130         this_ptr_conv.inner = untag_ptr(this_ptr);
60131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60133         this_ptr_conv.is_owned = false;
60134         LDKUntrustedString val_conv;
60135         val_conv.inner = untag_ptr(val);
60136         val_conv.is_owned = ptr_is_owned(val);
60137         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60138         val_conv = UntrustedString_clone(&val_conv);
60139         InvoiceError_set_message(&this_ptr_conv, val_conv);
60140 }
60141
60142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1new(JNIEnv *env, jclass clz, int64_t erroneous_field_arg, int64_t message_arg) {
60143         LDKErroneousField erroneous_field_arg_conv;
60144         erroneous_field_arg_conv.inner = untag_ptr(erroneous_field_arg);
60145         erroneous_field_arg_conv.is_owned = ptr_is_owned(erroneous_field_arg);
60146         CHECK_INNER_FIELD_ACCESS_OR_NULL(erroneous_field_arg_conv);
60147         erroneous_field_arg_conv = ErroneousField_clone(&erroneous_field_arg_conv);
60148         LDKUntrustedString message_arg_conv;
60149         message_arg_conv.inner = untag_ptr(message_arg);
60150         message_arg_conv.is_owned = ptr_is_owned(message_arg);
60151         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_arg_conv);
60152         message_arg_conv = UntrustedString_clone(&message_arg_conv);
60153         LDKInvoiceError ret_var = InvoiceError_new(erroneous_field_arg_conv, message_arg_conv);
60154         int64_t ret_ref = 0;
60155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60157         return ret_ref;
60158 }
60159
60160 static inline uint64_t InvoiceError_clone_ptr(LDKInvoiceError *NONNULL_PTR arg) {
60161         LDKInvoiceError ret_var = InvoiceError_clone(arg);
60162         int64_t ret_ref = 0;
60163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60165         return ret_ref;
60166 }
60167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60168         LDKInvoiceError arg_conv;
60169         arg_conv.inner = untag_ptr(arg);
60170         arg_conv.is_owned = ptr_is_owned(arg);
60171         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60172         arg_conv.is_owned = false;
60173         int64_t ret_conv = InvoiceError_clone_ptr(&arg_conv);
60174         return ret_conv;
60175 }
60176
60177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60178         LDKInvoiceError orig_conv;
60179         orig_conv.inner = untag_ptr(orig);
60180         orig_conv.is_owned = ptr_is_owned(orig);
60181         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60182         orig_conv.is_owned = false;
60183         LDKInvoiceError ret_var = InvoiceError_clone(&orig_conv);
60184         int64_t ret_ref = 0;
60185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60187         return ret_ref;
60188 }
60189
60190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60191         LDKErroneousField this_obj_conv;
60192         this_obj_conv.inner = untag_ptr(this_obj);
60193         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60195         ErroneousField_free(this_obj_conv);
60196 }
60197
60198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1get_1tlv_1fieldnum(JNIEnv *env, jclass clz, int64_t this_ptr) {
60199         LDKErroneousField this_ptr_conv;
60200         this_ptr_conv.inner = untag_ptr(this_ptr);
60201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60203         this_ptr_conv.is_owned = false;
60204         int64_t ret_conv = ErroneousField_get_tlv_fieldnum(&this_ptr_conv);
60205         return ret_conv;
60206 }
60207
60208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1set_1tlv_1fieldnum(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60209         LDKErroneousField this_ptr_conv;
60210         this_ptr_conv.inner = untag_ptr(this_ptr);
60211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60213         this_ptr_conv.is_owned = false;
60214         ErroneousField_set_tlv_fieldnum(&this_ptr_conv, val);
60215 }
60216
60217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1get_1suggested_1value(JNIEnv *env, jclass clz, int64_t this_ptr) {
60218         LDKErroneousField this_ptr_conv;
60219         this_ptr_conv.inner = untag_ptr(this_ptr);
60220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60222         this_ptr_conv.is_owned = false;
60223         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
60224         *ret_copy = ErroneousField_get_suggested_value(&this_ptr_conv);
60225         int64_t ret_ref = tag_ptr(ret_copy, true);
60226         return ret_ref;
60227 }
60228
60229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1set_1suggested_1value(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60230         LDKErroneousField this_ptr_conv;
60231         this_ptr_conv.inner = untag_ptr(this_ptr);
60232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60234         this_ptr_conv.is_owned = false;
60235         void* val_ptr = untag_ptr(val);
60236         CHECK_ACCESS(val_ptr);
60237         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
60238         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
60239         ErroneousField_set_suggested_value(&this_ptr_conv, val_conv);
60240 }
60241
60242 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) {
60243         void* suggested_value_arg_ptr = untag_ptr(suggested_value_arg);
60244         CHECK_ACCESS(suggested_value_arg_ptr);
60245         LDKCOption_CVec_u8ZZ suggested_value_arg_conv = *(LDKCOption_CVec_u8ZZ*)(suggested_value_arg_ptr);
60246         suggested_value_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(suggested_value_arg));
60247         LDKErroneousField ret_var = ErroneousField_new(tlv_fieldnum_arg, suggested_value_arg_conv);
60248         int64_t ret_ref = 0;
60249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60250         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60251         return ret_ref;
60252 }
60253
60254 static inline uint64_t ErroneousField_clone_ptr(LDKErroneousField *NONNULL_PTR arg) {
60255         LDKErroneousField ret_var = ErroneousField_clone(arg);
60256         int64_t ret_ref = 0;
60257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60259         return ret_ref;
60260 }
60261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60262         LDKErroneousField arg_conv;
60263         arg_conv.inner = untag_ptr(arg);
60264         arg_conv.is_owned = ptr_is_owned(arg);
60265         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60266         arg_conv.is_owned = false;
60267         int64_t ret_conv = ErroneousField_clone_ptr(&arg_conv);
60268         return ret_conv;
60269 }
60270
60271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60272         LDKErroneousField orig_conv;
60273         orig_conv.inner = untag_ptr(orig);
60274         orig_conv.is_owned = ptr_is_owned(orig);
60275         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60276         orig_conv.is_owned = false;
60277         LDKErroneousField ret_var = ErroneousField_clone(&orig_conv);
60278         int64_t ret_ref = 0;
60279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60281         return ret_ref;
60282 }
60283
60284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1from_1string(JNIEnv *env, jclass clz, jstring s) {
60285         LDKStr s_conv = java_to_owned_str(env, s);
60286         LDKInvoiceError ret_var = InvoiceError_from_string(s_conv);
60287         int64_t ret_ref = 0;
60288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60289         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60290         return ret_ref;
60291 }
60292
60293 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceError_1write(JNIEnv *env, jclass clz, int64_t obj) {
60294         LDKInvoiceError obj_conv;
60295         obj_conv.inner = untag_ptr(obj);
60296         obj_conv.is_owned = ptr_is_owned(obj);
60297         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60298         obj_conv.is_owned = false;
60299         LDKCVec_u8Z ret_var = InvoiceError_write(&obj_conv);
60300         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60301         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60302         CVec_u8Z_free(ret_var);
60303         return ret_arr;
60304 }
60305
60306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60307         LDKu8slice ser_ref;
60308         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60309         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60310         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
60311         *ret_conv = InvoiceError_read(ser_ref);
60312         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60313         return tag_ptr(ret_conv, true);
60314 }
60315
60316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60317         LDKUnsignedInvoiceRequest this_obj_conv;
60318         this_obj_conv.inner = untag_ptr(this_obj);
60319         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60321         UnsignedInvoiceRequest_free(this_obj_conv);
60322 }
60323
60324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1tagged_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
60325         LDKUnsignedInvoiceRequest 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         LDKTaggedHash ret_var = UnsignedInvoiceRequest_tagged_hash(&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 void JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60338         LDKInvoiceRequest this_obj_conv;
60339         this_obj_conv.inner = untag_ptr(this_obj);
60340         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60342         InvoiceRequest_free(this_obj_conv);
60343 }
60344
60345 static inline uint64_t InvoiceRequest_clone_ptr(LDKInvoiceRequest *NONNULL_PTR arg) {
60346         LDKInvoiceRequest ret_var = InvoiceRequest_clone(arg);
60347         int64_t ret_ref = 0;
60348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60350         return ret_ref;
60351 }
60352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60353         LDKInvoiceRequest arg_conv;
60354         arg_conv.inner = untag_ptr(arg);
60355         arg_conv.is_owned = ptr_is_owned(arg);
60356         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60357         arg_conv.is_owned = false;
60358         int64_t ret_conv = InvoiceRequest_clone_ptr(&arg_conv);
60359         return ret_conv;
60360 }
60361
60362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60363         LDKInvoiceRequest orig_conv;
60364         orig_conv.inner = untag_ptr(orig);
60365         orig_conv.is_owned = ptr_is_owned(orig);
60366         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60367         orig_conv.is_owned = false;
60368         LDKInvoiceRequest ret_var = InvoiceRequest_clone(&orig_conv);
60369         int64_t ret_ref = 0;
60370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60372         return ret_ref;
60373 }
60374
60375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60376         LDKVerifiedInvoiceRequest this_obj_conv;
60377         this_obj_conv.inner = untag_ptr(this_obj);
60378         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60380         VerifiedInvoiceRequest_free(this_obj_conv);
60381 }
60382
60383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1get_1keys(JNIEnv *env, jclass clz, int64_t this_ptr) {
60384         LDKVerifiedInvoiceRequest this_ptr_conv;
60385         this_ptr_conv.inner = untag_ptr(this_ptr);
60386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60388         this_ptr_conv.is_owned = false;
60389         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
60390         *ret_copy = VerifiedInvoiceRequest_get_keys(&this_ptr_conv);
60391         int64_t ret_ref = tag_ptr(ret_copy, true);
60392         return ret_ref;
60393 }
60394
60395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1set_1keys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60396         LDKVerifiedInvoiceRequest this_ptr_conv;
60397         this_ptr_conv.inner = untag_ptr(this_ptr);
60398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60400         this_ptr_conv.is_owned = false;
60401         void* val_ptr = untag_ptr(val);
60402         CHECK_ACCESS(val_ptr);
60403         LDKCOption_SecretKeyZ val_conv = *(LDKCOption_SecretKeyZ*)(val_ptr);
60404         val_conv = COption_SecretKeyZ_clone((LDKCOption_SecretKeyZ*)untag_ptr(val));
60405         VerifiedInvoiceRequest_set_keys(&this_ptr_conv, val_conv);
60406 }
60407
60408 static inline uint64_t VerifiedInvoiceRequest_clone_ptr(LDKVerifiedInvoiceRequest *NONNULL_PTR arg) {
60409         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(arg);
60410         int64_t ret_ref = 0;
60411         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60412         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60413         return ret_ref;
60414 }
60415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60416         LDKVerifiedInvoiceRequest arg_conv;
60417         arg_conv.inner = untag_ptr(arg);
60418         arg_conv.is_owned = ptr_is_owned(arg);
60419         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60420         arg_conv.is_owned = false;
60421         int64_t ret_conv = VerifiedInvoiceRequest_clone_ptr(&arg_conv);
60422         return ret_conv;
60423 }
60424
60425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60426         LDKVerifiedInvoiceRequest orig_conv;
60427         orig_conv.inner = untag_ptr(orig);
60428         orig_conv.is_owned = ptr_is_owned(orig);
60429         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60430         orig_conv.is_owned = false;
60431         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(&orig_conv);
60432         int64_t ret_ref = 0;
60433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60435         return ret_ref;
60436 }
60437
60438 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
60439         LDKUnsignedInvoiceRequest this_arg_conv;
60440         this_arg_conv.inner = untag_ptr(this_arg);
60441         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60443         this_arg_conv.is_owned = false;
60444         LDKCVec_ThirtyTwoBytesZ ret_var = UnsignedInvoiceRequest_chains(&this_arg_conv);
60445         jobjectArray ret_arr = NULL;
60446         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
60447         ;
60448         for (size_t i = 0; i < ret_var.datalen; i++) {
60449                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
60450                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
60451                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
60452         }
60453         
60454         FREE(ret_var.data);
60455         return ret_arr;
60456 }
60457
60458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
60459         LDKUnsignedInvoiceRequest this_arg_conv;
60460         this_arg_conv.inner = untag_ptr(this_arg);
60461         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60463         this_arg_conv.is_owned = false;
60464         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
60465         *ret_copy = UnsignedInvoiceRequest_metadata(&this_arg_conv);
60466         int64_t ret_ref = tag_ptr(ret_copy, true);
60467         return ret_ref;
60468 }
60469
60470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
60471         LDKUnsignedInvoiceRequest this_arg_conv;
60472         this_arg_conv.inner = untag_ptr(this_arg);
60473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60475         this_arg_conv.is_owned = false;
60476         LDKAmount ret_var = UnsignedInvoiceRequest_amount(&this_arg_conv);
60477         int64_t ret_ref = 0;
60478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60480         return ret_ref;
60481 }
60482
60483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
60484         LDKUnsignedInvoiceRequest this_arg_conv;
60485         this_arg_conv.inner = untag_ptr(this_arg);
60486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60488         this_arg_conv.is_owned = false;
60489         LDKPrintableString ret_var = UnsignedInvoiceRequest_description(&this_arg_conv);
60490         int64_t ret_ref = 0;
60491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60493         return ret_ref;
60494 }
60495
60496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
60497         LDKUnsignedInvoiceRequest this_arg_conv;
60498         this_arg_conv.inner = untag_ptr(this_arg);
60499         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60501         this_arg_conv.is_owned = false;
60502         LDKOfferFeatures ret_var = UnsignedInvoiceRequest_offer_features(&this_arg_conv);
60503         int64_t ret_ref = 0;
60504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60506         return ret_ref;
60507 }
60508
60509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
60510         LDKUnsignedInvoiceRequest this_arg_conv;
60511         this_arg_conv.inner = untag_ptr(this_arg);
60512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60514         this_arg_conv.is_owned = false;
60515         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60516         *ret_copy = UnsignedInvoiceRequest_absolute_expiry(&this_arg_conv);
60517         int64_t ret_ref = tag_ptr(ret_copy, true);
60518         return ret_ref;
60519 }
60520
60521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
60522         LDKUnsignedInvoiceRequest this_arg_conv;
60523         this_arg_conv.inner = untag_ptr(this_arg);
60524         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60526         this_arg_conv.is_owned = false;
60527         LDKPrintableString ret_var = UnsignedInvoiceRequest_issuer(&this_arg_conv);
60528         int64_t ret_ref = 0;
60529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60531         return ret_ref;
60532 }
60533
60534 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
60535         LDKUnsignedInvoiceRequest this_arg_conv;
60536         this_arg_conv.inner = untag_ptr(this_arg);
60537         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60539         this_arg_conv.is_owned = false;
60540         LDKCVec_BlindedPathZ ret_var = UnsignedInvoiceRequest_paths(&this_arg_conv);
60541         int64_tArray ret_arr = NULL;
60542         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
60543         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
60544         for (size_t n = 0; n < ret_var.datalen; n++) {
60545                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
60546                 int64_t ret_conv_13_ref = 0;
60547                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
60548                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
60549                 ret_arr_ptr[n] = ret_conv_13_ref;
60550         }
60551         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
60552         FREE(ret_var.data);
60553         return ret_arr;
60554 }
60555
60556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
60557         LDKUnsignedInvoiceRequest this_arg_conv;
60558         this_arg_conv.inner = untag_ptr(this_arg);
60559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60561         this_arg_conv.is_owned = false;
60562         LDKQuantity ret_var = UnsignedInvoiceRequest_supported_quantity(&this_arg_conv);
60563         int64_t ret_ref = 0;
60564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60566         return ret_ref;
60567 }
60568
60569 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
60570         LDKUnsignedInvoiceRequest this_arg_conv;
60571         this_arg_conv.inner = untag_ptr(this_arg);
60572         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60574         this_arg_conv.is_owned = false;
60575         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
60576         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form);
60577         return ret_arr;
60578 }
60579
60580 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
60581         LDKUnsignedInvoiceRequest this_arg_conv;
60582         this_arg_conv.inner = untag_ptr(this_arg);
60583         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60585         this_arg_conv.is_owned = false;
60586         LDKu8slice ret_var = UnsignedInvoiceRequest_payer_metadata(&this_arg_conv);
60587         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60588         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60589         return ret_arr;
60590 }
60591
60592 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
60593         LDKUnsignedInvoiceRequest this_arg_conv;
60594         this_arg_conv.inner = untag_ptr(this_arg);
60595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60597         this_arg_conv.is_owned = false;
60598         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
60599         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, UnsignedInvoiceRequest_chain(&this_arg_conv).data);
60600         return ret_arr;
60601 }
60602
60603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
60604         LDKUnsignedInvoiceRequest this_arg_conv;
60605         this_arg_conv.inner = untag_ptr(this_arg);
60606         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60608         this_arg_conv.is_owned = false;
60609         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60610         *ret_copy = UnsignedInvoiceRequest_amount_msats(&this_arg_conv);
60611         int64_t ret_ref = tag_ptr(ret_copy, true);
60612         return ret_ref;
60613 }
60614
60615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
60616         LDKUnsignedInvoiceRequest this_arg_conv;
60617         this_arg_conv.inner = untag_ptr(this_arg);
60618         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60620         this_arg_conv.is_owned = false;
60621         LDKInvoiceRequestFeatures ret_var = UnsignedInvoiceRequest_invoice_request_features(&this_arg_conv);
60622         int64_t ret_ref = 0;
60623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60625         return ret_ref;
60626 }
60627
60628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
60629         LDKUnsignedInvoiceRequest this_arg_conv;
60630         this_arg_conv.inner = untag_ptr(this_arg);
60631         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60633         this_arg_conv.is_owned = false;
60634         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60635         *ret_copy = UnsignedInvoiceRequest_quantity(&this_arg_conv);
60636         int64_t ret_ref = tag_ptr(ret_copy, true);
60637         return ret_ref;
60638 }
60639
60640 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
60641         LDKUnsignedInvoiceRequest this_arg_conv;
60642         this_arg_conv.inner = untag_ptr(this_arg);
60643         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60645         this_arg_conv.is_owned = false;
60646         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
60647         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedInvoiceRequest_payer_id(&this_arg_conv).compressed_form);
60648         return ret_arr;
60649 }
60650
60651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
60652         LDKUnsignedInvoiceRequest this_arg_conv;
60653         this_arg_conv.inner = untag_ptr(this_arg);
60654         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60656         this_arg_conv.is_owned = false;
60657         LDKPrintableString ret_var = UnsignedInvoiceRequest_payer_note(&this_arg_conv);
60658         int64_t ret_ref = 0;
60659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60661         return ret_ref;
60662 }
60663
60664 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
60665         LDKInvoiceRequest this_arg_conv;
60666         this_arg_conv.inner = untag_ptr(this_arg);
60667         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60669         this_arg_conv.is_owned = false;
60670         LDKCVec_ThirtyTwoBytesZ ret_var = InvoiceRequest_chains(&this_arg_conv);
60671         jobjectArray ret_arr = NULL;
60672         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
60673         ;
60674         for (size_t i = 0; i < ret_var.datalen; i++) {
60675                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
60676                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
60677                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
60678         }
60679         
60680         FREE(ret_var.data);
60681         return ret_arr;
60682 }
60683
60684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
60685         LDKInvoiceRequest this_arg_conv;
60686         this_arg_conv.inner = untag_ptr(this_arg);
60687         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60689         this_arg_conv.is_owned = false;
60690         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
60691         *ret_copy = InvoiceRequest_metadata(&this_arg_conv);
60692         int64_t ret_ref = tag_ptr(ret_copy, true);
60693         return ret_ref;
60694 }
60695
60696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
60697         LDKInvoiceRequest this_arg_conv;
60698         this_arg_conv.inner = untag_ptr(this_arg);
60699         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60701         this_arg_conv.is_owned = false;
60702         LDKAmount ret_var = InvoiceRequest_amount(&this_arg_conv);
60703         int64_t ret_ref = 0;
60704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60706         return ret_ref;
60707 }
60708
60709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
60710         LDKInvoiceRequest this_arg_conv;
60711         this_arg_conv.inner = untag_ptr(this_arg);
60712         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60714         this_arg_conv.is_owned = false;
60715         LDKPrintableString ret_var = InvoiceRequest_description(&this_arg_conv);
60716         int64_t ret_ref = 0;
60717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60719         return ret_ref;
60720 }
60721
60722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
60723         LDKInvoiceRequest this_arg_conv;
60724         this_arg_conv.inner = untag_ptr(this_arg);
60725         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60727         this_arg_conv.is_owned = false;
60728         LDKOfferFeatures ret_var = InvoiceRequest_offer_features(&this_arg_conv);
60729         int64_t ret_ref = 0;
60730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60732         return ret_ref;
60733 }
60734
60735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
60736         LDKInvoiceRequest this_arg_conv;
60737         this_arg_conv.inner = untag_ptr(this_arg);
60738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60740         this_arg_conv.is_owned = false;
60741         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60742         *ret_copy = InvoiceRequest_absolute_expiry(&this_arg_conv);
60743         int64_t ret_ref = tag_ptr(ret_copy, true);
60744         return ret_ref;
60745 }
60746
60747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
60748         LDKInvoiceRequest this_arg_conv;
60749         this_arg_conv.inner = untag_ptr(this_arg);
60750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60752         this_arg_conv.is_owned = false;
60753         LDKPrintableString ret_var = InvoiceRequest_issuer(&this_arg_conv);
60754         int64_t ret_ref = 0;
60755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60757         return ret_ref;
60758 }
60759
60760 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
60761         LDKInvoiceRequest this_arg_conv;
60762         this_arg_conv.inner = untag_ptr(this_arg);
60763         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60765         this_arg_conv.is_owned = false;
60766         LDKCVec_BlindedPathZ ret_var = InvoiceRequest_paths(&this_arg_conv);
60767         int64_tArray ret_arr = NULL;
60768         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
60769         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
60770         for (size_t n = 0; n < ret_var.datalen; n++) {
60771                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
60772                 int64_t ret_conv_13_ref = 0;
60773                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
60774                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
60775                 ret_arr_ptr[n] = ret_conv_13_ref;
60776         }
60777         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
60778         FREE(ret_var.data);
60779         return ret_arr;
60780 }
60781
60782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
60783         LDKInvoiceRequest this_arg_conv;
60784         this_arg_conv.inner = untag_ptr(this_arg);
60785         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60787         this_arg_conv.is_owned = false;
60788         LDKQuantity ret_var = InvoiceRequest_supported_quantity(&this_arg_conv);
60789         int64_t ret_ref = 0;
60790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60792         return ret_ref;
60793 }
60794
60795 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
60796         LDKInvoiceRequest this_arg_conv;
60797         this_arg_conv.inner = untag_ptr(this_arg);
60798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60800         this_arg_conv.is_owned = false;
60801         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
60802         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, InvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form);
60803         return ret_arr;
60804 }
60805
60806 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
60807         LDKInvoiceRequest this_arg_conv;
60808         this_arg_conv.inner = untag_ptr(this_arg);
60809         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60811         this_arg_conv.is_owned = false;
60812         LDKu8slice ret_var = InvoiceRequest_payer_metadata(&this_arg_conv);
60813         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60814         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60815         return ret_arr;
60816 }
60817
60818 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
60819         LDKInvoiceRequest this_arg_conv;
60820         this_arg_conv.inner = untag_ptr(this_arg);
60821         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60823         this_arg_conv.is_owned = false;
60824         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
60825         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, InvoiceRequest_chain(&this_arg_conv).data);
60826         return ret_arr;
60827 }
60828
60829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
60830         LDKInvoiceRequest this_arg_conv;
60831         this_arg_conv.inner = untag_ptr(this_arg);
60832         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60834         this_arg_conv.is_owned = false;
60835         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60836         *ret_copy = InvoiceRequest_amount_msats(&this_arg_conv);
60837         int64_t ret_ref = tag_ptr(ret_copy, true);
60838         return ret_ref;
60839 }
60840
60841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
60842         LDKInvoiceRequest 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 = InvoiceRequest_invoice_request_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_InvoiceRequest_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
60855         LDKInvoiceRequest 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 = InvoiceRequest_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_InvoiceRequest_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
60867         LDKInvoiceRequest 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, InvoiceRequest_payer_id(&this_arg_conv).compressed_form);
60874         return ret_arr;
60875 }
60876
60877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
60878         LDKInvoiceRequest 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 = InvoiceRequest_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_InvoiceRequest_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
60891         LDKInvoiceRequest this_arg_conv;
60892         this_arg_conv.inner = untag_ptr(this_arg);
60893         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60895         this_arg_conv.is_owned = false;
60896         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
60897         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, InvoiceRequest_signature(&this_arg_conv).compact_form);
60898         return ret_arr;
60899 }
60900
60901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t key) {
60902         LDKInvoiceRequest this_arg_conv;
60903         this_arg_conv.inner = untag_ptr(this_arg);
60904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60906         this_arg_conv = InvoiceRequest_clone(&this_arg_conv);
60907         LDKExpandedKey key_conv;
60908         key_conv.inner = untag_ptr(key);
60909         key_conv.is_owned = ptr_is_owned(key);
60910         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
60911         key_conv.is_owned = false;
60912         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
60913         *ret_conv = InvoiceRequest_verify(this_arg_conv, &key_conv);
60914         return tag_ptr(ret_conv, true);
60915 }
60916
60917 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
60918         LDKVerifiedInvoiceRequest this_arg_conv;
60919         this_arg_conv.inner = untag_ptr(this_arg);
60920         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60922         this_arg_conv.is_owned = false;
60923         LDKCVec_ThirtyTwoBytesZ ret_var = VerifiedInvoiceRequest_chains(&this_arg_conv);
60924         jobjectArray ret_arr = NULL;
60925         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
60926         ;
60927         for (size_t i = 0; i < ret_var.datalen; i++) {
60928                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
60929                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
60930                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
60931         }
60932         
60933         FREE(ret_var.data);
60934         return ret_arr;
60935 }
60936
60937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
60938         LDKVerifiedInvoiceRequest this_arg_conv;
60939         this_arg_conv.inner = untag_ptr(this_arg);
60940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60942         this_arg_conv.is_owned = false;
60943         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
60944         *ret_copy = VerifiedInvoiceRequest_metadata(&this_arg_conv);
60945         int64_t ret_ref = tag_ptr(ret_copy, true);
60946         return ret_ref;
60947 }
60948
60949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
60950         LDKVerifiedInvoiceRequest this_arg_conv;
60951         this_arg_conv.inner = untag_ptr(this_arg);
60952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60954         this_arg_conv.is_owned = false;
60955         LDKAmount ret_var = VerifiedInvoiceRequest_amount(&this_arg_conv);
60956         int64_t ret_ref = 0;
60957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60959         return ret_ref;
60960 }
60961
60962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
60963         LDKVerifiedInvoiceRequest this_arg_conv;
60964         this_arg_conv.inner = untag_ptr(this_arg);
60965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60967         this_arg_conv.is_owned = false;
60968         LDKPrintableString ret_var = VerifiedInvoiceRequest_description(&this_arg_conv);
60969         int64_t ret_ref = 0;
60970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60972         return ret_ref;
60973 }
60974
60975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
60976         LDKVerifiedInvoiceRequest this_arg_conv;
60977         this_arg_conv.inner = untag_ptr(this_arg);
60978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60980         this_arg_conv.is_owned = false;
60981         LDKOfferFeatures ret_var = VerifiedInvoiceRequest_offer_features(&this_arg_conv);
60982         int64_t ret_ref = 0;
60983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60985         return ret_ref;
60986 }
60987
60988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
60989         LDKVerifiedInvoiceRequest this_arg_conv;
60990         this_arg_conv.inner = untag_ptr(this_arg);
60991         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60993         this_arg_conv.is_owned = false;
60994         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60995         *ret_copy = VerifiedInvoiceRequest_absolute_expiry(&this_arg_conv);
60996         int64_t ret_ref = tag_ptr(ret_copy, true);
60997         return ret_ref;
60998 }
60999
61000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
61001         LDKVerifiedInvoiceRequest this_arg_conv;
61002         this_arg_conv.inner = untag_ptr(this_arg);
61003         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61005         this_arg_conv.is_owned = false;
61006         LDKPrintableString ret_var = VerifiedInvoiceRequest_issuer(&this_arg_conv);
61007         int64_t ret_ref = 0;
61008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61010         return ret_ref;
61011 }
61012
61013 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
61014         LDKVerifiedInvoiceRequest this_arg_conv;
61015         this_arg_conv.inner = untag_ptr(this_arg);
61016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61018         this_arg_conv.is_owned = false;
61019         LDKCVec_BlindedPathZ ret_var = VerifiedInvoiceRequest_paths(&this_arg_conv);
61020         int64_tArray ret_arr = NULL;
61021         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
61022         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
61023         for (size_t n = 0; n < ret_var.datalen; n++) {
61024                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
61025                 int64_t ret_conv_13_ref = 0;
61026                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
61027                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
61028                 ret_arr_ptr[n] = ret_conv_13_ref;
61029         }
61030         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
61031         FREE(ret_var.data);
61032         return ret_arr;
61033 }
61034
61035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
61036         LDKVerifiedInvoiceRequest this_arg_conv;
61037         this_arg_conv.inner = untag_ptr(this_arg);
61038         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61040         this_arg_conv.is_owned = false;
61041         LDKQuantity ret_var = VerifiedInvoiceRequest_supported_quantity(&this_arg_conv);
61042         int64_t ret_ref = 0;
61043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61045         return ret_ref;
61046 }
61047
61048 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
61049         LDKVerifiedInvoiceRequest this_arg_conv;
61050         this_arg_conv.inner = untag_ptr(this_arg);
61051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61053         this_arg_conv.is_owned = false;
61054         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
61055         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, VerifiedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form);
61056         return ret_arr;
61057 }
61058
61059 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
61060         LDKVerifiedInvoiceRequest this_arg_conv;
61061         this_arg_conv.inner = untag_ptr(this_arg);
61062         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61064         this_arg_conv.is_owned = false;
61065         LDKu8slice ret_var = VerifiedInvoiceRequest_payer_metadata(&this_arg_conv);
61066         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61067         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61068         return ret_arr;
61069 }
61070
61071 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
61072         LDKVerifiedInvoiceRequest this_arg_conv;
61073         this_arg_conv.inner = untag_ptr(this_arg);
61074         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61076         this_arg_conv.is_owned = false;
61077         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
61078         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, VerifiedInvoiceRequest_chain(&this_arg_conv).data);
61079         return ret_arr;
61080 }
61081
61082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
61083         LDKVerifiedInvoiceRequest this_arg_conv;
61084         this_arg_conv.inner = untag_ptr(this_arg);
61085         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61087         this_arg_conv.is_owned = false;
61088         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61089         *ret_copy = VerifiedInvoiceRequest_amount_msats(&this_arg_conv);
61090         int64_t ret_ref = tag_ptr(ret_copy, true);
61091         return ret_ref;
61092 }
61093
61094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
61095         LDKVerifiedInvoiceRequest this_arg_conv;
61096         this_arg_conv.inner = untag_ptr(this_arg);
61097         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61099         this_arg_conv.is_owned = false;
61100         LDKInvoiceRequestFeatures ret_var = VerifiedInvoiceRequest_invoice_request_features(&this_arg_conv);
61101         int64_t ret_ref = 0;
61102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61104         return ret_ref;
61105 }
61106
61107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
61108         LDKVerifiedInvoiceRequest this_arg_conv;
61109         this_arg_conv.inner = untag_ptr(this_arg);
61110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61112         this_arg_conv.is_owned = false;
61113         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61114         *ret_copy = VerifiedInvoiceRequest_quantity(&this_arg_conv);
61115         int64_t ret_ref = tag_ptr(ret_copy, true);
61116         return ret_ref;
61117 }
61118
61119 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
61120         LDKVerifiedInvoiceRequest this_arg_conv;
61121         this_arg_conv.inner = untag_ptr(this_arg);
61122         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61124         this_arg_conv.is_owned = false;
61125         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
61126         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, VerifiedInvoiceRequest_payer_id(&this_arg_conv).compressed_form);
61127         return ret_arr;
61128 }
61129
61130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
61131         LDKVerifiedInvoiceRequest this_arg_conv;
61132         this_arg_conv.inner = untag_ptr(this_arg);
61133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61135         this_arg_conv.is_owned = false;
61136         LDKPrintableString ret_var = VerifiedInvoiceRequest_payer_note(&this_arg_conv);
61137         int64_t ret_ref = 0;
61138         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61139         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61140         return ret_ref;
61141 }
61142
61143 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1write(JNIEnv *env, jclass clz, int64_t obj) {
61144         LDKUnsignedInvoiceRequest obj_conv;
61145         obj_conv.inner = untag_ptr(obj);
61146         obj_conv.is_owned = ptr_is_owned(obj);
61147         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61148         obj_conv.is_owned = false;
61149         LDKCVec_u8Z ret_var = UnsignedInvoiceRequest_write(&obj_conv);
61150         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61151         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61152         CVec_u8Z_free(ret_var);
61153         return ret_arr;
61154 }
61155
61156 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1write(JNIEnv *env, jclass clz, int64_t obj) {
61157         LDKInvoiceRequest obj_conv;
61158         obj_conv.inner = untag_ptr(obj);
61159         obj_conv.is_owned = ptr_is_owned(obj);
61160         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61161         obj_conv.is_owned = false;
61162         LDKCVec_u8Z ret_var = InvoiceRequest_write(&obj_conv);
61163         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61164         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61165         CVec_u8Z_free(ret_var);
61166         return ret_arr;
61167 }
61168
61169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TaggedHash_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61170         LDKTaggedHash this_obj_conv;
61171         this_obj_conv.inner = untag_ptr(this_obj);
61172         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61174         TaggedHash_free(this_obj_conv);
61175 }
61176
61177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61178         LDKBolt12ParseError 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         Bolt12ParseError_free(this_obj_conv);
61183 }
61184
61185 static inline uint64_t Bolt12ParseError_clone_ptr(LDKBolt12ParseError *NONNULL_PTR arg) {
61186         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(arg);
61187         int64_t ret_ref = 0;
61188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61190         return ret_ref;
61191 }
61192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61193         LDKBolt12ParseError arg_conv;
61194         arg_conv.inner = untag_ptr(arg);
61195         arg_conv.is_owned = ptr_is_owned(arg);
61196         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61197         arg_conv.is_owned = false;
61198         int64_t ret_conv = Bolt12ParseError_clone_ptr(&arg_conv);
61199         return ret_conv;
61200 }
61201
61202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61203         LDKBolt12ParseError orig_conv;
61204         orig_conv.inner = untag_ptr(orig);
61205         orig_conv.is_owned = ptr_is_owned(orig);
61206         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61207         orig_conv.is_owned = false;
61208         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(&orig_conv);
61209         int64_t ret_ref = 0;
61210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61212         return ret_ref;
61213 }
61214
61215 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61216         LDKBolt12SemanticError* orig_conv = (LDKBolt12SemanticError*)untag_ptr(orig);
61217         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_clone(orig_conv));
61218         return ret_conv;
61219 }
61220
61221 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1already_1expired(JNIEnv *env, jclass clz) {
61222         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_already_expired());
61223         return ret_conv;
61224 }
61225
61226 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unsupported_1chain(JNIEnv *env, jclass clz) {
61227         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unsupported_chain());
61228         return ret_conv;
61229 }
61230
61231 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1chain(JNIEnv *env, jclass clz) {
61232         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_chain());
61233         return ret_conv;
61234 }
61235
61236 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1amount(JNIEnv *env, jclass clz) {
61237         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_amount());
61238         return ret_conv;
61239 }
61240
61241 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1amount(JNIEnv *env, jclass clz) {
61242         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_amount());
61243         return ret_conv;
61244 }
61245
61246 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1insufficient_1amount(JNIEnv *env, jclass clz) {
61247         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_insufficient_amount());
61248         return ret_conv;
61249 }
61250
61251 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1amount(JNIEnv *env, jclass clz) {
61252         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_amount());
61253         return ret_conv;
61254 }
61255
61256 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unsupported_1currency(JNIEnv *env, jclass clz) {
61257         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unsupported_currency());
61258         return ret_conv;
61259 }
61260
61261 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unknown_1required_1features(JNIEnv *env, jclass clz) {
61262         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unknown_required_features());
61263         return ret_conv;
61264 }
61265
61266 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1features(JNIEnv *env, jclass clz) {
61267         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_features());
61268         return ret_conv;
61269 }
61270
61271 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1description(JNIEnv *env, jclass clz) {
61272         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_description());
61273         return ret_conv;
61274 }
61275
61276 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1signing_1pubkey(JNIEnv *env, jclass clz) {
61277         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_signing_pubkey());
61278         return ret_conv;
61279 }
61280
61281 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1signing_1pubkey(JNIEnv *env, jclass clz) {
61282         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_signing_pubkey());
61283         return ret_conv;
61284 }
61285
61286 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1signing_1pubkey(JNIEnv *env, jclass clz) {
61287         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_signing_pubkey());
61288         return ret_conv;
61289 }
61290
61291 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1quantity(JNIEnv *env, jclass clz) {
61292         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_quantity());
61293         return ret_conv;
61294 }
61295
61296 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1quantity(JNIEnv *env, jclass clz) {
61297         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_quantity());
61298         return ret_conv;
61299 }
61300
61301 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1quantity(JNIEnv *env, jclass clz) {
61302         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_quantity());
61303         return ret_conv;
61304 }
61305
61306 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1metadata(JNIEnv *env, jclass clz) {
61307         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_metadata());
61308         return ret_conv;
61309 }
61310
61311 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1metadata(JNIEnv *env, jclass clz) {
61312         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_metadata());
61313         return ret_conv;
61314 }
61315
61316 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payer_1metadata(JNIEnv *env, jclass clz) {
61317         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payer_metadata());
61318         return ret_conv;
61319 }
61320
61321 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payer_1id(JNIEnv *env, jclass clz) {
61322         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payer_id());
61323         return ret_conv;
61324 }
61325
61326 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1duplicate_1payment_1id(JNIEnv *env, jclass clz) {
61327         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_duplicate_payment_id());
61328         return ret_conv;
61329 }
61330
61331 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1paths(JNIEnv *env, jclass clz) {
61332         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_paths());
61333         return ret_conv;
61334 }
61335
61336 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1pay_1info(JNIEnv *env, jclass clz) {
61337         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_pay_info());
61338         return ret_conv;
61339 }
61340
61341 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1creation_1time(JNIEnv *env, jclass clz) {
61342         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_creation_time());
61343         return ret_conv;
61344 }
61345
61346 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payment_1hash(JNIEnv *env, jclass clz) {
61347         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payment_hash());
61348         return ret_conv;
61349 }
61350
61351 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1signature(JNIEnv *env, jclass clz) {
61352         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_signature());
61353         return ret_conv;
61354 }
61355
61356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Refund_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61357         LDKRefund this_obj_conv;
61358         this_obj_conv.inner = untag_ptr(this_obj);
61359         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61361         Refund_free(this_obj_conv);
61362 }
61363
61364 static inline uint64_t Refund_clone_ptr(LDKRefund *NONNULL_PTR arg) {
61365         LDKRefund ret_var = Refund_clone(arg);
61366         int64_t ret_ref = 0;
61367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61369         return ret_ref;
61370 }
61371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61372         LDKRefund arg_conv;
61373         arg_conv.inner = untag_ptr(arg);
61374         arg_conv.is_owned = ptr_is_owned(arg);
61375         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61376         arg_conv.is_owned = false;
61377         int64_t ret_conv = Refund_clone_ptr(&arg_conv);
61378         return ret_conv;
61379 }
61380
61381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61382         LDKRefund orig_conv;
61383         orig_conv.inner = untag_ptr(orig);
61384         orig_conv.is_owned = ptr_is_owned(orig);
61385         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61386         orig_conv.is_owned = false;
61387         LDKRefund ret_var = Refund_clone(&orig_conv);
61388         int64_t ret_ref = 0;
61389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61391         return ret_ref;
61392 }
61393
61394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
61395         LDKRefund this_arg_conv;
61396         this_arg_conv.inner = untag_ptr(this_arg);
61397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61399         this_arg_conv.is_owned = false;
61400         LDKPrintableString ret_var = Refund_description(&this_arg_conv);
61401         int64_t ret_ref = 0;
61402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61404         return ret_ref;
61405 }
61406
61407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
61408         LDKRefund this_arg_conv;
61409         this_arg_conv.inner = untag_ptr(this_arg);
61410         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61412         this_arg_conv.is_owned = false;
61413         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61414         *ret_copy = Refund_absolute_expiry(&this_arg_conv);
61415         int64_t ret_ref = tag_ptr(ret_copy, true);
61416         return ret_ref;
61417 }
61418
61419 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Refund_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
61420         LDKRefund this_arg_conv;
61421         this_arg_conv.inner = untag_ptr(this_arg);
61422         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61424         this_arg_conv.is_owned = false;
61425         jboolean ret_conv = Refund_is_expired(&this_arg_conv);
61426         return ret_conv;
61427 }
61428
61429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
61430         LDKRefund this_arg_conv;
61431         this_arg_conv.inner = untag_ptr(this_arg);
61432         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61434         this_arg_conv.is_owned = false;
61435         LDKPrintableString ret_var = Refund_issuer(&this_arg_conv);
61436         int64_t ret_ref = 0;
61437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61439         return ret_ref;
61440 }
61441
61442 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
61443         LDKRefund this_arg_conv;
61444         this_arg_conv.inner = untag_ptr(this_arg);
61445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61447         this_arg_conv.is_owned = false;
61448         LDKCVec_BlindedPathZ ret_var = Refund_paths(&this_arg_conv);
61449         int64_tArray ret_arr = NULL;
61450         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
61451         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
61452         for (size_t n = 0; n < ret_var.datalen; n++) {
61453                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
61454                 int64_t ret_conv_13_ref = 0;
61455                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
61456                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
61457                 ret_arr_ptr[n] = ret_conv_13_ref;
61458         }
61459         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
61460         FREE(ret_var.data);
61461         return ret_arr;
61462 }
61463
61464 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
61465         LDKRefund this_arg_conv;
61466         this_arg_conv.inner = untag_ptr(this_arg);
61467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61469         this_arg_conv.is_owned = false;
61470         LDKu8slice ret_var = Refund_payer_metadata(&this_arg_conv);
61471         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61472         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61473         return ret_arr;
61474 }
61475
61476 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
61477         LDKRefund this_arg_conv;
61478         this_arg_conv.inner = untag_ptr(this_arg);
61479         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61481         this_arg_conv.is_owned = false;
61482         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
61483         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Refund_chain(&this_arg_conv).data);
61484         return ret_arr;
61485 }
61486
61487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
61488         LDKRefund this_arg_conv;
61489         this_arg_conv.inner = untag_ptr(this_arg);
61490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61492         this_arg_conv.is_owned = false;
61493         int64_t ret_conv = Refund_amount_msats(&this_arg_conv);
61494         return ret_conv;
61495 }
61496
61497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
61498         LDKRefund this_arg_conv;
61499         this_arg_conv.inner = untag_ptr(this_arg);
61500         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61502         this_arg_conv.is_owned = false;
61503         LDKInvoiceRequestFeatures ret_var = Refund_features(&this_arg_conv);
61504         int64_t ret_ref = 0;
61505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61507         return ret_ref;
61508 }
61509
61510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
61511         LDKRefund this_arg_conv;
61512         this_arg_conv.inner = untag_ptr(this_arg);
61513         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61515         this_arg_conv.is_owned = false;
61516         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61517         *ret_copy = Refund_quantity(&this_arg_conv);
61518         int64_t ret_ref = tag_ptr(ret_copy, true);
61519         return ret_ref;
61520 }
61521
61522 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
61523         LDKRefund this_arg_conv;
61524         this_arg_conv.inner = untag_ptr(this_arg);
61525         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61527         this_arg_conv.is_owned = false;
61528         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
61529         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Refund_payer_id(&this_arg_conv).compressed_form);
61530         return ret_arr;
61531 }
61532
61533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
61534         LDKRefund this_arg_conv;
61535         this_arg_conv.inner = untag_ptr(this_arg);
61536         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61538         this_arg_conv.is_owned = false;
61539         LDKPrintableString ret_var = Refund_payer_note(&this_arg_conv);
61540         int64_t ret_ref = 0;
61541         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61542         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61543         return ret_ref;
61544 }
61545
61546 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1write(JNIEnv *env, jclass clz, int64_t obj) {
61547         LDKRefund obj_conv;
61548         obj_conv.inner = untag_ptr(obj);
61549         obj_conv.is_owned = ptr_is_owned(obj);
61550         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61551         obj_conv.is_owned = false;
61552         LDKCVec_u8Z ret_var = Refund_write(&obj_conv);
61553         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61554         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61555         CVec_u8Z_free(ret_var);
61556         return ret_arr;
61557 }
61558
61559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1from_1str(JNIEnv *env, jclass clz, jstring s) {
61560         LDKStr s_conv = java_to_owned_str(env, s);
61561         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
61562         *ret_conv = Refund_from_str(s_conv);
61563         return tag_ptr(ret_conv, true);
61564 }
61565
61566 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61567         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
61568         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_clone(orig_conv));
61569         return ret_conv;
61570 }
61571
61572 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1unknown_1chain(JNIEnv *env, jclass clz) {
61573         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_unknown_chain());
61574         return ret_conv;
61575 }
61576
61577 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1unknown_1tx(JNIEnv *env, jclass clz) {
61578         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_unknown_tx());
61579         return ret_conv;
61580 }
61581
61582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoResult_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
61583         if (!ptr_is_owned(this_ptr)) return;
61584         void* this_ptr_ptr = untag_ptr(this_ptr);
61585         CHECK_ACCESS(this_ptr_ptr);
61586         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
61587         FREE(untag_ptr(this_ptr));
61588         UtxoResult_free(this_ptr_conv);
61589 }
61590
61591 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
61592         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
61593         *ret_copy = UtxoResult_clone(arg);
61594         int64_t ret_ref = tag_ptr(ret_copy, true);
61595         return ret_ref;
61596 }
61597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61598         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
61599         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
61600         return ret_conv;
61601 }
61602
61603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61604         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
61605         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
61606         *ret_copy = UtxoResult_clone(orig_conv);
61607         int64_t ret_ref = tag_ptr(ret_copy, true);
61608         return ret_ref;
61609 }
61610
61611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1sync(JNIEnv *env, jclass clz, int64_t a) {
61612         void* a_ptr = untag_ptr(a);
61613         CHECK_ACCESS(a_ptr);
61614         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
61615         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
61616         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
61617         *ret_copy = UtxoResult_sync(a_conv);
61618         int64_t ret_ref = tag_ptr(ret_copy, true);
61619         return ret_ref;
61620 }
61621
61622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1async(JNIEnv *env, jclass clz, int64_t a) {
61623         LDKUtxoFuture a_conv;
61624         a_conv.inner = untag_ptr(a);
61625         a_conv.is_owned = ptr_is_owned(a);
61626         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61627         a_conv = UtxoFuture_clone(&a_conv);
61628         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
61629         *ret_copy = UtxoResult_async(a_conv);
61630         int64_t ret_ref = tag_ptr(ret_copy, true);
61631         return ret_ref;
61632 }
61633
61634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoLookup_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
61635         if (!ptr_is_owned(this_ptr)) return;
61636         void* this_ptr_ptr = untag_ptr(this_ptr);
61637         CHECK_ACCESS(this_ptr_ptr);
61638         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
61639         FREE(untag_ptr(this_ptr));
61640         UtxoLookup_free(this_ptr_conv);
61641 }
61642
61643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61644         LDKUtxoFuture this_obj_conv;
61645         this_obj_conv.inner = untag_ptr(this_obj);
61646         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61648         UtxoFuture_free(this_obj_conv);
61649 }
61650
61651 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
61652         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
61653         int64_t ret_ref = 0;
61654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61656         return ret_ref;
61657 }
61658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61659         LDKUtxoFuture arg_conv;
61660         arg_conv.inner = untag_ptr(arg);
61661         arg_conv.is_owned = ptr_is_owned(arg);
61662         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61663         arg_conv.is_owned = false;
61664         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
61665         return ret_conv;
61666 }
61667
61668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61669         LDKUtxoFuture orig_conv;
61670         orig_conv.inner = untag_ptr(orig);
61671         orig_conv.is_owned = ptr_is_owned(orig);
61672         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61673         orig_conv.is_owned = false;
61674         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
61675         int64_t ret_ref = 0;
61676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61678         return ret_ref;
61679 }
61680
61681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1new(JNIEnv *env, jclass clz) {
61682         LDKUtxoFuture ret_var = UtxoFuture_new();
61683         int64_t ret_ref = 0;
61684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61686         return ret_ref;
61687 }
61688
61689 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) {
61690         LDKUtxoFuture this_arg_conv;
61691         this_arg_conv.inner = untag_ptr(this_arg);
61692         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61694         this_arg_conv.is_owned = false;
61695         LDKNetworkGraph graph_conv;
61696         graph_conv.inner = untag_ptr(graph);
61697         graph_conv.is_owned = ptr_is_owned(graph);
61698         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
61699         graph_conv.is_owned = false;
61700         void* result_ptr = untag_ptr(result);
61701         CHECK_ACCESS(result_ptr);
61702         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
61703         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
61704 }
61705
61706 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) {
61707         LDKUtxoFuture this_arg_conv;
61708         this_arg_conv.inner = untag_ptr(this_arg);
61709         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61711         this_arg_conv.is_owned = false;
61712         LDKNetworkGraph graph_conv;
61713         graph_conv.inner = untag_ptr(graph);
61714         graph_conv.is_owned = ptr_is_owned(graph);
61715         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
61716         graph_conv.is_owned = false;
61717         LDKP2PGossipSync gossip_conv;
61718         gossip_conv.inner = untag_ptr(gossip);
61719         gossip_conv.is_owned = ptr_is_owned(gossip);
61720         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
61721         gossip_conv.is_owned = false;
61722         void* result_ptr = untag_ptr(result);
61723         CHECK_ACCESS(result_ptr);
61724         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
61725         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
61726 }
61727
61728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61729         LDKNodeId this_obj_conv;
61730         this_obj_conv.inner = untag_ptr(this_obj);
61731         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61733         NodeId_free(this_obj_conv);
61734 }
61735
61736 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
61737         LDKNodeId ret_var = NodeId_clone(arg);
61738         int64_t ret_ref = 0;
61739         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61740         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61741         return ret_ref;
61742 }
61743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61744         LDKNodeId arg_conv;
61745         arg_conv.inner = untag_ptr(arg);
61746         arg_conv.is_owned = ptr_is_owned(arg);
61747         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61748         arg_conv.is_owned = false;
61749         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
61750         return ret_conv;
61751 }
61752
61753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61754         LDKNodeId orig_conv;
61755         orig_conv.inner = untag_ptr(orig);
61756         orig_conv.is_owned = ptr_is_owned(orig);
61757         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61758         orig_conv.is_owned = false;
61759         LDKNodeId ret_var = NodeId_clone(&orig_conv);
61760         int64_t ret_ref = 0;
61761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61763         return ret_ref;
61764 }
61765
61766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) {
61767         LDKPublicKey pubkey_ref;
61768         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
61769         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
61770         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
61771         int64_t ret_ref = 0;
61772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61774         return ret_ref;
61775 }
61776
61777 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) {
61778         LDKNodeId this_arg_conv;
61779         this_arg_conv.inner = untag_ptr(this_arg);
61780         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61782         this_arg_conv.is_owned = false;
61783         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
61784         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61785         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61786         return ret_arr;
61787 }
61788
61789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
61790         LDKNodeId this_arg_conv;
61791         this_arg_conv.inner = untag_ptr(this_arg);
61792         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61794         this_arg_conv.is_owned = false;
61795         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
61796         *ret_conv = NodeId_as_pubkey(&this_arg_conv);
61797         return tag_ptr(ret_conv, true);
61798 }
61799
61800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) {
61801         LDKNodeId o_conv;
61802         o_conv.inner = untag_ptr(o);
61803         o_conv.is_owned = ptr_is_owned(o);
61804         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61805         o_conv.is_owned = false;
61806         int64_t ret_conv = NodeId_hash(&o_conv);
61807         return ret_conv;
61808 }
61809
61810 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) {
61811         LDKNodeId obj_conv;
61812         obj_conv.inner = untag_ptr(obj);
61813         obj_conv.is_owned = ptr_is_owned(obj);
61814         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61815         obj_conv.is_owned = false;
61816         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
61817         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61818         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61819         CVec_u8Z_free(ret_var);
61820         return ret_arr;
61821 }
61822
61823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61824         LDKu8slice ser_ref;
61825         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61826         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61827         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
61828         *ret_conv = NodeId_read(ser_ref);
61829         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61830         return tag_ptr(ret_conv, true);
61831 }
61832
61833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61834         LDKNetworkGraph this_obj_conv;
61835         this_obj_conv.inner = untag_ptr(this_obj);
61836         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61838         NetworkGraph_free(this_obj_conv);
61839 }
61840
61841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61842         LDKReadOnlyNetworkGraph this_obj_conv;
61843         this_obj_conv.inner = untag_ptr(this_obj);
61844         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61846         ReadOnlyNetworkGraph_free(this_obj_conv);
61847 }
61848
61849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
61850         if (!ptr_is_owned(this_ptr)) return;
61851         void* this_ptr_ptr = untag_ptr(this_ptr);
61852         CHECK_ACCESS(this_ptr_ptr);
61853         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
61854         FREE(untag_ptr(this_ptr));
61855         NetworkUpdate_free(this_ptr_conv);
61856 }
61857
61858 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
61859         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
61860         *ret_copy = NetworkUpdate_clone(arg);
61861         int64_t ret_ref = tag_ptr(ret_copy, true);
61862         return ret_ref;
61863 }
61864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61865         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
61866         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
61867         return ret_conv;
61868 }
61869
61870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61871         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
61872         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
61873         *ret_copy = NetworkUpdate_clone(orig_conv);
61874         int64_t ret_ref = tag_ptr(ret_copy, true);
61875         return ret_ref;
61876 }
61877
61878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
61879         LDKChannelUpdate msg_conv;
61880         msg_conv.inner = untag_ptr(msg);
61881         msg_conv.is_owned = ptr_is_owned(msg);
61882         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
61883         msg_conv = ChannelUpdate_clone(&msg_conv);
61884         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
61885         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
61886         int64_t ret_ref = tag_ptr(ret_copy, true);
61887         return ret_ref;
61888 }
61889
61890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1failure(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
61891         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
61892         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
61893         int64_t ret_ref = tag_ptr(ret_copy, true);
61894         return ret_ref;
61895 }
61896
61897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
61898         LDKPublicKey node_id_ref;
61899         CHECK((*env)->GetArrayLength(env, node_id) == 33);
61900         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
61901         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
61902         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
61903         int64_t ret_ref = tag_ptr(ret_copy, true);
61904         return ret_ref;
61905 }
61906
61907 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
61908         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
61909         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
61910         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
61911         return ret_conv;
61912 }
61913
61914 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
61915         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
61916         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
61917         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61918         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61919         CVec_u8Z_free(ret_var);
61920         return ret_arr;
61921 }
61922
61923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61924         LDKu8slice ser_ref;
61925         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61926         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61927         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
61928         *ret_conv = NetworkUpdate_read(ser_ref);
61929         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61930         return tag_ptr(ret_conv, true);
61931 }
61932
61933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61934         LDKP2PGossipSync this_obj_conv;
61935         this_obj_conv.inner = untag_ptr(this_obj);
61936         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61938         P2PGossipSync_free(this_obj_conv);
61939 }
61940
61941 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) {
61942         LDKNetworkGraph network_graph_conv;
61943         network_graph_conv.inner = untag_ptr(network_graph);
61944         network_graph_conv.is_owned = ptr_is_owned(network_graph);
61945         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
61946         network_graph_conv.is_owned = false;
61947         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
61948         CHECK_ACCESS(utxo_lookup_ptr);
61949         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
61950         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
61951         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
61952                 // Manually implement clone for Java trait instances
61953                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
61954                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61955                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
61956                 }
61957         }
61958         void* logger_ptr = untag_ptr(logger);
61959         CHECK_ACCESS(logger_ptr);
61960         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
61961         if (logger_conv.free == LDKLogger_JCalls_free) {
61962                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61963                 LDKLogger_JCalls_cloned(&logger_conv);
61964         }
61965         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
61966         int64_t ret_ref = 0;
61967         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61968         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61969         return ret_ref;
61970 }
61971
61972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1add_1utxo_1lookup(JNIEnv *env, jclass clz, int64_t this_arg, int64_t utxo_lookup) {
61973         LDKP2PGossipSync this_arg_conv;
61974         this_arg_conv.inner = untag_ptr(this_arg);
61975         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61977         this_arg_conv.is_owned = false;
61978         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
61979         CHECK_ACCESS(utxo_lookup_ptr);
61980         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
61981         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
61982         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
61983                 // Manually implement clone for Java trait instances
61984                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
61985                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61986                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
61987                 }
61988         }
61989         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
61990 }
61991
61992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1handle_1network_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_update) {
61993         LDKNetworkGraph this_arg_conv;
61994         this_arg_conv.inner = untag_ptr(this_arg);
61995         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61997         this_arg_conv.is_owned = false;
61998         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
61999         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
62000 }
62001
62002 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
62003         LDKNetworkGraph this_arg_conv;
62004         this_arg_conv.inner = untag_ptr(this_arg);
62005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62007         this_arg_conv.is_owned = false;
62008         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
62009         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, NetworkGraph_get_chain_hash(&this_arg_conv).data);
62010         return ret_arr;
62011 }
62012
62013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_verify_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
62014         LDKNodeAnnouncement msg_conv;
62015         msg_conv.inner = untag_ptr(msg);
62016         msg_conv.is_owned = ptr_is_owned(msg);
62017         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
62018         msg_conv.is_owned = false;
62019         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
62020         *ret_conv = verify_node_announcement(&msg_conv);
62021         return tag_ptr(ret_conv, true);
62022 }
62023
62024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_verify_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
62025         LDKChannelAnnouncement msg_conv;
62026         msg_conv.inner = untag_ptr(msg);
62027         msg_conv.is_owned = ptr_is_owned(msg);
62028         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
62029         msg_conv.is_owned = false;
62030         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
62031         *ret_conv = verify_channel_announcement(&msg_conv);
62032         return tag_ptr(ret_conv, true);
62033 }
62034
62035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
62036         LDKP2PGossipSync this_arg_conv;
62037         this_arg_conv.inner = untag_ptr(this_arg);
62038         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62040         this_arg_conv.is_owned = false;
62041         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
62042         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
62043         return tag_ptr(ret_ret, true);
62044 }
62045
62046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
62047         LDKP2PGossipSync this_arg_conv;
62048         this_arg_conv.inner = untag_ptr(this_arg);
62049         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62051         this_arg_conv.is_owned = false;
62052         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
62053         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
62054         return tag_ptr(ret_ret, true);
62055 }
62056
62057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62058         LDKChannelUpdateInfo this_obj_conv;
62059         this_obj_conv.inner = untag_ptr(this_obj);
62060         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62062         ChannelUpdateInfo_free(this_obj_conv);
62063 }
62064
62065 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
62066         LDKChannelUpdateInfo this_ptr_conv;
62067         this_ptr_conv.inner = untag_ptr(this_ptr);
62068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62070         this_ptr_conv.is_owned = false;
62071         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
62072         return ret_conv;
62073 }
62074
62075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
62076         LDKChannelUpdateInfo this_ptr_conv;
62077         this_ptr_conv.inner = untag_ptr(this_ptr);
62078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62080         this_ptr_conv.is_owned = false;
62081         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
62082 }
62083
62084 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
62085         LDKChannelUpdateInfo this_ptr_conv;
62086         this_ptr_conv.inner = untag_ptr(this_ptr);
62087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62089         this_ptr_conv.is_owned = false;
62090         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
62091         return ret_conv;
62092 }
62093
62094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
62095         LDKChannelUpdateInfo this_ptr_conv;
62096         this_ptr_conv.inner = untag_ptr(this_ptr);
62097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62099         this_ptr_conv.is_owned = false;
62100         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
62101 }
62102
62103 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
62104         LDKChannelUpdateInfo this_ptr_conv;
62105         this_ptr_conv.inner = untag_ptr(this_ptr);
62106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62108         this_ptr_conv.is_owned = false;
62109         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
62110         return ret_conv;
62111 }
62112
62113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
62114         LDKChannelUpdateInfo this_ptr_conv;
62115         this_ptr_conv.inner = untag_ptr(this_ptr);
62116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62118         this_ptr_conv.is_owned = false;
62119         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
62120 }
62121
62122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
62123         LDKChannelUpdateInfo this_ptr_conv;
62124         this_ptr_conv.inner = untag_ptr(this_ptr);
62125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62127         this_ptr_conv.is_owned = false;
62128         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
62129         return ret_conv;
62130 }
62131
62132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62133         LDKChannelUpdateInfo this_ptr_conv;
62134         this_ptr_conv.inner = untag_ptr(this_ptr);
62135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62137         this_ptr_conv.is_owned = false;
62138         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
62139 }
62140
62141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
62142         LDKChannelUpdateInfo this_ptr_conv;
62143         this_ptr_conv.inner = untag_ptr(this_ptr);
62144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62146         this_ptr_conv.is_owned = false;
62147         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
62148         return ret_conv;
62149 }
62150
62151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62152         LDKChannelUpdateInfo this_ptr_conv;
62153         this_ptr_conv.inner = untag_ptr(this_ptr);
62154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62156         this_ptr_conv.is_owned = false;
62157         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
62158 }
62159
62160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
62161         LDKChannelUpdateInfo this_ptr_conv;
62162         this_ptr_conv.inner = untag_ptr(this_ptr);
62163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62165         this_ptr_conv.is_owned = false;
62166         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
62167         int64_t ret_ref = 0;
62168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62170         return ret_ref;
62171 }
62172
62173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62174         LDKChannelUpdateInfo this_ptr_conv;
62175         this_ptr_conv.inner = untag_ptr(this_ptr);
62176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62178         this_ptr_conv.is_owned = false;
62179         LDKRoutingFees val_conv;
62180         val_conv.inner = untag_ptr(val);
62181         val_conv.is_owned = ptr_is_owned(val);
62182         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62183         val_conv = RoutingFees_clone(&val_conv);
62184         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
62185 }
62186
62187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
62188         LDKChannelUpdateInfo this_ptr_conv;
62189         this_ptr_conv.inner = untag_ptr(this_ptr);
62190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62192         this_ptr_conv.is_owned = false;
62193         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
62194         int64_t ret_ref = 0;
62195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62197         return ret_ref;
62198 }
62199
62200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62201         LDKChannelUpdateInfo this_ptr_conv;
62202         this_ptr_conv.inner = untag_ptr(this_ptr);
62203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62205         this_ptr_conv.is_owned = false;
62206         LDKChannelUpdate val_conv;
62207         val_conv.inner = untag_ptr(val);
62208         val_conv.is_owned = ptr_is_owned(val);
62209         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62210         val_conv = ChannelUpdate_clone(&val_conv);
62211         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
62212 }
62213
62214 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) {
62215         LDKRoutingFees fees_arg_conv;
62216         fees_arg_conv.inner = untag_ptr(fees_arg);
62217         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
62218         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
62219         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
62220         LDKChannelUpdate last_update_message_arg_conv;
62221         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
62222         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
62223         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
62224         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
62225         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);
62226         int64_t ret_ref = 0;
62227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62229         return ret_ref;
62230 }
62231
62232 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
62233         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
62234         int64_t ret_ref = 0;
62235         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62236         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62237         return ret_ref;
62238 }
62239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62240         LDKChannelUpdateInfo arg_conv;
62241         arg_conv.inner = untag_ptr(arg);
62242         arg_conv.is_owned = ptr_is_owned(arg);
62243         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62244         arg_conv.is_owned = false;
62245         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
62246         return ret_conv;
62247 }
62248
62249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62250         LDKChannelUpdateInfo orig_conv;
62251         orig_conv.inner = untag_ptr(orig);
62252         orig_conv.is_owned = ptr_is_owned(orig);
62253         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62254         orig_conv.is_owned = false;
62255         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
62256         int64_t ret_ref = 0;
62257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62259         return ret_ref;
62260 }
62261
62262 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
62263         LDKChannelUpdateInfo a_conv;
62264         a_conv.inner = untag_ptr(a);
62265         a_conv.is_owned = ptr_is_owned(a);
62266         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62267         a_conv.is_owned = false;
62268         LDKChannelUpdateInfo b_conv;
62269         b_conv.inner = untag_ptr(b);
62270         b_conv.is_owned = ptr_is_owned(b);
62271         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62272         b_conv.is_owned = false;
62273         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
62274         return ret_conv;
62275 }
62276
62277 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
62278         LDKChannelUpdateInfo obj_conv;
62279         obj_conv.inner = untag_ptr(obj);
62280         obj_conv.is_owned = ptr_is_owned(obj);
62281         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62282         obj_conv.is_owned = false;
62283         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
62284         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62285         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62286         CVec_u8Z_free(ret_var);
62287         return ret_arr;
62288 }
62289
62290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62291         LDKu8slice ser_ref;
62292         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62293         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62294         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
62295         *ret_conv = ChannelUpdateInfo_read(ser_ref);
62296         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62297         return tag_ptr(ret_conv, true);
62298 }
62299
62300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62301         LDKChannelInfo this_obj_conv;
62302         this_obj_conv.inner = untag_ptr(this_obj);
62303         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62305         ChannelInfo_free(this_obj_conv);
62306 }
62307
62308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
62309         LDKChannelInfo this_ptr_conv;
62310         this_ptr_conv.inner = untag_ptr(this_ptr);
62311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62313         this_ptr_conv.is_owned = false;
62314         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
62315         int64_t ret_ref = 0;
62316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62318         return ret_ref;
62319 }
62320
62321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62322         LDKChannelInfo this_ptr_conv;
62323         this_ptr_conv.inner = untag_ptr(this_ptr);
62324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62326         this_ptr_conv.is_owned = false;
62327         LDKChannelFeatures val_conv;
62328         val_conv.inner = untag_ptr(val);
62329         val_conv.is_owned = ptr_is_owned(val);
62330         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62331         val_conv = ChannelFeatures_clone(&val_conv);
62332         ChannelInfo_set_features(&this_ptr_conv, val_conv);
62333 }
62334
62335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
62336         LDKChannelInfo this_ptr_conv;
62337         this_ptr_conv.inner = untag_ptr(this_ptr);
62338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62340         this_ptr_conv.is_owned = false;
62341         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
62342         int64_t ret_ref = 0;
62343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62345         return ret_ref;
62346 }
62347
62348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62349         LDKChannelInfo this_ptr_conv;
62350         this_ptr_conv.inner = untag_ptr(this_ptr);
62351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62353         this_ptr_conv.is_owned = false;
62354         LDKNodeId val_conv;
62355         val_conv.inner = untag_ptr(val);
62356         val_conv.is_owned = ptr_is_owned(val);
62357         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62358         val_conv = NodeId_clone(&val_conv);
62359         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
62360 }
62361
62362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
62363         LDKChannelInfo this_ptr_conv;
62364         this_ptr_conv.inner = untag_ptr(this_ptr);
62365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62367         this_ptr_conv.is_owned = false;
62368         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
62369         int64_t ret_ref = 0;
62370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62372         return ret_ref;
62373 }
62374
62375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62376         LDKChannelInfo this_ptr_conv;
62377         this_ptr_conv.inner = untag_ptr(this_ptr);
62378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62380         this_ptr_conv.is_owned = false;
62381         LDKChannelUpdateInfo val_conv;
62382         val_conv.inner = untag_ptr(val);
62383         val_conv.is_owned = ptr_is_owned(val);
62384         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62385         val_conv = ChannelUpdateInfo_clone(&val_conv);
62386         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
62387 }
62388
62389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
62390         LDKChannelInfo this_ptr_conv;
62391         this_ptr_conv.inner = untag_ptr(this_ptr);
62392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62394         this_ptr_conv.is_owned = false;
62395         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
62396         int64_t ret_ref = 0;
62397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62399         return ret_ref;
62400 }
62401
62402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62403         LDKChannelInfo this_ptr_conv;
62404         this_ptr_conv.inner = untag_ptr(this_ptr);
62405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62407         this_ptr_conv.is_owned = false;
62408         LDKNodeId val_conv;
62409         val_conv.inner = untag_ptr(val);
62410         val_conv.is_owned = ptr_is_owned(val);
62411         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62412         val_conv = NodeId_clone(&val_conv);
62413         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
62414 }
62415
62416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
62417         LDKChannelInfo this_ptr_conv;
62418         this_ptr_conv.inner = untag_ptr(this_ptr);
62419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62421         this_ptr_conv.is_owned = false;
62422         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
62423         int64_t ret_ref = 0;
62424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62426         return ret_ref;
62427 }
62428
62429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62430         LDKChannelInfo this_ptr_conv;
62431         this_ptr_conv.inner = untag_ptr(this_ptr);
62432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62434         this_ptr_conv.is_owned = false;
62435         LDKChannelUpdateInfo val_conv;
62436         val_conv.inner = untag_ptr(val);
62437         val_conv.is_owned = ptr_is_owned(val);
62438         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62439         val_conv = ChannelUpdateInfo_clone(&val_conv);
62440         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
62441 }
62442
62443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
62444         LDKChannelInfo this_ptr_conv;
62445         this_ptr_conv.inner = untag_ptr(this_ptr);
62446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62448         this_ptr_conv.is_owned = false;
62449         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
62450         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
62451         int64_t ret_ref = tag_ptr(ret_copy, true);
62452         return ret_ref;
62453 }
62454
62455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62456         LDKChannelInfo this_ptr_conv;
62457         this_ptr_conv.inner = untag_ptr(this_ptr);
62458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62460         this_ptr_conv.is_owned = false;
62461         void* val_ptr = untag_ptr(val);
62462         CHECK_ACCESS(val_ptr);
62463         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
62464         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
62465         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
62466 }
62467
62468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
62469         LDKChannelInfo this_ptr_conv;
62470         this_ptr_conv.inner = untag_ptr(this_ptr);
62471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62473         this_ptr_conv.is_owned = false;
62474         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
62475         int64_t ret_ref = 0;
62476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62478         return ret_ref;
62479 }
62480
62481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62482         LDKChannelInfo this_ptr_conv;
62483         this_ptr_conv.inner = untag_ptr(this_ptr);
62484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62486         this_ptr_conv.is_owned = false;
62487         LDKChannelAnnouncement val_conv;
62488         val_conv.inner = untag_ptr(val);
62489         val_conv.is_owned = ptr_is_owned(val);
62490         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62491         val_conv = ChannelAnnouncement_clone(&val_conv);
62492         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
62493 }
62494
62495 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
62496         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
62497         int64_t ret_ref = 0;
62498         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62499         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62500         return ret_ref;
62501 }
62502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62503         LDKChannelInfo arg_conv;
62504         arg_conv.inner = untag_ptr(arg);
62505         arg_conv.is_owned = ptr_is_owned(arg);
62506         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62507         arg_conv.is_owned = false;
62508         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
62509         return ret_conv;
62510 }
62511
62512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62513         LDKChannelInfo orig_conv;
62514         orig_conv.inner = untag_ptr(orig);
62515         orig_conv.is_owned = ptr_is_owned(orig);
62516         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62517         orig_conv.is_owned = false;
62518         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
62519         int64_t ret_ref = 0;
62520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62522         return ret_ref;
62523 }
62524
62525 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
62526         LDKChannelInfo a_conv;
62527         a_conv.inner = untag_ptr(a);
62528         a_conv.is_owned = ptr_is_owned(a);
62529         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62530         a_conv.is_owned = false;
62531         LDKChannelInfo b_conv;
62532         b_conv.inner = untag_ptr(b);
62533         b_conv.is_owned = ptr_is_owned(b);
62534         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62535         b_conv.is_owned = false;
62536         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
62537         return ret_conv;
62538 }
62539
62540 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) {
62541         LDKChannelInfo this_arg_conv;
62542         this_arg_conv.inner = untag_ptr(this_arg);
62543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62545         this_arg_conv.is_owned = false;
62546         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
62547         int64_t ret_ref = 0;
62548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62550         return ret_ref;
62551 }
62552
62553 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
62554         LDKChannelInfo obj_conv;
62555         obj_conv.inner = untag_ptr(obj);
62556         obj_conv.is_owned = ptr_is_owned(obj);
62557         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62558         obj_conv.is_owned = false;
62559         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
62560         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62561         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62562         CVec_u8Z_free(ret_var);
62563         return ret_arr;
62564 }
62565
62566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62567         LDKu8slice ser_ref;
62568         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62569         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62570         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
62571         *ret_conv = ChannelInfo_read(ser_ref);
62572         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62573         return tag_ptr(ret_conv, true);
62574 }
62575
62576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62577         LDKDirectedChannelInfo this_obj_conv;
62578         this_obj_conv.inner = untag_ptr(this_obj);
62579         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62581         DirectedChannelInfo_free(this_obj_conv);
62582 }
62583
62584 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
62585         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
62586         int64_t ret_ref = 0;
62587         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62588         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62589         return ret_ref;
62590 }
62591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62592         LDKDirectedChannelInfo arg_conv;
62593         arg_conv.inner = untag_ptr(arg);
62594         arg_conv.is_owned = ptr_is_owned(arg);
62595         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62596         arg_conv.is_owned = false;
62597         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
62598         return ret_conv;
62599 }
62600
62601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62602         LDKDirectedChannelInfo orig_conv;
62603         orig_conv.inner = untag_ptr(orig);
62604         orig_conv.is_owned = ptr_is_owned(orig);
62605         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62606         orig_conv.is_owned = false;
62607         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
62608         int64_t ret_ref = 0;
62609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62611         return ret_ref;
62612 }
62613
62614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1channel(JNIEnv *env, jclass clz, int64_t this_arg) {
62615         LDKDirectedChannelInfo this_arg_conv;
62616         this_arg_conv.inner = untag_ptr(this_arg);
62617         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62619         this_arg_conv.is_owned = false;
62620         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
62621         int64_t ret_ref = 0;
62622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62624         return ret_ref;
62625 }
62626
62627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
62628         LDKDirectedChannelInfo this_arg_conv;
62629         this_arg_conv.inner = untag_ptr(this_arg);
62630         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62632         this_arg_conv.is_owned = false;
62633         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
62634         return ret_conv;
62635 }
62636
62637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_arg) {
62638         LDKDirectedChannelInfo this_arg_conv;
62639         this_arg_conv.inner = untag_ptr(this_arg);
62640         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62642         this_arg_conv.is_owned = false;
62643         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62644         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
62645         int64_t ret_ref = tag_ptr(ret_copy, true);
62646         return ret_ref;
62647 }
62648
62649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
62650         if (!ptr_is_owned(this_ptr)) return;
62651         void* this_ptr_ptr = untag_ptr(this_ptr);
62652         CHECK_ACCESS(this_ptr_ptr);
62653         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
62654         FREE(untag_ptr(this_ptr));
62655         EffectiveCapacity_free(this_ptr_conv);
62656 }
62657
62658 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
62659         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62660         *ret_copy = EffectiveCapacity_clone(arg);
62661         int64_t ret_ref = tag_ptr(ret_copy, true);
62662         return ret_ref;
62663 }
62664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62665         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
62666         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
62667         return ret_conv;
62668 }
62669
62670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62671         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
62672         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62673         *ret_copy = EffectiveCapacity_clone(orig_conv);
62674         int64_t ret_ref = tag_ptr(ret_copy, true);
62675         return ret_ref;
62676 }
62677
62678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1exact_1liquidity(JNIEnv *env, jclass clz, int64_t liquidity_msat) {
62679         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62680         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
62681         int64_t ret_ref = tag_ptr(ret_copy, true);
62682         return ret_ref;
62683 }
62684
62685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1advertised_1max_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
62686         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62687         *ret_copy = EffectiveCapacity_advertised_max_htlc(amount_msat);
62688         int64_t ret_ref = tag_ptr(ret_copy, true);
62689         return ret_ref;
62690 }
62691
62692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1total(JNIEnv *env, jclass clz, int64_t capacity_msat, int64_t htlc_maximum_msat) {
62693         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62694         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
62695         int64_t ret_ref = tag_ptr(ret_copy, true);
62696         return ret_ref;
62697 }
62698
62699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1infinite(JNIEnv *env, jclass clz) {
62700         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62701         *ret_copy = EffectiveCapacity_infinite();
62702         int64_t ret_ref = tag_ptr(ret_copy, true);
62703         return ret_ref;
62704 }
62705
62706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1hint_1max_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
62707         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62708         *ret_copy = EffectiveCapacity_hint_max_htlc(amount_msat);
62709         int64_t ret_ref = tag_ptr(ret_copy, true);
62710         return ret_ref;
62711 }
62712
62713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1unknown(JNIEnv *env, jclass clz) {
62714         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62715         *ret_copy = EffectiveCapacity_unknown();
62716         int64_t ret_ref = tag_ptr(ret_copy, true);
62717         return ret_ref;
62718 }
62719
62720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1as_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
62721         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
62722         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
62723         return ret_conv;
62724 }
62725
62726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62727         LDKRoutingFees this_obj_conv;
62728         this_obj_conv.inner = untag_ptr(this_obj);
62729         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62731         RoutingFees_free(this_obj_conv);
62732 }
62733
62734 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
62735         LDKRoutingFees this_ptr_conv;
62736         this_ptr_conv.inner = untag_ptr(this_ptr);
62737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62739         this_ptr_conv.is_owned = false;
62740         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
62741         return ret_conv;
62742 }
62743
62744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
62745         LDKRoutingFees this_ptr_conv;
62746         this_ptr_conv.inner = untag_ptr(this_ptr);
62747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62749         this_ptr_conv.is_owned = false;
62750         RoutingFees_set_base_msat(&this_ptr_conv, val);
62751 }
62752
62753 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
62754         LDKRoutingFees this_ptr_conv;
62755         this_ptr_conv.inner = untag_ptr(this_ptr);
62756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62758         this_ptr_conv.is_owned = false;
62759         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
62760         return ret_conv;
62761 }
62762
62763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
62764         LDKRoutingFees this_ptr_conv;
62765         this_ptr_conv.inner = untag_ptr(this_ptr);
62766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62768         this_ptr_conv.is_owned = false;
62769         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
62770 }
62771
62772 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) {
62773         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
62774         int64_t ret_ref = 0;
62775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62777         return ret_ref;
62778 }
62779
62780 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
62781         LDKRoutingFees a_conv;
62782         a_conv.inner = untag_ptr(a);
62783         a_conv.is_owned = ptr_is_owned(a);
62784         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62785         a_conv.is_owned = false;
62786         LDKRoutingFees b_conv;
62787         b_conv.inner = untag_ptr(b);
62788         b_conv.is_owned = ptr_is_owned(b);
62789         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62790         b_conv.is_owned = false;
62791         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
62792         return ret_conv;
62793 }
62794
62795 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
62796         LDKRoutingFees ret_var = RoutingFees_clone(arg);
62797         int64_t ret_ref = 0;
62798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62800         return ret_ref;
62801 }
62802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62803         LDKRoutingFees arg_conv;
62804         arg_conv.inner = untag_ptr(arg);
62805         arg_conv.is_owned = ptr_is_owned(arg);
62806         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62807         arg_conv.is_owned = false;
62808         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
62809         return ret_conv;
62810 }
62811
62812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62813         LDKRoutingFees orig_conv;
62814         orig_conv.inner = untag_ptr(orig);
62815         orig_conv.is_owned = ptr_is_owned(orig);
62816         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62817         orig_conv.is_owned = false;
62818         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
62819         int64_t ret_ref = 0;
62820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62822         return ret_ref;
62823 }
62824
62825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
62826         LDKRoutingFees o_conv;
62827         o_conv.inner = untag_ptr(o);
62828         o_conv.is_owned = ptr_is_owned(o);
62829         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
62830         o_conv.is_owned = false;
62831         int64_t ret_conv = RoutingFees_hash(&o_conv);
62832         return ret_conv;
62833 }
62834
62835 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
62836         LDKRoutingFees obj_conv;
62837         obj_conv.inner = untag_ptr(obj);
62838         obj_conv.is_owned = ptr_is_owned(obj);
62839         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62840         obj_conv.is_owned = false;
62841         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
62842         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62843         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62844         CVec_u8Z_free(ret_var);
62845         return ret_arr;
62846 }
62847
62848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62849         LDKu8slice ser_ref;
62850         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62851         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62852         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
62853         *ret_conv = RoutingFees_read(ser_ref);
62854         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62855         return tag_ptr(ret_conv, true);
62856 }
62857
62858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62859         LDKNodeAnnouncementInfo this_obj_conv;
62860         this_obj_conv.inner = untag_ptr(this_obj);
62861         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62863         NodeAnnouncementInfo_free(this_obj_conv);
62864 }
62865
62866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
62867         LDKNodeAnnouncementInfo this_ptr_conv;
62868         this_ptr_conv.inner = untag_ptr(this_ptr);
62869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62871         this_ptr_conv.is_owned = false;
62872         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
62873         int64_t ret_ref = 0;
62874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62876         return ret_ref;
62877 }
62878
62879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62880         LDKNodeAnnouncementInfo this_ptr_conv;
62881         this_ptr_conv.inner = untag_ptr(this_ptr);
62882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62884         this_ptr_conv.is_owned = false;
62885         LDKNodeFeatures val_conv;
62886         val_conv.inner = untag_ptr(val);
62887         val_conv.is_owned = ptr_is_owned(val);
62888         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62889         val_conv = NodeFeatures_clone(&val_conv);
62890         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
62891 }
62892
62893 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
62894         LDKNodeAnnouncementInfo this_ptr_conv;
62895         this_ptr_conv.inner = untag_ptr(this_ptr);
62896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62898         this_ptr_conv.is_owned = false;
62899         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
62900         return ret_conv;
62901 }
62902
62903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
62904         LDKNodeAnnouncementInfo this_ptr_conv;
62905         this_ptr_conv.inner = untag_ptr(this_ptr);
62906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62908         this_ptr_conv.is_owned = false;
62909         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
62910 }
62911
62912 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
62913         LDKNodeAnnouncementInfo this_ptr_conv;
62914         this_ptr_conv.inner = untag_ptr(this_ptr);
62915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62917         this_ptr_conv.is_owned = false;
62918         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
62919         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
62920         return ret_arr;
62921 }
62922
62923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
62924         LDKNodeAnnouncementInfo this_ptr_conv;
62925         this_ptr_conv.inner = untag_ptr(this_ptr);
62926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62928         this_ptr_conv.is_owned = false;
62929         LDKThreeBytes val_ref;
62930         CHECK((*env)->GetArrayLength(env, val) == 3);
62931         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
62932         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
62933 }
62934
62935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
62936         LDKNodeAnnouncementInfo this_ptr_conv;
62937         this_ptr_conv.inner = untag_ptr(this_ptr);
62938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62940         this_ptr_conv.is_owned = false;
62941         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
62942         int64_t ret_ref = 0;
62943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62945         return ret_ref;
62946 }
62947
62948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62949         LDKNodeAnnouncementInfo this_ptr_conv;
62950         this_ptr_conv.inner = untag_ptr(this_ptr);
62951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62953         this_ptr_conv.is_owned = false;
62954         LDKNodeAlias val_conv;
62955         val_conv.inner = untag_ptr(val);
62956         val_conv.is_owned = ptr_is_owned(val);
62957         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62958         val_conv = NodeAlias_clone(&val_conv);
62959         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
62960 }
62961
62962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
62963         LDKNodeAnnouncementInfo this_ptr_conv;
62964         this_ptr_conv.inner = untag_ptr(this_ptr);
62965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62967         this_ptr_conv.is_owned = false;
62968         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
62969         int64_t ret_ref = 0;
62970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62972         return ret_ref;
62973 }
62974
62975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62976         LDKNodeAnnouncementInfo this_ptr_conv;
62977         this_ptr_conv.inner = untag_ptr(this_ptr);
62978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62980         this_ptr_conv.is_owned = false;
62981         LDKNodeAnnouncement val_conv;
62982         val_conv.inner = untag_ptr(val);
62983         val_conv.is_owned = ptr_is_owned(val);
62984         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62985         val_conv = NodeAnnouncement_clone(&val_conv);
62986         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
62987 }
62988
62989 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) {
62990         LDKNodeFeatures features_arg_conv;
62991         features_arg_conv.inner = untag_ptr(features_arg);
62992         features_arg_conv.is_owned = ptr_is_owned(features_arg);
62993         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
62994         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
62995         LDKThreeBytes rgb_arg_ref;
62996         CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
62997         (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
62998         LDKNodeAlias alias_arg_conv;
62999         alias_arg_conv.inner = untag_ptr(alias_arg);
63000         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
63001         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
63002         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
63003         LDKNodeAnnouncement announcement_message_arg_conv;
63004         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
63005         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
63006         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
63007         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
63008         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, announcement_message_arg_conv);
63009         int64_t ret_ref = 0;
63010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63012         return ret_ref;
63013 }
63014
63015 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
63016         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
63017         int64_t ret_ref = 0;
63018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63020         return ret_ref;
63021 }
63022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63023         LDKNodeAnnouncementInfo arg_conv;
63024         arg_conv.inner = untag_ptr(arg);
63025         arg_conv.is_owned = ptr_is_owned(arg);
63026         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63027         arg_conv.is_owned = false;
63028         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
63029         return ret_conv;
63030 }
63031
63032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63033         LDKNodeAnnouncementInfo orig_conv;
63034         orig_conv.inner = untag_ptr(orig);
63035         orig_conv.is_owned = ptr_is_owned(orig);
63036         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63037         orig_conv.is_owned = false;
63038         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
63039         int64_t ret_ref = 0;
63040         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63041         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63042         return ret_ref;
63043 }
63044
63045 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
63046         LDKNodeAnnouncementInfo a_conv;
63047         a_conv.inner = untag_ptr(a);
63048         a_conv.is_owned = ptr_is_owned(a);
63049         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63050         a_conv.is_owned = false;
63051         LDKNodeAnnouncementInfo b_conv;
63052         b_conv.inner = untag_ptr(b);
63053         b_conv.is_owned = ptr_is_owned(b);
63054         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63055         b_conv.is_owned = false;
63056         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
63057         return ret_conv;
63058 }
63059
63060 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1addresses(JNIEnv *env, jclass clz, int64_t this_arg) {
63061         LDKNodeAnnouncementInfo this_arg_conv;
63062         this_arg_conv.inner = untag_ptr(this_arg);
63063         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63065         this_arg_conv.is_owned = false;
63066         LDKCVec_SocketAddressZ ret_var = NodeAnnouncementInfo_addresses(&this_arg_conv);
63067         int64_tArray ret_arr = NULL;
63068         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
63069         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
63070         for (size_t p = 0; p < ret_var.datalen; p++) {
63071                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
63072                 *ret_conv_15_copy = ret_var.data[p];
63073                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
63074                 ret_arr_ptr[p] = ret_conv_15_ref;
63075         }
63076         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
63077         FREE(ret_var.data);
63078         return ret_arr;
63079 }
63080
63081 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
63082         LDKNodeAnnouncementInfo obj_conv;
63083         obj_conv.inner = untag_ptr(obj);
63084         obj_conv.is_owned = ptr_is_owned(obj);
63085         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63086         obj_conv.is_owned = false;
63087         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
63088         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63089         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63090         CVec_u8Z_free(ret_var);
63091         return ret_arr;
63092 }
63093
63094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
63095         LDKu8slice ser_ref;
63096         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63097         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63098         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
63099         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
63100         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63101         return tag_ptr(ret_conv, true);
63102 }
63103
63104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63105         LDKNodeAlias this_obj_conv;
63106         this_obj_conv.inner = untag_ptr(this_obj);
63107         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63109         NodeAlias_free(this_obj_conv);
63110 }
63111
63112 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
63113         LDKNodeAlias this_ptr_conv;
63114         this_ptr_conv.inner = untag_ptr(this_ptr);
63115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63117         this_ptr_conv.is_owned = false;
63118         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
63119         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAlias_get_a(&this_ptr_conv));
63120         return ret_arr;
63121 }
63122
63123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
63124         LDKNodeAlias this_ptr_conv;
63125         this_ptr_conv.inner = untag_ptr(this_ptr);
63126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63128         this_ptr_conv.is_owned = false;
63129         LDKThirtyTwoBytes val_ref;
63130         CHECK((*env)->GetArrayLength(env, val) == 32);
63131         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
63132         NodeAlias_set_a(&this_ptr_conv, val_ref);
63133 }
63134
63135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
63136         LDKThirtyTwoBytes a_arg_ref;
63137         CHECK((*env)->GetArrayLength(env, a_arg) == 32);
63138         (*env)->GetByteArrayRegion(env, a_arg, 0, 32, a_arg_ref.data);
63139         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
63140         int64_t ret_ref = 0;
63141         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63142         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63143         return ret_ref;
63144 }
63145
63146 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
63147         LDKNodeAlias ret_var = NodeAlias_clone(arg);
63148         int64_t ret_ref = 0;
63149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63151         return ret_ref;
63152 }
63153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63154         LDKNodeAlias arg_conv;
63155         arg_conv.inner = untag_ptr(arg);
63156         arg_conv.is_owned = ptr_is_owned(arg);
63157         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63158         arg_conv.is_owned = false;
63159         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
63160         return ret_conv;
63161 }
63162
63163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63164         LDKNodeAlias orig_conv;
63165         orig_conv.inner = untag_ptr(orig);
63166         orig_conv.is_owned = ptr_is_owned(orig);
63167         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63168         orig_conv.is_owned = false;
63169         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
63170         int64_t ret_ref = 0;
63171         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63172         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63173         return ret_ref;
63174 }
63175
63176 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAlias_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
63177         LDKNodeAlias a_conv;
63178         a_conv.inner = untag_ptr(a);
63179         a_conv.is_owned = ptr_is_owned(a);
63180         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63181         a_conv.is_owned = false;
63182         LDKNodeAlias b_conv;
63183         b_conv.inner = untag_ptr(b);
63184         b_conv.is_owned = ptr_is_owned(b);
63185         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63186         b_conv.is_owned = false;
63187         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
63188         return ret_conv;
63189 }
63190
63191 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1write(JNIEnv *env, jclass clz, int64_t obj) {
63192         LDKNodeAlias obj_conv;
63193         obj_conv.inner = untag_ptr(obj);
63194         obj_conv.is_owned = ptr_is_owned(obj);
63195         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63196         obj_conv.is_owned = false;
63197         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
63198         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63199         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63200         CVec_u8Z_free(ret_var);
63201         return ret_arr;
63202 }
63203
63204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
63205         LDKu8slice ser_ref;
63206         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63207         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63208         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
63209         *ret_conv = NodeAlias_read(ser_ref);
63210         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63211         return tag_ptr(ret_conv, true);
63212 }
63213
63214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63215         LDKNodeInfo this_obj_conv;
63216         this_obj_conv.inner = untag_ptr(this_obj);
63217         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63219         NodeInfo_free(this_obj_conv);
63220 }
63221
63222 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
63223         LDKNodeInfo this_ptr_conv;
63224         this_ptr_conv.inner = untag_ptr(this_ptr);
63225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63227         this_ptr_conv.is_owned = false;
63228         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
63229         int64_tArray ret_arr = NULL;
63230         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
63231         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
63232         for (size_t g = 0; g < ret_var.datalen; g++) {
63233                 int64_t ret_conv_6_conv = ret_var.data[g];
63234                 ret_arr_ptr[g] = ret_conv_6_conv;
63235         }
63236         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
63237         FREE(ret_var.data);
63238         return ret_arr;
63239 }
63240
63241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
63242         LDKNodeInfo this_ptr_conv;
63243         this_ptr_conv.inner = untag_ptr(this_ptr);
63244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63246         this_ptr_conv.is_owned = false;
63247         LDKCVec_u64Z val_constr;
63248         val_constr.datalen = (*env)->GetArrayLength(env, val);
63249         if (val_constr.datalen > 0)
63250                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
63251         else
63252                 val_constr.data = NULL;
63253         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
63254         for (size_t g = 0; g < val_constr.datalen; g++) {
63255                 int64_t val_conv_6 = val_vals[g];
63256                 val_constr.data[g] = val_conv_6;
63257         }
63258         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
63259         NodeInfo_set_channels(&this_ptr_conv, val_constr);
63260 }
63261
63262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
63263         LDKNodeInfo this_ptr_conv;
63264         this_ptr_conv.inner = untag_ptr(this_ptr);
63265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63267         this_ptr_conv.is_owned = false;
63268         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
63269         int64_t ret_ref = 0;
63270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63272         return ret_ref;
63273 }
63274
63275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63276         LDKNodeInfo this_ptr_conv;
63277         this_ptr_conv.inner = untag_ptr(this_ptr);
63278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63280         this_ptr_conv.is_owned = false;
63281         LDKNodeAnnouncementInfo val_conv;
63282         val_conv.inner = untag_ptr(val);
63283         val_conv.is_owned = ptr_is_owned(val);
63284         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63285         val_conv = NodeAnnouncementInfo_clone(&val_conv);
63286         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
63287 }
63288
63289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv *env, jclass clz, int64_tArray channels_arg, int64_t announcement_info_arg) {
63290         LDKCVec_u64Z channels_arg_constr;
63291         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
63292         if (channels_arg_constr.datalen > 0)
63293                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
63294         else
63295                 channels_arg_constr.data = NULL;
63296         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
63297         for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
63298                 int64_t channels_arg_conv_6 = channels_arg_vals[g];
63299                 channels_arg_constr.data[g] = channels_arg_conv_6;
63300         }
63301         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
63302         LDKNodeAnnouncementInfo announcement_info_arg_conv;
63303         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
63304         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
63305         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
63306         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
63307         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
63308         int64_t ret_ref = 0;
63309         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63310         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63311         return ret_ref;
63312 }
63313
63314 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
63315         LDKNodeInfo ret_var = NodeInfo_clone(arg);
63316         int64_t ret_ref = 0;
63317         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63318         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63319         return ret_ref;
63320 }
63321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63322         LDKNodeInfo arg_conv;
63323         arg_conv.inner = untag_ptr(arg);
63324         arg_conv.is_owned = ptr_is_owned(arg);
63325         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63326         arg_conv.is_owned = false;
63327         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
63328         return ret_conv;
63329 }
63330
63331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63332         LDKNodeInfo orig_conv;
63333         orig_conv.inner = untag_ptr(orig);
63334         orig_conv.is_owned = ptr_is_owned(orig);
63335         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63336         orig_conv.is_owned = false;
63337         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
63338         int64_t ret_ref = 0;
63339         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63340         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63341         return ret_ref;
63342 }
63343
63344 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
63345         LDKNodeInfo a_conv;
63346         a_conv.inner = untag_ptr(a);
63347         a_conv.is_owned = ptr_is_owned(a);
63348         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63349         a_conv.is_owned = false;
63350         LDKNodeInfo b_conv;
63351         b_conv.inner = untag_ptr(b);
63352         b_conv.is_owned = ptr_is_owned(b);
63353         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63354         b_conv.is_owned = false;
63355         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
63356         return ret_conv;
63357 }
63358
63359 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
63360         LDKNodeInfo obj_conv;
63361         obj_conv.inner = untag_ptr(obj);
63362         obj_conv.is_owned = ptr_is_owned(obj);
63363         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63364         obj_conv.is_owned = false;
63365         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
63366         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63367         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63368         CVec_u8Z_free(ret_var);
63369         return ret_arr;
63370 }
63371
63372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
63373         LDKu8slice ser_ref;
63374         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63375         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63376         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
63377         *ret_conv = NodeInfo_read(ser_ref);
63378         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63379         return tag_ptr(ret_conv, true);
63380 }
63381
63382 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
63383         LDKNetworkGraph obj_conv;
63384         obj_conv.inner = untag_ptr(obj);
63385         obj_conv.is_owned = ptr_is_owned(obj);
63386         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63387         obj_conv.is_owned = false;
63388         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
63389         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63390         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63391         CVec_u8Z_free(ret_var);
63392         return ret_arr;
63393 }
63394
63395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
63396         LDKu8slice ser_ref;
63397         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63398         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63399         void* arg_ptr = untag_ptr(arg);
63400         CHECK_ACCESS(arg_ptr);
63401         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
63402         if (arg_conv.free == LDKLogger_JCalls_free) {
63403                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63404                 LDKLogger_JCalls_cloned(&arg_conv);
63405         }
63406         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
63407         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
63408         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63409         return tag_ptr(ret_conv, true);
63410 }
63411
63412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, jclass network, int64_t logger) {
63413         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
63414         void* logger_ptr = untag_ptr(logger);
63415         CHECK_ACCESS(logger_ptr);
63416         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
63417         if (logger_conv.free == LDKLogger_JCalls_free) {
63418                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63419                 LDKLogger_JCalls_cloned(&logger_conv);
63420         }
63421         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
63422         int64_t ret_ref = 0;
63423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63425         return ret_ref;
63426 }
63427
63428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
63429         LDKNetworkGraph this_arg_conv;
63430         this_arg_conv.inner = untag_ptr(this_arg);
63431         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63433         this_arg_conv.is_owned = false;
63434         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
63435         int64_t ret_ref = 0;
63436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63438         return ret_ref;
63439 }
63440
63441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1last_1rapid_1gossip_1sync_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
63442         LDKNetworkGraph this_arg_conv;
63443         this_arg_conv.inner = untag_ptr(this_arg);
63444         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63446         this_arg_conv.is_owned = false;
63447         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
63448         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
63449         int64_t ret_ref = tag_ptr(ret_copy, true);
63450         return ret_ref;
63451 }
63452
63453 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) {
63454         LDKNetworkGraph this_arg_conv;
63455         this_arg_conv.inner = untag_ptr(this_arg);
63456         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63458         this_arg_conv.is_owned = false;
63459         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
63460 }
63461
63462 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) {
63463         LDKNetworkGraph this_arg_conv;
63464         this_arg_conv.inner = untag_ptr(this_arg);
63465         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63467         this_arg_conv.is_owned = false;
63468         LDKNodeAnnouncement msg_conv;
63469         msg_conv.inner = untag_ptr(msg);
63470         msg_conv.is_owned = ptr_is_owned(msg);
63471         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63472         msg_conv.is_owned = false;
63473         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63474         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
63475         return tag_ptr(ret_conv, true);
63476 }
63477
63478 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) {
63479         LDKNetworkGraph this_arg_conv;
63480         this_arg_conv.inner = untag_ptr(this_arg);
63481         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63483         this_arg_conv.is_owned = false;
63484         LDKUnsignedNodeAnnouncement msg_conv;
63485         msg_conv.inner = untag_ptr(msg);
63486         msg_conv.is_owned = ptr_is_owned(msg);
63487         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63488         msg_conv.is_owned = false;
63489         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63490         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
63491         return tag_ptr(ret_conv, true);
63492 }
63493
63494 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) {
63495         LDKNetworkGraph this_arg_conv;
63496         this_arg_conv.inner = untag_ptr(this_arg);
63497         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63499         this_arg_conv.is_owned = false;
63500         LDKChannelAnnouncement msg_conv;
63501         msg_conv.inner = untag_ptr(msg);
63502         msg_conv.is_owned = ptr_is_owned(msg);
63503         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63504         msg_conv.is_owned = false;
63505         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
63506         CHECK_ACCESS(utxo_lookup_ptr);
63507         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
63508         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
63509         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
63510                 // Manually implement clone for Java trait instances
63511                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
63512                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63513                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
63514                 }
63515         }
63516         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63517         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
63518         return tag_ptr(ret_conv, true);
63519 }
63520
63521 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) {
63522         LDKNetworkGraph this_arg_conv;
63523         this_arg_conv.inner = untag_ptr(this_arg);
63524         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63526         this_arg_conv.is_owned = false;
63527         LDKChannelAnnouncement msg_conv;
63528         msg_conv.inner = untag_ptr(msg);
63529         msg_conv.is_owned = ptr_is_owned(msg);
63530         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63531         msg_conv.is_owned = false;
63532         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63533         *ret_conv = NetworkGraph_update_channel_from_announcement_no_lookup(&this_arg_conv, &msg_conv);
63534         return tag_ptr(ret_conv, true);
63535 }
63536
63537 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) {
63538         LDKNetworkGraph this_arg_conv;
63539         this_arg_conv.inner = untag_ptr(this_arg);
63540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63542         this_arg_conv.is_owned = false;
63543         LDKUnsignedChannelAnnouncement msg_conv;
63544         msg_conv.inner = untag_ptr(msg);
63545         msg_conv.is_owned = ptr_is_owned(msg);
63546         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63547         msg_conv.is_owned = false;
63548         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
63549         CHECK_ACCESS(utxo_lookup_ptr);
63550         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
63551         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
63552         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
63553                 // Manually implement clone for Java trait instances
63554                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
63555                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63556                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
63557                 }
63558         }
63559         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63560         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
63561         return tag_ptr(ret_conv, true);
63562 }
63563
63564 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) {
63565         LDKNetworkGraph this_arg_conv;
63566         this_arg_conv.inner = untag_ptr(this_arg);
63567         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63569         this_arg_conv.is_owned = false;
63570         LDKChannelFeatures features_conv;
63571         features_conv.inner = untag_ptr(features);
63572         features_conv.is_owned = ptr_is_owned(features);
63573         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
63574         features_conv = ChannelFeatures_clone(&features_conv);
63575         LDKPublicKey node_id_1_ref;
63576         CHECK((*env)->GetArrayLength(env, node_id_1) == 33);
63577         (*env)->GetByteArrayRegion(env, node_id_1, 0, 33, node_id_1_ref.compressed_form);
63578         LDKPublicKey node_id_2_ref;
63579         CHECK((*env)->GetArrayLength(env, node_id_2) == 33);
63580         (*env)->GetByteArrayRegion(env, node_id_2, 0, 33, node_id_2_ref.compressed_form);
63581         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63582         *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);
63583         return tag_ptr(ret_conv, true);
63584 }
63585
63586 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) {
63587         LDKNetworkGraph this_arg_conv;
63588         this_arg_conv.inner = untag_ptr(this_arg);
63589         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63591         this_arg_conv.is_owned = false;
63592         NetworkGraph_channel_failed_permanent(&this_arg_conv, short_channel_id);
63593 }
63594
63595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1node_1failed_1permanent(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray node_id) {
63596         LDKNetworkGraph this_arg_conv;
63597         this_arg_conv.inner = untag_ptr(this_arg);
63598         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63600         this_arg_conv.is_owned = false;
63601         LDKPublicKey node_id_ref;
63602         CHECK((*env)->GetArrayLength(env, node_id) == 33);
63603         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
63604         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
63605 }
63606
63607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels_1and_1tracking(JNIEnv *env, jclass clz, int64_t this_arg) {
63608         LDKNetworkGraph this_arg_conv;
63609         this_arg_conv.inner = untag_ptr(this_arg);
63610         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63612         this_arg_conv.is_owned = false;
63613         NetworkGraph_remove_stale_channels_and_tracking(&this_arg_conv);
63614 }
63615
63616 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) {
63617         LDKNetworkGraph this_arg_conv;
63618         this_arg_conv.inner = untag_ptr(this_arg);
63619         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63621         this_arg_conv.is_owned = false;
63622         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
63623 }
63624
63625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
63626         LDKNetworkGraph this_arg_conv;
63627         this_arg_conv.inner = untag_ptr(this_arg);
63628         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63630         this_arg_conv.is_owned = false;
63631         LDKChannelUpdate msg_conv;
63632         msg_conv.inner = untag_ptr(msg);
63633         msg_conv.is_owned = ptr_is_owned(msg);
63634         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63635         msg_conv.is_owned = false;
63636         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63637         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
63638         return tag_ptr(ret_conv, true);
63639 }
63640
63641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
63642         LDKNetworkGraph this_arg_conv;
63643         this_arg_conv.inner = untag_ptr(this_arg);
63644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63646         this_arg_conv.is_owned = false;
63647         LDKUnsignedChannelUpdate msg_conv;
63648         msg_conv.inner = untag_ptr(msg);
63649         msg_conv.is_owned = ptr_is_owned(msg);
63650         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63651         msg_conv.is_owned = false;
63652         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63653         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
63654         return tag_ptr(ret_conv, true);
63655 }
63656
63657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1verify_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
63658         LDKNetworkGraph this_arg_conv;
63659         this_arg_conv.inner = untag_ptr(this_arg);
63660         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63662         this_arg_conv.is_owned = false;
63663         LDKChannelUpdate msg_conv;
63664         msg_conv.inner = untag_ptr(msg);
63665         msg_conv.is_owned = ptr_is_owned(msg);
63666         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63667         msg_conv.is_owned = false;
63668         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63669         *ret_conv = NetworkGraph_verify_channel_update(&this_arg_conv, &msg_conv);
63670         return tag_ptr(ret_conv, true);
63671 }
63672
63673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) {
63674         LDKReadOnlyNetworkGraph this_arg_conv;
63675         this_arg_conv.inner = untag_ptr(this_arg);
63676         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63678         this_arg_conv.is_owned = false;
63679         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
63680         int64_t ret_ref = 0;
63681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63683         return ret_ref;
63684 }
63685
63686 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
63687         LDKReadOnlyNetworkGraph this_arg_conv;
63688         this_arg_conv.inner = untag_ptr(this_arg);
63689         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63691         this_arg_conv.is_owned = false;
63692         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
63693         int64_tArray ret_arr = NULL;
63694         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
63695         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
63696         for (size_t g = 0; g < ret_var.datalen; g++) {
63697                 int64_t ret_conv_6_conv = ret_var.data[g];
63698                 ret_arr_ptr[g] = ret_conv_6_conv;
63699         }
63700         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
63701         FREE(ret_var.data);
63702         return ret_arr;
63703 }
63704
63705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1node(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
63706         LDKReadOnlyNetworkGraph this_arg_conv;
63707         this_arg_conv.inner = untag_ptr(this_arg);
63708         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63710         this_arg_conv.is_owned = false;
63711         LDKNodeId node_id_conv;
63712         node_id_conv.inner = untag_ptr(node_id);
63713         node_id_conv.is_owned = ptr_is_owned(node_id);
63714         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
63715         node_id_conv.is_owned = false;
63716         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
63717         int64_t ret_ref = 0;
63718         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63719         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63720         return ret_ref;
63721 }
63722
63723 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1nodes(JNIEnv *env, jclass clz, int64_t this_arg) {
63724         LDKReadOnlyNetworkGraph this_arg_conv;
63725         this_arg_conv.inner = untag_ptr(this_arg);
63726         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63728         this_arg_conv.is_owned = false;
63729         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
63730         int64_tArray ret_arr = NULL;
63731         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
63732         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
63733         for (size_t i = 0; i < ret_var.datalen; i++) {
63734                 LDKNodeId ret_conv_8_var = ret_var.data[i];
63735                 int64_t ret_conv_8_ref = 0;
63736                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
63737                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
63738                 ret_arr_ptr[i] = ret_conv_8_ref;
63739         }
63740         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
63741         FREE(ret_var.data);
63742         return ret_arr;
63743 }
63744
63745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) {
63746         LDKReadOnlyNetworkGraph this_arg_conv;
63747         this_arg_conv.inner = untag_ptr(this_arg);
63748         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63750         this_arg_conv.is_owned = false;
63751         LDKPublicKey pubkey_ref;
63752         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
63753         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
63754         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
63755         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
63756         int64_t ret_ref = tag_ptr(ret_copy, true);
63757         return ret_ref;
63758 }
63759
63760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63761         LDKDefaultRouter this_obj_conv;
63762         this_obj_conv.inner = untag_ptr(this_obj);
63763         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63765         DefaultRouter_free(this_obj_conv);
63766 }
63767
63768 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) {
63769         LDKNetworkGraph network_graph_conv;
63770         network_graph_conv.inner = untag_ptr(network_graph);
63771         network_graph_conv.is_owned = ptr_is_owned(network_graph);
63772         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
63773         network_graph_conv.is_owned = false;
63774         void* logger_ptr = untag_ptr(logger);
63775         CHECK_ACCESS(logger_ptr);
63776         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
63777         if (logger_conv.free == LDKLogger_JCalls_free) {
63778                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63779                 LDKLogger_JCalls_cloned(&logger_conv);
63780         }
63781         LDKThirtyTwoBytes random_seed_bytes_ref;
63782         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
63783         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_ref.data);
63784         void* scorer_ptr = untag_ptr(scorer);
63785         CHECK_ACCESS(scorer_ptr);
63786         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
63787         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
63788                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63789                 LDKLockableScore_JCalls_cloned(&scorer_conv);
63790         }
63791         LDKProbabilisticScoringFeeParameters score_params_conv;
63792         score_params_conv.inner = untag_ptr(score_params);
63793         score_params_conv.is_owned = ptr_is_owned(score_params);
63794         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
63795         score_params_conv = ProbabilisticScoringFeeParameters_clone(&score_params_conv);
63796         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref, scorer_conv, score_params_conv);
63797         int64_t ret_ref = 0;
63798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63800         return ret_ref;
63801 }
63802
63803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1Router(JNIEnv *env, jclass clz, int64_t this_arg) {
63804         LDKDefaultRouter this_arg_conv;
63805         this_arg_conv.inner = untag_ptr(this_arg);
63806         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63808         this_arg_conv.is_owned = false;
63809         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
63810         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
63811         return tag_ptr(ret_ret, true);
63812 }
63813
63814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
63815         if (!ptr_is_owned(this_ptr)) return;
63816         void* this_ptr_ptr = untag_ptr(this_ptr);
63817         CHECK_ACCESS(this_ptr_ptr);
63818         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
63819         FREE(untag_ptr(this_ptr));
63820         Router_free(this_ptr_conv);
63821 }
63822
63823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63824         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
63825         this_obj_conv.inner = untag_ptr(this_obj);
63826         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63828         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
63829 }
63830
63831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1new(JNIEnv *env, jclass clz, int64_t scorer, int64_t inflight_htlcs) {
63832         void* scorer_ptr = untag_ptr(scorer);
63833         CHECK_ACCESS(scorer_ptr);
63834         LDKScoreLookUp scorer_conv = *(LDKScoreLookUp*)(scorer_ptr);
63835         if (scorer_conv.free == LDKScoreLookUp_JCalls_free) {
63836                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63837                 LDKScoreLookUp_JCalls_cloned(&scorer_conv);
63838         }
63839         LDKInFlightHtlcs inflight_htlcs_conv;
63840         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
63841         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
63842         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
63843         inflight_htlcs_conv.is_owned = false;
63844         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
63845         int64_t ret_ref = 0;
63846         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63847         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63848         return ret_ref;
63849 }
63850
63851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
63852         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
63853         this_arg_conv.inner = untag_ptr(this_arg);
63854         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63856         this_arg_conv.is_owned = false;
63857         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
63858         *ret_ret = ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(&this_arg_conv);
63859         return tag_ptr(ret_ret, true);
63860 }
63861
63862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63863         LDKInFlightHtlcs this_obj_conv;
63864         this_obj_conv.inner = untag_ptr(this_obj);
63865         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63867         InFlightHtlcs_free(this_obj_conv);
63868 }
63869
63870 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
63871         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
63872         int64_t ret_ref = 0;
63873         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63874         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63875         return ret_ref;
63876 }
63877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63878         LDKInFlightHtlcs arg_conv;
63879         arg_conv.inner = untag_ptr(arg);
63880         arg_conv.is_owned = ptr_is_owned(arg);
63881         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63882         arg_conv.is_owned = false;
63883         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
63884         return ret_conv;
63885 }
63886
63887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63888         LDKInFlightHtlcs orig_conv;
63889         orig_conv.inner = untag_ptr(orig);
63890         orig_conv.is_owned = ptr_is_owned(orig);
63891         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63892         orig_conv.is_owned = false;
63893         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
63894         int64_t ret_ref = 0;
63895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63897         return ret_ref;
63898 }
63899
63900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1new(JNIEnv *env, jclass clz) {
63901         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
63902         int64_t ret_ref = 0;
63903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63905         return ret_ref;
63906 }
63907
63908 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) {
63909         LDKInFlightHtlcs this_arg_conv;
63910         this_arg_conv.inner = untag_ptr(this_arg);
63911         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63913         this_arg_conv.is_owned = false;
63914         LDKPath path_conv;
63915         path_conv.inner = untag_ptr(path);
63916         path_conv.is_owned = ptr_is_owned(path);
63917         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
63918         path_conv.is_owned = false;
63919         LDKPublicKey payer_node_id_ref;
63920         CHECK((*env)->GetArrayLength(env, payer_node_id) == 33);
63921         (*env)->GetByteArrayRegion(env, payer_node_id, 0, 33, payer_node_id_ref.compressed_form);
63922         InFlightHtlcs_process_path(&this_arg_conv, &path_conv, payer_node_id_ref);
63923 }
63924
63925 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) {
63926         LDKInFlightHtlcs this_arg_conv;
63927         this_arg_conv.inner = untag_ptr(this_arg);
63928         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63930         this_arg_conv.is_owned = false;
63931         LDKNodeId source_conv;
63932         source_conv.inner = untag_ptr(source);
63933         source_conv.is_owned = ptr_is_owned(source);
63934         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
63935         source_conv.is_owned = false;
63936         LDKNodeId target_conv;
63937         target_conv.inner = untag_ptr(target);
63938         target_conv.is_owned = ptr_is_owned(target);
63939         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
63940         target_conv.is_owned = false;
63941         InFlightHtlcs_add_inflight_htlc(&this_arg_conv, &source_conv, &target_conv, channel_scid, used_msat);
63942 }
63943
63944 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) {
63945         LDKInFlightHtlcs this_arg_conv;
63946         this_arg_conv.inner = untag_ptr(this_arg);
63947         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63949         this_arg_conv.is_owned = false;
63950         LDKNodeId source_conv;
63951         source_conv.inner = untag_ptr(source);
63952         source_conv.is_owned = ptr_is_owned(source);
63953         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
63954         source_conv.is_owned = false;
63955         LDKNodeId target_conv;
63956         target_conv.inner = untag_ptr(target);
63957         target_conv.is_owned = ptr_is_owned(target);
63958         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
63959         target_conv.is_owned = false;
63960         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
63961         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
63962         int64_t ret_ref = tag_ptr(ret_copy, true);
63963         return ret_ref;
63964 }
63965
63966 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1write(JNIEnv *env, jclass clz, int64_t obj) {
63967         LDKInFlightHtlcs obj_conv;
63968         obj_conv.inner = untag_ptr(obj);
63969         obj_conv.is_owned = ptr_is_owned(obj);
63970         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63971         obj_conv.is_owned = false;
63972         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
63973         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63974         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63975         CVec_u8Z_free(ret_var);
63976         return ret_arr;
63977 }
63978
63979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
63980         LDKu8slice ser_ref;
63981         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63982         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63983         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
63984         *ret_conv = InFlightHtlcs_read(ser_ref);
63985         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63986         return tag_ptr(ret_conv, true);
63987 }
63988
63989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63990         LDKRouteHop this_obj_conv;
63991         this_obj_conv.inner = untag_ptr(this_obj);
63992         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63994         RouteHop_free(this_obj_conv);
63995 }
63996
63997 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
63998         LDKRouteHop this_ptr_conv;
63999         this_ptr_conv.inner = untag_ptr(this_ptr);
64000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64002         this_ptr_conv.is_owned = false;
64003         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
64004         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
64005         return ret_arr;
64006 }
64007
64008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
64009         LDKRouteHop 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         LDKPublicKey val_ref;
64015         CHECK((*env)->GetArrayLength(env, val) == 33);
64016         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
64017         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
64018 }
64019
64020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
64021         LDKRouteHop this_ptr_conv;
64022         this_ptr_conv.inner = untag_ptr(this_ptr);
64023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64025         this_ptr_conv.is_owned = false;
64026         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
64027         int64_t ret_ref = 0;
64028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64030         return ret_ref;
64031 }
64032
64033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64034         LDKRouteHop this_ptr_conv;
64035         this_ptr_conv.inner = untag_ptr(this_ptr);
64036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64038         this_ptr_conv.is_owned = false;
64039         LDKNodeFeatures val_conv;
64040         val_conv.inner = untag_ptr(val);
64041         val_conv.is_owned = ptr_is_owned(val);
64042         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64043         val_conv = NodeFeatures_clone(&val_conv);
64044         RouteHop_set_node_features(&this_ptr_conv, val_conv);
64045 }
64046
64047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
64048         LDKRouteHop this_ptr_conv;
64049         this_ptr_conv.inner = untag_ptr(this_ptr);
64050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64052         this_ptr_conv.is_owned = false;
64053         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
64054         return ret_conv;
64055 }
64056
64057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64058         LDKRouteHop this_ptr_conv;
64059         this_ptr_conv.inner = untag_ptr(this_ptr);
64060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64062         this_ptr_conv.is_owned = false;
64063         RouteHop_set_short_channel_id(&this_ptr_conv, val);
64064 }
64065
64066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
64067         LDKRouteHop this_ptr_conv;
64068         this_ptr_conv.inner = untag_ptr(this_ptr);
64069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64071         this_ptr_conv.is_owned = false;
64072         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
64073         int64_t ret_ref = 0;
64074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64076         return ret_ref;
64077 }
64078
64079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64080         LDKRouteHop this_ptr_conv;
64081         this_ptr_conv.inner = untag_ptr(this_ptr);
64082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64084         this_ptr_conv.is_owned = false;
64085         LDKChannelFeatures val_conv;
64086         val_conv.inner = untag_ptr(val);
64087         val_conv.is_owned = ptr_is_owned(val);
64088         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64089         val_conv = ChannelFeatures_clone(&val_conv);
64090         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
64091 }
64092
64093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
64094         LDKRouteHop this_ptr_conv;
64095         this_ptr_conv.inner = untag_ptr(this_ptr);
64096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64098         this_ptr_conv.is_owned = false;
64099         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
64100         return ret_conv;
64101 }
64102
64103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64104         LDKRouteHop this_ptr_conv;
64105         this_ptr_conv.inner = untag_ptr(this_ptr);
64106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64108         this_ptr_conv.is_owned = false;
64109         RouteHop_set_fee_msat(&this_ptr_conv, val);
64110 }
64111
64112 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
64113         LDKRouteHop this_ptr_conv;
64114         this_ptr_conv.inner = untag_ptr(this_ptr);
64115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64117         this_ptr_conv.is_owned = false;
64118         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
64119         return ret_conv;
64120 }
64121
64122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
64123         LDKRouteHop this_ptr_conv;
64124         this_ptr_conv.inner = untag_ptr(this_ptr);
64125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64127         this_ptr_conv.is_owned = false;
64128         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
64129 }
64130
64131 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1maybe_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
64132         LDKRouteHop this_ptr_conv;
64133         this_ptr_conv.inner = untag_ptr(this_ptr);
64134         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64136         this_ptr_conv.is_owned = false;
64137         jboolean ret_conv = RouteHop_get_maybe_announced_channel(&this_ptr_conv);
64138         return ret_conv;
64139 }
64140
64141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1maybe_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
64142         LDKRouteHop this_ptr_conv;
64143         this_ptr_conv.inner = untag_ptr(this_ptr);
64144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64146         this_ptr_conv.is_owned = false;
64147         RouteHop_set_maybe_announced_channel(&this_ptr_conv, val);
64148 }
64149
64150 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) {
64151         LDKPublicKey pubkey_arg_ref;
64152         CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
64153         (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
64154         LDKNodeFeatures node_features_arg_conv;
64155         node_features_arg_conv.inner = untag_ptr(node_features_arg);
64156         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
64157         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
64158         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
64159         LDKChannelFeatures channel_features_arg_conv;
64160         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
64161         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
64162         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
64163         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
64164         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);
64165         int64_t ret_ref = 0;
64166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64168         return ret_ref;
64169 }
64170
64171 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
64172         LDKRouteHop ret_var = RouteHop_clone(arg);
64173         int64_t ret_ref = 0;
64174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64176         return ret_ref;
64177 }
64178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64179         LDKRouteHop arg_conv;
64180         arg_conv.inner = untag_ptr(arg);
64181         arg_conv.is_owned = ptr_is_owned(arg);
64182         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64183         arg_conv.is_owned = false;
64184         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
64185         return ret_conv;
64186 }
64187
64188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64189         LDKRouteHop orig_conv;
64190         orig_conv.inner = untag_ptr(orig);
64191         orig_conv.is_owned = ptr_is_owned(orig);
64192         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64193         orig_conv.is_owned = false;
64194         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
64195         int64_t ret_ref = 0;
64196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64198         return ret_ref;
64199 }
64200
64201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
64202         LDKRouteHop o_conv;
64203         o_conv.inner = untag_ptr(o);
64204         o_conv.is_owned = ptr_is_owned(o);
64205         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64206         o_conv.is_owned = false;
64207         int64_t ret_conv = RouteHop_hash(&o_conv);
64208         return ret_conv;
64209 }
64210
64211 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64212         LDKRouteHop a_conv;
64213         a_conv.inner = untag_ptr(a);
64214         a_conv.is_owned = ptr_is_owned(a);
64215         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64216         a_conv.is_owned = false;
64217         LDKRouteHop b_conv;
64218         b_conv.inner = untag_ptr(b);
64219         b_conv.is_owned = ptr_is_owned(b);
64220         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64221         b_conv.is_owned = false;
64222         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
64223         return ret_conv;
64224 }
64225
64226 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
64227         LDKRouteHop obj_conv;
64228         obj_conv.inner = untag_ptr(obj);
64229         obj_conv.is_owned = ptr_is_owned(obj);
64230         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64231         obj_conv.is_owned = false;
64232         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
64233         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64234         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64235         CVec_u8Z_free(ret_var);
64236         return ret_arr;
64237 }
64238
64239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64240         LDKu8slice ser_ref;
64241         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64242         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64243         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
64244         *ret_conv = RouteHop_read(ser_ref);
64245         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64246         return tag_ptr(ret_conv, true);
64247 }
64248
64249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64250         LDKBlindedTail this_obj_conv;
64251         this_obj_conv.inner = untag_ptr(this_obj);
64252         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64254         BlindedTail_free(this_obj_conv);
64255 }
64256
64257 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
64258         LDKBlindedTail this_ptr_conv;
64259         this_ptr_conv.inner = untag_ptr(this_ptr);
64260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64262         this_ptr_conv.is_owned = false;
64263         LDKCVec_BlindedHopZ ret_var = BlindedTail_get_hops(&this_ptr_conv);
64264         int64_tArray ret_arr = NULL;
64265         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
64266         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
64267         for (size_t m = 0; m < ret_var.datalen; m++) {
64268                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
64269                 int64_t ret_conv_12_ref = 0;
64270                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
64271                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
64272                 ret_arr_ptr[m] = ret_conv_12_ref;
64273         }
64274         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
64275         FREE(ret_var.data);
64276         return ret_arr;
64277 }
64278
64279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
64280         LDKBlindedTail this_ptr_conv;
64281         this_ptr_conv.inner = untag_ptr(this_ptr);
64282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64284         this_ptr_conv.is_owned = false;
64285         LDKCVec_BlindedHopZ val_constr;
64286         val_constr.datalen = (*env)->GetArrayLength(env, val);
64287         if (val_constr.datalen > 0)
64288                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
64289         else
64290                 val_constr.data = NULL;
64291         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
64292         for (size_t m = 0; m < val_constr.datalen; m++) {
64293                 int64_t val_conv_12 = val_vals[m];
64294                 LDKBlindedHop val_conv_12_conv;
64295                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
64296                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
64297                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
64298                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
64299                 val_constr.data[m] = val_conv_12_conv;
64300         }
64301         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
64302         BlindedTail_set_hops(&this_ptr_conv, val_constr);
64303 }
64304
64305 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
64306         LDKBlindedTail this_ptr_conv;
64307         this_ptr_conv.inner = untag_ptr(this_ptr);
64308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64310         this_ptr_conv.is_owned = false;
64311         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
64312         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedTail_get_blinding_point(&this_ptr_conv).compressed_form);
64313         return ret_arr;
64314 }
64315
64316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
64317         LDKBlindedTail this_ptr_conv;
64318         this_ptr_conv.inner = untag_ptr(this_ptr);
64319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64321         this_ptr_conv.is_owned = false;
64322         LDKPublicKey val_ref;
64323         CHECK((*env)->GetArrayLength(env, val) == 33);
64324         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
64325         BlindedTail_set_blinding_point(&this_ptr_conv, val_ref);
64326 }
64327
64328 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1excess_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
64329         LDKBlindedTail this_ptr_conv;
64330         this_ptr_conv.inner = untag_ptr(this_ptr);
64331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64333         this_ptr_conv.is_owned = false;
64334         int32_t ret_conv = BlindedTail_get_excess_final_cltv_expiry_delta(&this_ptr_conv);
64335         return ret_conv;
64336 }
64337
64338 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) {
64339         LDKBlindedTail this_ptr_conv;
64340         this_ptr_conv.inner = untag_ptr(this_ptr);
64341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64343         this_ptr_conv.is_owned = false;
64344         BlindedTail_set_excess_final_cltv_expiry_delta(&this_ptr_conv, val);
64345 }
64346
64347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
64348         LDKBlindedTail this_ptr_conv;
64349         this_ptr_conv.inner = untag_ptr(this_ptr);
64350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64352         this_ptr_conv.is_owned = false;
64353         int64_t ret_conv = BlindedTail_get_final_value_msat(&this_ptr_conv);
64354         return ret_conv;
64355 }
64356
64357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64358         LDKBlindedTail this_ptr_conv;
64359         this_ptr_conv.inner = untag_ptr(this_ptr);
64360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64362         this_ptr_conv.is_owned = false;
64363         BlindedTail_set_final_value_msat(&this_ptr_conv, val);
64364 }
64365
64366 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) {
64367         LDKCVec_BlindedHopZ hops_arg_constr;
64368         hops_arg_constr.datalen = (*env)->GetArrayLength(env, hops_arg);
64369         if (hops_arg_constr.datalen > 0)
64370                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
64371         else
64372                 hops_arg_constr.data = NULL;
64373         int64_t* hops_arg_vals = (*env)->GetLongArrayElements (env, hops_arg, NULL);
64374         for (size_t m = 0; m < hops_arg_constr.datalen; m++) {
64375                 int64_t hops_arg_conv_12 = hops_arg_vals[m];
64376                 LDKBlindedHop hops_arg_conv_12_conv;
64377                 hops_arg_conv_12_conv.inner = untag_ptr(hops_arg_conv_12);
64378                 hops_arg_conv_12_conv.is_owned = ptr_is_owned(hops_arg_conv_12);
64379                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_12_conv);
64380                 hops_arg_conv_12_conv = BlindedHop_clone(&hops_arg_conv_12_conv);
64381                 hops_arg_constr.data[m] = hops_arg_conv_12_conv;
64382         }
64383         (*env)->ReleaseLongArrayElements(env, hops_arg, hops_arg_vals, 0);
64384         LDKPublicKey blinding_point_arg_ref;
64385         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
64386         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
64387         LDKBlindedTail ret_var = BlindedTail_new(hops_arg_constr, blinding_point_arg_ref, excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
64388         int64_t ret_ref = 0;
64389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64391         return ret_ref;
64392 }
64393
64394 static inline uint64_t BlindedTail_clone_ptr(LDKBlindedTail *NONNULL_PTR arg) {
64395         LDKBlindedTail ret_var = BlindedTail_clone(arg);
64396         int64_t ret_ref = 0;
64397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64399         return ret_ref;
64400 }
64401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64402         LDKBlindedTail arg_conv;
64403         arg_conv.inner = untag_ptr(arg);
64404         arg_conv.is_owned = ptr_is_owned(arg);
64405         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64406         arg_conv.is_owned = false;
64407         int64_t ret_conv = BlindedTail_clone_ptr(&arg_conv);
64408         return ret_conv;
64409 }
64410
64411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64412         LDKBlindedTail orig_conv;
64413         orig_conv.inner = untag_ptr(orig);
64414         orig_conv.is_owned = ptr_is_owned(orig);
64415         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64416         orig_conv.is_owned = false;
64417         LDKBlindedTail ret_var = BlindedTail_clone(&orig_conv);
64418         int64_t ret_ref = 0;
64419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64421         return ret_ref;
64422 }
64423
64424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1hash(JNIEnv *env, jclass clz, int64_t o) {
64425         LDKBlindedTail o_conv;
64426         o_conv.inner = untag_ptr(o);
64427         o_conv.is_owned = ptr_is_owned(o);
64428         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64429         o_conv.is_owned = false;
64430         int64_t ret_conv = BlindedTail_hash(&o_conv);
64431         return ret_conv;
64432 }
64433
64434 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedTail_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64435         LDKBlindedTail a_conv;
64436         a_conv.inner = untag_ptr(a);
64437         a_conv.is_owned = ptr_is_owned(a);
64438         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64439         a_conv.is_owned = false;
64440         LDKBlindedTail b_conv;
64441         b_conv.inner = untag_ptr(b);
64442         b_conv.is_owned = ptr_is_owned(b);
64443         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64444         b_conv.is_owned = false;
64445         jboolean ret_conv = BlindedTail_eq(&a_conv, &b_conv);
64446         return ret_conv;
64447 }
64448
64449 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1write(JNIEnv *env, jclass clz, int64_t obj) {
64450         LDKBlindedTail obj_conv;
64451         obj_conv.inner = untag_ptr(obj);
64452         obj_conv.is_owned = ptr_is_owned(obj);
64453         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64454         obj_conv.is_owned = false;
64455         LDKCVec_u8Z ret_var = BlindedTail_write(&obj_conv);
64456         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64457         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64458         CVec_u8Z_free(ret_var);
64459         return ret_arr;
64460 }
64461
64462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64463         LDKu8slice ser_ref;
64464         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64465         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64466         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
64467         *ret_conv = BlindedTail_read(ser_ref);
64468         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64469         return tag_ptr(ret_conv, true);
64470 }
64471
64472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64473         LDKPath this_obj_conv;
64474         this_obj_conv.inner = untag_ptr(this_obj);
64475         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64477         Path_free(this_obj_conv);
64478 }
64479
64480 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Path_1get_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
64481         LDKPath this_ptr_conv;
64482         this_ptr_conv.inner = untag_ptr(this_ptr);
64483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64485         this_ptr_conv.is_owned = false;
64486         LDKCVec_RouteHopZ ret_var = Path_get_hops(&this_ptr_conv);
64487         int64_tArray ret_arr = NULL;
64488         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
64489         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
64490         for (size_t k = 0; k < ret_var.datalen; k++) {
64491                 LDKRouteHop ret_conv_10_var = ret_var.data[k];
64492                 int64_t ret_conv_10_ref = 0;
64493                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
64494                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
64495                 ret_arr_ptr[k] = ret_conv_10_ref;
64496         }
64497         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
64498         FREE(ret_var.data);
64499         return ret_arr;
64500 }
64501
64502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1set_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
64503         LDKPath this_ptr_conv;
64504         this_ptr_conv.inner = untag_ptr(this_ptr);
64505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64507         this_ptr_conv.is_owned = false;
64508         LDKCVec_RouteHopZ val_constr;
64509         val_constr.datalen = (*env)->GetArrayLength(env, val);
64510         if (val_constr.datalen > 0)
64511                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
64512         else
64513                 val_constr.data = NULL;
64514         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
64515         for (size_t k = 0; k < val_constr.datalen; k++) {
64516                 int64_t val_conv_10 = val_vals[k];
64517                 LDKRouteHop val_conv_10_conv;
64518                 val_conv_10_conv.inner = untag_ptr(val_conv_10);
64519                 val_conv_10_conv.is_owned = ptr_is_owned(val_conv_10);
64520                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_10_conv);
64521                 val_conv_10_conv = RouteHop_clone(&val_conv_10_conv);
64522                 val_constr.data[k] = val_conv_10_conv;
64523         }
64524         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
64525         Path_set_hops(&this_ptr_conv, val_constr);
64526 }
64527
64528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1get_1blinded_1tail(JNIEnv *env, jclass clz, int64_t this_ptr) {
64529         LDKPath this_ptr_conv;
64530         this_ptr_conv.inner = untag_ptr(this_ptr);
64531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64533         this_ptr_conv.is_owned = false;
64534         LDKBlindedTail ret_var = Path_get_blinded_tail(&this_ptr_conv);
64535         int64_t ret_ref = 0;
64536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64538         return ret_ref;
64539 }
64540
64541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1set_1blinded_1tail(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64542         LDKPath this_ptr_conv;
64543         this_ptr_conv.inner = untag_ptr(this_ptr);
64544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64546         this_ptr_conv.is_owned = false;
64547         LDKBlindedTail val_conv;
64548         val_conv.inner = untag_ptr(val);
64549         val_conv.is_owned = ptr_is_owned(val);
64550         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64551         val_conv = BlindedTail_clone(&val_conv);
64552         Path_set_blinded_tail(&this_ptr_conv, val_conv);
64553 }
64554
64555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1new(JNIEnv *env, jclass clz, int64_tArray hops_arg, int64_t blinded_tail_arg) {
64556         LDKCVec_RouteHopZ hops_arg_constr;
64557         hops_arg_constr.datalen = (*env)->GetArrayLength(env, hops_arg);
64558         if (hops_arg_constr.datalen > 0)
64559                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
64560         else
64561                 hops_arg_constr.data = NULL;
64562         int64_t* hops_arg_vals = (*env)->GetLongArrayElements (env, hops_arg, NULL);
64563         for (size_t k = 0; k < hops_arg_constr.datalen; k++) {
64564                 int64_t hops_arg_conv_10 = hops_arg_vals[k];
64565                 LDKRouteHop hops_arg_conv_10_conv;
64566                 hops_arg_conv_10_conv.inner = untag_ptr(hops_arg_conv_10);
64567                 hops_arg_conv_10_conv.is_owned = ptr_is_owned(hops_arg_conv_10);
64568                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_10_conv);
64569                 hops_arg_conv_10_conv = RouteHop_clone(&hops_arg_conv_10_conv);
64570                 hops_arg_constr.data[k] = hops_arg_conv_10_conv;
64571         }
64572         (*env)->ReleaseLongArrayElements(env, hops_arg, hops_arg_vals, 0);
64573         LDKBlindedTail blinded_tail_arg_conv;
64574         blinded_tail_arg_conv.inner = untag_ptr(blinded_tail_arg);
64575         blinded_tail_arg_conv.is_owned = ptr_is_owned(blinded_tail_arg);
64576         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_tail_arg_conv);
64577         blinded_tail_arg_conv = BlindedTail_clone(&blinded_tail_arg_conv);
64578         LDKPath ret_var = Path_new(hops_arg_constr, blinded_tail_arg_conv);
64579         int64_t ret_ref = 0;
64580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64582         return ret_ref;
64583 }
64584
64585 static inline uint64_t Path_clone_ptr(LDKPath *NONNULL_PTR arg) {
64586         LDKPath ret_var = Path_clone(arg);
64587         int64_t ret_ref = 0;
64588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64590         return ret_ref;
64591 }
64592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64593         LDKPath arg_conv;
64594         arg_conv.inner = untag_ptr(arg);
64595         arg_conv.is_owned = ptr_is_owned(arg);
64596         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64597         arg_conv.is_owned = false;
64598         int64_t ret_conv = Path_clone_ptr(&arg_conv);
64599         return ret_conv;
64600 }
64601
64602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64603         LDKPath orig_conv;
64604         orig_conv.inner = untag_ptr(orig);
64605         orig_conv.is_owned = ptr_is_owned(orig);
64606         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64607         orig_conv.is_owned = false;
64608         LDKPath ret_var = Path_clone(&orig_conv);
64609         int64_t ret_ref = 0;
64610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64612         return ret_ref;
64613 }
64614
64615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1hash(JNIEnv *env, jclass clz, int64_t o) {
64616         LDKPath o_conv;
64617         o_conv.inner = untag_ptr(o);
64618         o_conv.is_owned = ptr_is_owned(o);
64619         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64620         o_conv.is_owned = false;
64621         int64_t ret_conv = Path_hash(&o_conv);
64622         return ret_conv;
64623 }
64624
64625 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Path_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64626         LDKPath a_conv;
64627         a_conv.inner = untag_ptr(a);
64628         a_conv.is_owned = ptr_is_owned(a);
64629         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64630         a_conv.is_owned = false;
64631         LDKPath b_conv;
64632         b_conv.inner = untag_ptr(b);
64633         b_conv.is_owned = ptr_is_owned(b);
64634         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64635         b_conv.is_owned = false;
64636         jboolean ret_conv = Path_eq(&a_conv, &b_conv);
64637         return ret_conv;
64638 }
64639
64640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
64641         LDKPath this_arg_conv;
64642         this_arg_conv.inner = untag_ptr(this_arg);
64643         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64645         this_arg_conv.is_owned = false;
64646         int64_t ret_conv = Path_fee_msat(&this_arg_conv);
64647         return ret_conv;
64648 }
64649
64650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
64651         LDKPath this_arg_conv;
64652         this_arg_conv.inner = untag_ptr(this_arg);
64653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64655         this_arg_conv.is_owned = false;
64656         int64_t ret_conv = Path_final_value_msat(&this_arg_conv);
64657         return ret_conv;
64658 }
64659
64660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
64661         LDKPath this_arg_conv;
64662         this_arg_conv.inner = untag_ptr(this_arg);
64663         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64665         this_arg_conv.is_owned = false;
64666         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
64667         *ret_copy = Path_final_cltv_expiry_delta(&this_arg_conv);
64668         int64_t ret_ref = tag_ptr(ret_copy, true);
64669         return ret_ref;
64670 }
64671
64672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64673         LDKRoute this_obj_conv;
64674         this_obj_conv.inner = untag_ptr(this_obj);
64675         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64677         Route_free(this_obj_conv);
64678 }
64679
64680 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
64681         LDKRoute this_ptr_conv;
64682         this_ptr_conv.inner = untag_ptr(this_ptr);
64683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64685         this_ptr_conv.is_owned = false;
64686         LDKCVec_PathZ ret_var = Route_get_paths(&this_ptr_conv);
64687         int64_tArray ret_arr = NULL;
64688         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
64689         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
64690         for (size_t g = 0; g < ret_var.datalen; g++) {
64691                 LDKPath ret_conv_6_var = ret_var.data[g];
64692                 int64_t ret_conv_6_ref = 0;
64693                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
64694                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
64695                 ret_arr_ptr[g] = ret_conv_6_ref;
64696         }
64697         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
64698         FREE(ret_var.data);
64699         return ret_arr;
64700 }
64701
64702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
64703         LDKRoute this_ptr_conv;
64704         this_ptr_conv.inner = untag_ptr(this_ptr);
64705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64707         this_ptr_conv.is_owned = false;
64708         LDKCVec_PathZ val_constr;
64709         val_constr.datalen = (*env)->GetArrayLength(env, val);
64710         if (val_constr.datalen > 0)
64711                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
64712         else
64713                 val_constr.data = NULL;
64714         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
64715         for (size_t g = 0; g < val_constr.datalen; g++) {
64716                 int64_t val_conv_6 = val_vals[g];
64717                 LDKPath val_conv_6_conv;
64718                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
64719                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
64720                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
64721                 val_conv_6_conv = Path_clone(&val_conv_6_conv);
64722                 val_constr.data[g] = val_conv_6_conv;
64723         }
64724         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
64725         Route_set_paths(&this_ptr_conv, val_constr);
64726 }
64727
64728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1route_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
64729         LDKRoute this_ptr_conv;
64730         this_ptr_conv.inner = untag_ptr(this_ptr);
64731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64733         this_ptr_conv.is_owned = false;
64734         LDKRouteParameters ret_var = Route_get_route_params(&this_ptr_conv);
64735         int64_t ret_ref = 0;
64736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64738         return ret_ref;
64739 }
64740
64741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1route_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64742         LDKRoute this_ptr_conv;
64743         this_ptr_conv.inner = untag_ptr(this_ptr);
64744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64746         this_ptr_conv.is_owned = false;
64747         LDKRouteParameters val_conv;
64748         val_conv.inner = untag_ptr(val);
64749         val_conv.is_owned = ptr_is_owned(val);
64750         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64751         val_conv = RouteParameters_clone(&val_conv);
64752         Route_set_route_params(&this_ptr_conv, val_conv);
64753 }
64754
64755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, int64_tArray paths_arg, int64_t route_params_arg) {
64756         LDKCVec_PathZ paths_arg_constr;
64757         paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
64758         if (paths_arg_constr.datalen > 0)
64759                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
64760         else
64761                 paths_arg_constr.data = NULL;
64762         int64_t* paths_arg_vals = (*env)->GetLongArrayElements (env, paths_arg, NULL);
64763         for (size_t g = 0; g < paths_arg_constr.datalen; g++) {
64764                 int64_t paths_arg_conv_6 = paths_arg_vals[g];
64765                 LDKPath paths_arg_conv_6_conv;
64766                 paths_arg_conv_6_conv.inner = untag_ptr(paths_arg_conv_6);
64767                 paths_arg_conv_6_conv.is_owned = ptr_is_owned(paths_arg_conv_6);
64768                 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_6_conv);
64769                 paths_arg_conv_6_conv = Path_clone(&paths_arg_conv_6_conv);
64770                 paths_arg_constr.data[g] = paths_arg_conv_6_conv;
64771         }
64772         (*env)->ReleaseLongArrayElements(env, paths_arg, paths_arg_vals, 0);
64773         LDKRouteParameters route_params_arg_conv;
64774         route_params_arg_conv.inner = untag_ptr(route_params_arg);
64775         route_params_arg_conv.is_owned = ptr_is_owned(route_params_arg);
64776         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_arg_conv);
64777         route_params_arg_conv = RouteParameters_clone(&route_params_arg_conv);
64778         LDKRoute ret_var = Route_new(paths_arg_constr, route_params_arg_conv);
64779         int64_t ret_ref = 0;
64780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64782         return ret_ref;
64783 }
64784
64785 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
64786         LDKRoute ret_var = Route_clone(arg);
64787         int64_t ret_ref = 0;
64788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64789         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64790         return ret_ref;
64791 }
64792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64793         LDKRoute arg_conv;
64794         arg_conv.inner = untag_ptr(arg);
64795         arg_conv.is_owned = ptr_is_owned(arg);
64796         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64797         arg_conv.is_owned = false;
64798         int64_t ret_conv = Route_clone_ptr(&arg_conv);
64799         return ret_conv;
64800 }
64801
64802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64803         LDKRoute orig_conv;
64804         orig_conv.inner = untag_ptr(orig);
64805         orig_conv.is_owned = ptr_is_owned(orig);
64806         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64807         orig_conv.is_owned = false;
64808         LDKRoute ret_var = Route_clone(&orig_conv);
64809         int64_t ret_ref = 0;
64810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64811         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64812         return ret_ref;
64813 }
64814
64815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
64816         LDKRoute o_conv;
64817         o_conv.inner = untag_ptr(o);
64818         o_conv.is_owned = ptr_is_owned(o);
64819         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64820         o_conv.is_owned = false;
64821         int64_t ret_conv = Route_hash(&o_conv);
64822         return ret_conv;
64823 }
64824
64825 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64826         LDKRoute a_conv;
64827         a_conv.inner = untag_ptr(a);
64828         a_conv.is_owned = ptr_is_owned(a);
64829         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64830         a_conv.is_owned = false;
64831         LDKRoute b_conv;
64832         b_conv.inner = untag_ptr(b);
64833         b_conv.is_owned = ptr_is_owned(b);
64834         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64835         b_conv.is_owned = false;
64836         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
64837         return ret_conv;
64838 }
64839
64840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
64841         LDKRoute this_arg_conv;
64842         this_arg_conv.inner = untag_ptr(this_arg);
64843         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64845         this_arg_conv.is_owned = false;
64846         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
64847         return ret_conv;
64848 }
64849
64850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
64851         LDKRoute this_arg_conv;
64852         this_arg_conv.inner = untag_ptr(this_arg);
64853         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64855         this_arg_conv.is_owned = false;
64856         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
64857         return ret_conv;
64858 }
64859
64860 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
64861         LDKRoute obj_conv;
64862         obj_conv.inner = untag_ptr(obj);
64863         obj_conv.is_owned = ptr_is_owned(obj);
64864         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64865         obj_conv.is_owned = false;
64866         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
64867         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64868         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64869         CVec_u8Z_free(ret_var);
64870         return ret_arr;
64871 }
64872
64873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64874         LDKu8slice ser_ref;
64875         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64876         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64877         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
64878         *ret_conv = Route_read(ser_ref);
64879         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64880         return tag_ptr(ret_conv, true);
64881 }
64882
64883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64884         LDKRouteParameters this_obj_conv;
64885         this_obj_conv.inner = untag_ptr(this_obj);
64886         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64888         RouteParameters_free(this_obj_conv);
64889 }
64890
64891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
64892         LDKRouteParameters this_ptr_conv;
64893         this_ptr_conv.inner = untag_ptr(this_ptr);
64894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64896         this_ptr_conv.is_owned = false;
64897         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
64898         int64_t ret_ref = 0;
64899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64901         return ret_ref;
64902 }
64903
64904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64905         LDKRouteParameters this_ptr_conv;
64906         this_ptr_conv.inner = untag_ptr(this_ptr);
64907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64909         this_ptr_conv.is_owned = false;
64910         LDKPaymentParameters val_conv;
64911         val_conv.inner = untag_ptr(val);
64912         val_conv.is_owned = ptr_is_owned(val);
64913         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64914         val_conv = PaymentParameters_clone(&val_conv);
64915         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
64916 }
64917
64918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
64919         LDKRouteParameters this_ptr_conv;
64920         this_ptr_conv.inner = untag_ptr(this_ptr);
64921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64923         this_ptr_conv.is_owned = false;
64924         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
64925         return ret_conv;
64926 }
64927
64928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64929         LDKRouteParameters this_ptr_conv;
64930         this_ptr_conv.inner = untag_ptr(this_ptr);
64931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64933         this_ptr_conv.is_owned = false;
64934         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
64935 }
64936
64937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1max_1total_1routing_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
64938         LDKRouteParameters this_ptr_conv;
64939         this_ptr_conv.inner = untag_ptr(this_ptr);
64940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64942         this_ptr_conv.is_owned = false;
64943         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
64944         *ret_copy = RouteParameters_get_max_total_routing_fee_msat(&this_ptr_conv);
64945         int64_t ret_ref = tag_ptr(ret_copy, true);
64946         return ret_ref;
64947 }
64948
64949 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) {
64950         LDKRouteParameters this_ptr_conv;
64951         this_ptr_conv.inner = untag_ptr(this_ptr);
64952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64954         this_ptr_conv.is_owned = false;
64955         void* val_ptr = untag_ptr(val);
64956         CHECK_ACCESS(val_ptr);
64957         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
64958         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
64959         RouteParameters_set_max_total_routing_fee_msat(&this_ptr_conv, val_conv);
64960 }
64961
64962 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) {
64963         LDKPaymentParameters payment_params_arg_conv;
64964         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
64965         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
64966         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
64967         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
64968         void* max_total_routing_fee_msat_arg_ptr = untag_ptr(max_total_routing_fee_msat_arg);
64969         CHECK_ACCESS(max_total_routing_fee_msat_arg_ptr);
64970         LDKCOption_u64Z max_total_routing_fee_msat_arg_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_arg_ptr);
64971         max_total_routing_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat_arg));
64972         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, max_total_routing_fee_msat_arg_conv);
64973         int64_t ret_ref = 0;
64974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64976         return ret_ref;
64977 }
64978
64979 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
64980         LDKRouteParameters ret_var = RouteParameters_clone(arg);
64981         int64_t ret_ref = 0;
64982         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64983         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64984         return ret_ref;
64985 }
64986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64987         LDKRouteParameters arg_conv;
64988         arg_conv.inner = untag_ptr(arg);
64989         arg_conv.is_owned = ptr_is_owned(arg);
64990         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64991         arg_conv.is_owned = false;
64992         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
64993         return ret_conv;
64994 }
64995
64996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64997         LDKRouteParameters orig_conv;
64998         orig_conv.inner = untag_ptr(orig);
64999         orig_conv.is_owned = ptr_is_owned(orig);
65000         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65001         orig_conv.is_owned = false;
65002         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
65003         int64_t ret_ref = 0;
65004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65006         return ret_ref;
65007 }
65008
65009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
65010         LDKRouteParameters o_conv;
65011         o_conv.inner = untag_ptr(o);
65012         o_conv.is_owned = ptr_is_owned(o);
65013         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65014         o_conv.is_owned = false;
65015         int64_t ret_conv = RouteParameters_hash(&o_conv);
65016         return ret_conv;
65017 }
65018
65019 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65020         LDKRouteParameters a_conv;
65021         a_conv.inner = untag_ptr(a);
65022         a_conv.is_owned = ptr_is_owned(a);
65023         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65024         a_conv.is_owned = false;
65025         LDKRouteParameters b_conv;
65026         b_conv.inner = untag_ptr(b);
65027         b_conv.is_owned = ptr_is_owned(b);
65028         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65029         b_conv.is_owned = false;
65030         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
65031         return ret_conv;
65032 }
65033
65034 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) {
65035         LDKPaymentParameters payment_params_conv;
65036         payment_params_conv.inner = untag_ptr(payment_params);
65037         payment_params_conv.is_owned = ptr_is_owned(payment_params);
65038         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_conv);
65039         payment_params_conv = PaymentParameters_clone(&payment_params_conv);
65040         LDKRouteParameters ret_var = RouteParameters_from_payment_params_and_value(payment_params_conv, final_value_msat);
65041         int64_t ret_ref = 0;
65042         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65043         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65044         return ret_ref;
65045 }
65046
65047 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
65048         LDKRouteParameters obj_conv;
65049         obj_conv.inner = untag_ptr(obj);
65050         obj_conv.is_owned = ptr_is_owned(obj);
65051         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65052         obj_conv.is_owned = false;
65053         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
65054         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65055         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65056         CVec_u8Z_free(ret_var);
65057         return ret_arr;
65058 }
65059
65060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
65061         LDKu8slice ser_ref;
65062         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
65063         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
65064         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
65065         *ret_conv = RouteParameters_read(ser_ref);
65066         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
65067         return tag_ptr(ret_conv, true);
65068 }
65069
65070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65071         LDKPaymentParameters this_obj_conv;
65072         this_obj_conv.inner = untag_ptr(this_obj);
65073         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65075         PaymentParameters_free(this_obj_conv);
65076 }
65077
65078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1payee(JNIEnv *env, jclass clz, int64_t this_ptr) {
65079         LDKPaymentParameters this_ptr_conv;
65080         this_ptr_conv.inner = untag_ptr(this_ptr);
65081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65083         this_ptr_conv.is_owned = false;
65084         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
65085         *ret_copy = PaymentParameters_get_payee(&this_ptr_conv);
65086         int64_t ret_ref = tag_ptr(ret_copy, true);
65087         return ret_ref;
65088 }
65089
65090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1payee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65091         LDKPaymentParameters this_ptr_conv;
65092         this_ptr_conv.inner = untag_ptr(this_ptr);
65093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65095         this_ptr_conv.is_owned = false;
65096         void* val_ptr = untag_ptr(val);
65097         CHECK_ACCESS(val_ptr);
65098         LDKPayee val_conv = *(LDKPayee*)(val_ptr);
65099         val_conv = Payee_clone((LDKPayee*)untag_ptr(val));
65100         PaymentParameters_set_payee(&this_ptr_conv, val_conv);
65101 }
65102
65103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) {
65104         LDKPaymentParameters this_ptr_conv;
65105         this_ptr_conv.inner = untag_ptr(this_ptr);
65106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65108         this_ptr_conv.is_owned = false;
65109         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65110         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
65111         int64_t ret_ref = tag_ptr(ret_copy, true);
65112         return ret_ref;
65113 }
65114
65115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65116         LDKPaymentParameters this_ptr_conv;
65117         this_ptr_conv.inner = untag_ptr(this_ptr);
65118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65120         this_ptr_conv.is_owned = false;
65121         void* val_ptr = untag_ptr(val);
65122         CHECK_ACCESS(val_ptr);
65123         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
65124         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
65125         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
65126 }
65127
65128 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
65129         LDKPaymentParameters this_ptr_conv;
65130         this_ptr_conv.inner = untag_ptr(this_ptr);
65131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65133         this_ptr_conv.is_owned = false;
65134         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
65135         return ret_conv;
65136 }
65137
65138 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) {
65139         LDKPaymentParameters this_ptr_conv;
65140         this_ptr_conv.inner = untag_ptr(this_ptr);
65141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65143         this_ptr_conv.is_owned = false;
65144         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
65145 }
65146
65147 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr) {
65148         LDKPaymentParameters this_ptr_conv;
65149         this_ptr_conv.inner = untag_ptr(this_ptr);
65150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65152         this_ptr_conv.is_owned = false;
65153         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
65154         return ret_conv;
65155 }
65156
65157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
65158         LDKPaymentParameters this_ptr_conv;
65159         this_ptr_conv.inner = untag_ptr(this_ptr);
65160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65162         this_ptr_conv.is_owned = false;
65163         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
65164 }
65165
65166 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) {
65167         LDKPaymentParameters this_ptr_conv;
65168         this_ptr_conv.inner = untag_ptr(this_ptr);
65169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65171         this_ptr_conv.is_owned = false;
65172         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
65173         return ret_conv;
65174 }
65175
65176 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) {
65177         LDKPaymentParameters this_ptr_conv;
65178         this_ptr_conv.inner = untag_ptr(this_ptr);
65179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65181         this_ptr_conv.is_owned = false;
65182         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
65183 }
65184
65185 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
65186         LDKPaymentParameters this_ptr_conv;
65187         this_ptr_conv.inner = untag_ptr(this_ptr);
65188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65190         this_ptr_conv.is_owned = false;
65191         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
65192         int64_tArray ret_arr = NULL;
65193         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
65194         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
65195         for (size_t g = 0; g < ret_var.datalen; g++) {
65196                 int64_t ret_conv_6_conv = ret_var.data[g];
65197                 ret_arr_ptr[g] = ret_conv_6_conv;
65198         }
65199         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
65200         FREE(ret_var.data);
65201         return ret_arr;
65202 }
65203
65204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
65205         LDKPaymentParameters this_ptr_conv;
65206         this_ptr_conv.inner = untag_ptr(this_ptr);
65207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65209         this_ptr_conv.is_owned = false;
65210         LDKCVec_u64Z val_constr;
65211         val_constr.datalen = (*env)->GetArrayLength(env, val);
65212         if (val_constr.datalen > 0)
65213                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
65214         else
65215                 val_constr.data = NULL;
65216         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
65217         for (size_t g = 0; g < val_constr.datalen; g++) {
65218                 int64_t val_conv_6 = val_vals[g];
65219                 val_constr.data[g] = val_conv_6;
65220         }
65221         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
65222         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
65223 }
65224
65225 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) {
65226         void* payee_arg_ptr = untag_ptr(payee_arg);
65227         CHECK_ACCESS(payee_arg_ptr);
65228         LDKPayee payee_arg_conv = *(LDKPayee*)(payee_arg_ptr);
65229         payee_arg_conv = Payee_clone((LDKPayee*)untag_ptr(payee_arg));
65230         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
65231         CHECK_ACCESS(expiry_time_arg_ptr);
65232         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
65233         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
65234         LDKCVec_u64Z previously_failed_channels_arg_constr;
65235         previously_failed_channels_arg_constr.datalen = (*env)->GetArrayLength(env, previously_failed_channels_arg);
65236         if (previously_failed_channels_arg_constr.datalen > 0)
65237                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
65238         else
65239                 previously_failed_channels_arg_constr.data = NULL;
65240         int64_t* previously_failed_channels_arg_vals = (*env)->GetLongArrayElements (env, previously_failed_channels_arg, NULL);
65241         for (size_t g = 0; g < previously_failed_channels_arg_constr.datalen; g++) {
65242                 int64_t previously_failed_channels_arg_conv_6 = previously_failed_channels_arg_vals[g];
65243                 previously_failed_channels_arg_constr.data[g] = previously_failed_channels_arg_conv_6;
65244         }
65245         (*env)->ReleaseLongArrayElements(env, previously_failed_channels_arg, previously_failed_channels_arg_vals, 0);
65246         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);
65247         int64_t ret_ref = 0;
65248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65250         return ret_ref;
65251 }
65252
65253 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
65254         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
65255         int64_t ret_ref = 0;
65256         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65257         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65258         return ret_ref;
65259 }
65260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65261         LDKPaymentParameters arg_conv;
65262         arg_conv.inner = untag_ptr(arg);
65263         arg_conv.is_owned = ptr_is_owned(arg);
65264         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65265         arg_conv.is_owned = false;
65266         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
65267         return ret_conv;
65268 }
65269
65270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65271         LDKPaymentParameters orig_conv;
65272         orig_conv.inner = untag_ptr(orig);
65273         orig_conv.is_owned = ptr_is_owned(orig);
65274         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65275         orig_conv.is_owned = false;
65276         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
65277         int64_t ret_ref = 0;
65278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65280         return ret_ref;
65281 }
65282
65283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
65284         LDKPaymentParameters o_conv;
65285         o_conv.inner = untag_ptr(o);
65286         o_conv.is_owned = ptr_is_owned(o);
65287         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65288         o_conv.is_owned = false;
65289         int64_t ret_conv = PaymentParameters_hash(&o_conv);
65290         return ret_conv;
65291 }
65292
65293 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65294         LDKPaymentParameters a_conv;
65295         a_conv.inner = untag_ptr(a);
65296         a_conv.is_owned = ptr_is_owned(a);
65297         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65298         a_conv.is_owned = false;
65299         LDKPaymentParameters b_conv;
65300         b_conv.inner = untag_ptr(b);
65301         b_conv.is_owned = ptr_is_owned(b);
65302         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65303         b_conv.is_owned = false;
65304         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
65305         return ret_conv;
65306 }
65307
65308 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
65309         LDKPaymentParameters obj_conv;
65310         obj_conv.inner = untag_ptr(obj);
65311         obj_conv.is_owned = ptr_is_owned(obj);
65312         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65313         obj_conv.is_owned = false;
65314         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
65315         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65316         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65317         CVec_u8Z_free(ret_var);
65318         return ret_arr;
65319 }
65320
65321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser, int32_t arg) {
65322         LDKu8slice ser_ref;
65323         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
65324         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
65325         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
65326         *ret_conv = PaymentParameters_read(ser_ref, arg);
65327         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
65328         return tag_ptr(ret_conv, true);
65329 }
65330
65331 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) {
65332         LDKPublicKey payee_pubkey_ref;
65333         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
65334         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
65335         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
65336         int64_t ret_ref = 0;
65337         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65338         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65339         return ret_ref;
65340 }
65341
65342 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) {
65343         LDKPublicKey payee_pubkey_ref;
65344         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
65345         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
65346         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta, allow_mpp);
65347         int64_t ret_ref = 0;
65348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65350         return ret_ref;
65351 }
65352
65353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1bolt12_1invoice(JNIEnv *env, jclass clz, int64_t invoice) {
65354         LDKBolt12Invoice invoice_conv;
65355         invoice_conv.inner = untag_ptr(invoice);
65356         invoice_conv.is_owned = ptr_is_owned(invoice);
65357         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
65358         invoice_conv.is_owned = false;
65359         LDKPaymentParameters ret_var = PaymentParameters_from_bolt12_invoice(&invoice_conv);
65360         int64_t ret_ref = 0;
65361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65363         return ret_ref;
65364 }
65365
65366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1blinded(JNIEnv *env, jclass clz, int64_tArray blinded_route_hints) {
65367         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded_route_hints_constr;
65368         blinded_route_hints_constr.datalen = (*env)->GetArrayLength(env, blinded_route_hints);
65369         if (blinded_route_hints_constr.datalen > 0)
65370                 blinded_route_hints_constr.data = MALLOC(blinded_route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
65371         else
65372                 blinded_route_hints_constr.data = NULL;
65373         int64_t* blinded_route_hints_vals = (*env)->GetLongArrayElements (env, blinded_route_hints, NULL);
65374         for (size_t l = 0; l < blinded_route_hints_constr.datalen; l++) {
65375                 int64_t blinded_route_hints_conv_37 = blinded_route_hints_vals[l];
65376                 void* blinded_route_hints_conv_37_ptr = untag_ptr(blinded_route_hints_conv_37);
65377                 CHECK_ACCESS(blinded_route_hints_conv_37_ptr);
65378                 LDKC2Tuple_BlindedPayInfoBlindedPathZ blinded_route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(blinded_route_hints_conv_37_ptr);
65379                 blinded_route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(blinded_route_hints_conv_37));
65380                 blinded_route_hints_constr.data[l] = blinded_route_hints_conv_37_conv;
65381         }
65382         (*env)->ReleaseLongArrayElements(env, blinded_route_hints, blinded_route_hints_vals, 0);
65383         LDKPaymentParameters ret_var = PaymentParameters_blinded(blinded_route_hints_constr);
65384         int64_t ret_ref = 0;
65385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65387         return ret_ref;
65388 }
65389
65390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
65391         if (!ptr_is_owned(this_ptr)) return;
65392         void* this_ptr_ptr = untag_ptr(this_ptr);
65393         CHECK_ACCESS(this_ptr_ptr);
65394         LDKPayee this_ptr_conv = *(LDKPayee*)(this_ptr_ptr);
65395         FREE(untag_ptr(this_ptr));
65396         Payee_free(this_ptr_conv);
65397 }
65398
65399 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
65400         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
65401         *ret_copy = Payee_clone(arg);
65402         int64_t ret_ref = tag_ptr(ret_copy, true);
65403         return ret_ref;
65404 }
65405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65406         LDKPayee* arg_conv = (LDKPayee*)untag_ptr(arg);
65407         int64_t ret_conv = Payee_clone_ptr(arg_conv);
65408         return ret_conv;
65409 }
65410
65411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65412         LDKPayee* orig_conv = (LDKPayee*)untag_ptr(orig);
65413         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
65414         *ret_copy = Payee_clone(orig_conv);
65415         int64_t ret_ref = tag_ptr(ret_copy, true);
65416         return ret_ref;
65417 }
65418
65419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1blinded(JNIEnv *env, jclass clz, int64_tArray route_hints, int64_t features) {
65420         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_constr;
65421         route_hints_constr.datalen = (*env)->GetArrayLength(env, route_hints);
65422         if (route_hints_constr.datalen > 0)
65423                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
65424         else
65425                 route_hints_constr.data = NULL;
65426         int64_t* route_hints_vals = (*env)->GetLongArrayElements (env, route_hints, NULL);
65427         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
65428                 int64_t route_hints_conv_37 = route_hints_vals[l];
65429                 void* route_hints_conv_37_ptr = untag_ptr(route_hints_conv_37);
65430                 CHECK_ACCESS(route_hints_conv_37_ptr);
65431                 LDKC2Tuple_BlindedPayInfoBlindedPathZ route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(route_hints_conv_37_ptr);
65432                 route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(route_hints_conv_37));
65433                 route_hints_constr.data[l] = route_hints_conv_37_conv;
65434         }
65435         (*env)->ReleaseLongArrayElements(env, route_hints, route_hints_vals, 0);
65436         LDKBolt12InvoiceFeatures features_conv;
65437         features_conv.inner = untag_ptr(features);
65438         features_conv.is_owned = ptr_is_owned(features);
65439         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
65440         features_conv = Bolt12InvoiceFeatures_clone(&features_conv);
65441         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
65442         *ret_copy = Payee_blinded(route_hints_constr, features_conv);
65443         int64_t ret_ref = tag_ptr(ret_copy, true);
65444         return ret_ref;
65445 }
65446
65447 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) {
65448         LDKPublicKey node_id_ref;
65449         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65450         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65451         LDKCVec_RouteHintZ route_hints_constr;
65452         route_hints_constr.datalen = (*env)->GetArrayLength(env, route_hints);
65453         if (route_hints_constr.datalen > 0)
65454                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
65455         else
65456                 route_hints_constr.data = NULL;
65457         int64_t* route_hints_vals = (*env)->GetLongArrayElements (env, route_hints, NULL);
65458         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
65459                 int64_t route_hints_conv_11 = route_hints_vals[l];
65460                 LDKRouteHint route_hints_conv_11_conv;
65461                 route_hints_conv_11_conv.inner = untag_ptr(route_hints_conv_11);
65462                 route_hints_conv_11_conv.is_owned = ptr_is_owned(route_hints_conv_11);
65463                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_conv);
65464                 route_hints_conv_11_conv = RouteHint_clone(&route_hints_conv_11_conv);
65465                 route_hints_constr.data[l] = route_hints_conv_11_conv;
65466         }
65467         (*env)->ReleaseLongArrayElements(env, route_hints, route_hints_vals, 0);
65468         LDKBolt11InvoiceFeatures features_conv;
65469         features_conv.inner = untag_ptr(features);
65470         features_conv.is_owned = ptr_is_owned(features);
65471         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
65472         features_conv = Bolt11InvoiceFeatures_clone(&features_conv);
65473         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
65474         *ret_copy = Payee_clear(node_id_ref, route_hints_constr, features_conv, final_cltv_expiry_delta);
65475         int64_t ret_ref = tag_ptr(ret_copy, true);
65476         return ret_ref;
65477 }
65478
65479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1hash(JNIEnv *env, jclass clz, int64_t o) {
65480         LDKPayee* o_conv = (LDKPayee*)untag_ptr(o);
65481         int64_t ret_conv = Payee_hash(o_conv);
65482         return ret_conv;
65483 }
65484
65485 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Payee_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65486         LDKPayee* a_conv = (LDKPayee*)untag_ptr(a);
65487         LDKPayee* b_conv = (LDKPayee*)untag_ptr(b);
65488         jboolean ret_conv = Payee_eq(a_conv, b_conv);
65489         return ret_conv;
65490 }
65491
65492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65493         LDKRouteHint this_obj_conv;
65494         this_obj_conv.inner = untag_ptr(this_obj);
65495         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65497         RouteHint_free(this_obj_conv);
65498 }
65499
65500 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
65501         LDKRouteHint this_ptr_conv;
65502         this_ptr_conv.inner = untag_ptr(this_ptr);
65503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65505         this_ptr_conv.is_owned = false;
65506         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
65507         int64_tArray ret_arr = NULL;
65508         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
65509         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
65510         for (size_t o = 0; o < ret_var.datalen; o++) {
65511                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
65512                 int64_t ret_conv_14_ref = 0;
65513                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
65514                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
65515                 ret_arr_ptr[o] = ret_conv_14_ref;
65516         }
65517         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
65518         FREE(ret_var.data);
65519         return ret_arr;
65520 }
65521
65522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
65523         LDKRouteHint this_ptr_conv;
65524         this_ptr_conv.inner = untag_ptr(this_ptr);
65525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65527         this_ptr_conv.is_owned = false;
65528         LDKCVec_RouteHintHopZ val_constr;
65529         val_constr.datalen = (*env)->GetArrayLength(env, val);
65530         if (val_constr.datalen > 0)
65531                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
65532         else
65533                 val_constr.data = NULL;
65534         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
65535         for (size_t o = 0; o < val_constr.datalen; o++) {
65536                 int64_t val_conv_14 = val_vals[o];
65537                 LDKRouteHintHop val_conv_14_conv;
65538                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
65539                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
65540                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
65541                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
65542                 val_constr.data[o] = val_conv_14_conv;
65543         }
65544         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
65545         RouteHint_set_a(&this_ptr_conv, val_constr);
65546 }
65547
65548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int64_tArray a_arg) {
65549         LDKCVec_RouteHintHopZ a_arg_constr;
65550         a_arg_constr.datalen = (*env)->GetArrayLength(env, a_arg);
65551         if (a_arg_constr.datalen > 0)
65552                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
65553         else
65554                 a_arg_constr.data = NULL;
65555         int64_t* a_arg_vals = (*env)->GetLongArrayElements (env, a_arg, NULL);
65556         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
65557                 int64_t a_arg_conv_14 = a_arg_vals[o];
65558                 LDKRouteHintHop a_arg_conv_14_conv;
65559                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
65560                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
65561                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
65562                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
65563                 a_arg_constr.data[o] = a_arg_conv_14_conv;
65564         }
65565         (*env)->ReleaseLongArrayElements(env, a_arg, a_arg_vals, 0);
65566         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
65567         int64_t ret_ref = 0;
65568         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65569         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65570         return ret_ref;
65571 }
65572
65573 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
65574         LDKRouteHint ret_var = RouteHint_clone(arg);
65575         int64_t ret_ref = 0;
65576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65578         return ret_ref;
65579 }
65580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65581         LDKRouteHint arg_conv;
65582         arg_conv.inner = untag_ptr(arg);
65583         arg_conv.is_owned = ptr_is_owned(arg);
65584         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65585         arg_conv.is_owned = false;
65586         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
65587         return ret_conv;
65588 }
65589
65590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65591         LDKRouteHint orig_conv;
65592         orig_conv.inner = untag_ptr(orig);
65593         orig_conv.is_owned = ptr_is_owned(orig);
65594         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65595         orig_conv.is_owned = false;
65596         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
65597         int64_t ret_ref = 0;
65598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65600         return ret_ref;
65601 }
65602
65603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
65604         LDKRouteHint o_conv;
65605         o_conv.inner = untag_ptr(o);
65606         o_conv.is_owned = ptr_is_owned(o);
65607         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65608         o_conv.is_owned = false;
65609         int64_t ret_conv = RouteHint_hash(&o_conv);
65610         return ret_conv;
65611 }
65612
65613 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65614         LDKRouteHint a_conv;
65615         a_conv.inner = untag_ptr(a);
65616         a_conv.is_owned = ptr_is_owned(a);
65617         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65618         a_conv.is_owned = false;
65619         LDKRouteHint b_conv;
65620         b_conv.inner = untag_ptr(b);
65621         b_conv.is_owned = ptr_is_owned(b);
65622         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65623         b_conv.is_owned = false;
65624         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
65625         return ret_conv;
65626 }
65627
65628 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1write(JNIEnv *env, jclass clz, int64_t obj) {
65629         LDKRouteHint obj_conv;
65630         obj_conv.inner = untag_ptr(obj);
65631         obj_conv.is_owned = ptr_is_owned(obj);
65632         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65633         obj_conv.is_owned = false;
65634         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
65635         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65636         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65637         CVec_u8Z_free(ret_var);
65638         return ret_arr;
65639 }
65640
65641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
65642         LDKu8slice ser_ref;
65643         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
65644         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
65645         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
65646         *ret_conv = RouteHint_read(ser_ref);
65647         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
65648         return tag_ptr(ret_conv, true);
65649 }
65650
65651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65652         LDKRouteHintHop this_obj_conv;
65653         this_obj_conv.inner = untag_ptr(this_obj);
65654         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65656         RouteHintHop_free(this_obj_conv);
65657 }
65658
65659 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
65660         LDKRouteHintHop this_ptr_conv;
65661         this_ptr_conv.inner = untag_ptr(this_ptr);
65662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65664         this_ptr_conv.is_owned = false;
65665         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
65666         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
65667         return ret_arr;
65668 }
65669
65670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
65671         LDKRouteHintHop this_ptr_conv;
65672         this_ptr_conv.inner = untag_ptr(this_ptr);
65673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65675         this_ptr_conv.is_owned = false;
65676         LDKPublicKey val_ref;
65677         CHECK((*env)->GetArrayLength(env, val) == 33);
65678         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
65679         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
65680 }
65681
65682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
65683         LDKRouteHintHop this_ptr_conv;
65684         this_ptr_conv.inner = untag_ptr(this_ptr);
65685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65687         this_ptr_conv.is_owned = false;
65688         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
65689         return ret_conv;
65690 }
65691
65692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65693         LDKRouteHintHop this_ptr_conv;
65694         this_ptr_conv.inner = untag_ptr(this_ptr);
65695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65697         this_ptr_conv.is_owned = false;
65698         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
65699 }
65700
65701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
65702         LDKRouteHintHop this_ptr_conv;
65703         this_ptr_conv.inner = untag_ptr(this_ptr);
65704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65706         this_ptr_conv.is_owned = false;
65707         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
65708         int64_t ret_ref = 0;
65709         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65710         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65711         return ret_ref;
65712 }
65713
65714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65715         LDKRouteHintHop 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         LDKRoutingFees val_conv;
65721         val_conv.inner = untag_ptr(val);
65722         val_conv.is_owned = ptr_is_owned(val);
65723         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65724         val_conv = RoutingFees_clone(&val_conv);
65725         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
65726 }
65727
65728 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
65729         LDKRouteHintHop this_ptr_conv;
65730         this_ptr_conv.inner = untag_ptr(this_ptr);
65731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65733         this_ptr_conv.is_owned = false;
65734         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
65735         return ret_conv;
65736 }
65737
65738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
65739         LDKRouteHintHop this_ptr_conv;
65740         this_ptr_conv.inner = untag_ptr(this_ptr);
65741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65743         this_ptr_conv.is_owned = false;
65744         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
65745 }
65746
65747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65748         LDKRouteHintHop this_ptr_conv;
65749         this_ptr_conv.inner = untag_ptr(this_ptr);
65750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65752         this_ptr_conv.is_owned = false;
65753         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65754         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
65755         int64_t ret_ref = tag_ptr(ret_copy, true);
65756         return ret_ref;
65757 }
65758
65759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65760         LDKRouteHintHop this_ptr_conv;
65761         this_ptr_conv.inner = untag_ptr(this_ptr);
65762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65764         this_ptr_conv.is_owned = false;
65765         void* val_ptr = untag_ptr(val);
65766         CHECK_ACCESS(val_ptr);
65767         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
65768         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
65769         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
65770 }
65771
65772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65773         LDKRouteHintHop this_ptr_conv;
65774         this_ptr_conv.inner = untag_ptr(this_ptr);
65775         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65777         this_ptr_conv.is_owned = false;
65778         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65779         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
65780         int64_t ret_ref = tag_ptr(ret_copy, true);
65781         return ret_ref;
65782 }
65783
65784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65785         LDKRouteHintHop this_ptr_conv;
65786         this_ptr_conv.inner = untag_ptr(this_ptr);
65787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65789         this_ptr_conv.is_owned = false;
65790         void* val_ptr = untag_ptr(val);
65791         CHECK_ACCESS(val_ptr);
65792         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
65793         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
65794         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
65795 }
65796
65797 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) {
65798         LDKPublicKey src_node_id_arg_ref;
65799         CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
65800         (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
65801         LDKRoutingFees fees_arg_conv;
65802         fees_arg_conv.inner = untag_ptr(fees_arg);
65803         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
65804         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
65805         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
65806         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
65807         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
65808         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
65809         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
65810         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
65811         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
65812         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
65813         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
65814         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);
65815         int64_t ret_ref = 0;
65816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65818         return ret_ref;
65819 }
65820
65821 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
65822         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
65823         int64_t ret_ref = 0;
65824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65826         return ret_ref;
65827 }
65828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65829         LDKRouteHintHop arg_conv;
65830         arg_conv.inner = untag_ptr(arg);
65831         arg_conv.is_owned = ptr_is_owned(arg);
65832         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65833         arg_conv.is_owned = false;
65834         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
65835         return ret_conv;
65836 }
65837
65838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65839         LDKRouteHintHop orig_conv;
65840         orig_conv.inner = untag_ptr(orig);
65841         orig_conv.is_owned = ptr_is_owned(orig);
65842         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65843         orig_conv.is_owned = false;
65844         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
65845         int64_t ret_ref = 0;
65846         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65847         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65848         return ret_ref;
65849 }
65850
65851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
65852         LDKRouteHintHop o_conv;
65853         o_conv.inner = untag_ptr(o);
65854         o_conv.is_owned = ptr_is_owned(o);
65855         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65856         o_conv.is_owned = false;
65857         int64_t ret_conv = RouteHintHop_hash(&o_conv);
65858         return ret_conv;
65859 }
65860
65861 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65862         LDKRouteHintHop a_conv;
65863         a_conv.inner = untag_ptr(a);
65864         a_conv.is_owned = ptr_is_owned(a);
65865         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65866         a_conv.is_owned = false;
65867         LDKRouteHintHop b_conv;
65868         b_conv.inner = untag_ptr(b);
65869         b_conv.is_owned = ptr_is_owned(b);
65870         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65871         b_conv.is_owned = false;
65872         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
65873         return ret_conv;
65874 }
65875
65876 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
65877         LDKRouteHintHop obj_conv;
65878         obj_conv.inner = untag_ptr(obj);
65879         obj_conv.is_owned = ptr_is_owned(obj);
65880         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65881         obj_conv.is_owned = false;
65882         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
65883         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65884         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65885         CVec_u8Z_free(ret_var);
65886         return ret_arr;
65887 }
65888
65889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
65890         LDKu8slice ser_ref;
65891         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
65892         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
65893         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
65894         *ret_conv = RouteHintHop_read(ser_ref);
65895         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
65896         return tag_ptr(ret_conv, true);
65897 }
65898
65899 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) {
65900         LDKPublicKey our_node_pubkey_ref;
65901         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
65902         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
65903         LDKRouteParameters route_params_conv;
65904         route_params_conv.inner = untag_ptr(route_params);
65905         route_params_conv.is_owned = ptr_is_owned(route_params);
65906         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
65907         route_params_conv.is_owned = false;
65908         LDKNetworkGraph network_graph_conv;
65909         network_graph_conv.inner = untag_ptr(network_graph);
65910         network_graph_conv.is_owned = ptr_is_owned(network_graph);
65911         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
65912         network_graph_conv.is_owned = false;
65913         LDKCVec_ChannelDetailsZ first_hops_constr;
65914         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
65915         if (first_hops != NULL) {
65916                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
65917                 if (first_hops_constr.datalen > 0)
65918                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
65919                 else
65920                         first_hops_constr.data = NULL;
65921                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
65922                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
65923                         int64_t first_hops_conv_16 = first_hops_vals[q];
65924                         LDKChannelDetails first_hops_conv_16_conv;
65925                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
65926                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
65927                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
65928                         first_hops_conv_16_conv.is_owned = false;
65929                         first_hops_constr.data[q] = first_hops_conv_16_conv;
65930                 }
65931                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
65932                 first_hops_ptr = &first_hops_constr;
65933         }
65934         void* logger_ptr = untag_ptr(logger);
65935         CHECK_ACCESS(logger_ptr);
65936         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
65937         if (logger_conv.free == LDKLogger_JCalls_free) {
65938                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
65939                 LDKLogger_JCalls_cloned(&logger_conv);
65940         }
65941         void* scorer_ptr = untag_ptr(scorer);
65942         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
65943         LDKScoreLookUp* scorer_conv = (LDKScoreLookUp*)scorer_ptr;
65944         LDKProbabilisticScoringFeeParameters score_params_conv;
65945         score_params_conv.inner = untag_ptr(score_params);
65946         score_params_conv.is_owned = ptr_is_owned(score_params);
65947         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
65948         score_params_conv.is_owned = false;
65949         uint8_t random_seed_bytes_arr[32];
65950         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
65951         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
65952         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
65953         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
65954         *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);
65955         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
65956         return tag_ptr(ret_conv, true);
65957 }
65958
65959 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) {
65960         LDKPublicKey our_node_pubkey_ref;
65961         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
65962         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
65963         LDKCVec_PublicKeyZ hops_constr;
65964         hops_constr.datalen = (*env)->GetArrayLength(env, hops);
65965         if (hops_constr.datalen > 0)
65966                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
65967         else
65968                 hops_constr.data = NULL;
65969         for (size_t i = 0; i < hops_constr.datalen; i++) {
65970                 int8_tArray hops_conv_8 = (*env)->GetObjectArrayElement(env, hops, i);
65971                 LDKPublicKey hops_conv_8_ref;
65972                 CHECK((*env)->GetArrayLength(env, hops_conv_8) == 33);
65973                 (*env)->GetByteArrayRegion(env, hops_conv_8, 0, 33, hops_conv_8_ref.compressed_form);
65974                 hops_constr.data[i] = hops_conv_8_ref;
65975         }
65976         LDKRouteParameters route_params_conv;
65977         route_params_conv.inner = untag_ptr(route_params);
65978         route_params_conv.is_owned = ptr_is_owned(route_params);
65979         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
65980         route_params_conv.is_owned = false;
65981         LDKNetworkGraph network_graph_conv;
65982         network_graph_conv.inner = untag_ptr(network_graph);
65983         network_graph_conv.is_owned = ptr_is_owned(network_graph);
65984         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
65985         network_graph_conv.is_owned = false;
65986         void* logger_ptr = untag_ptr(logger);
65987         CHECK_ACCESS(logger_ptr);
65988         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
65989         if (logger_conv.free == LDKLogger_JCalls_free) {
65990                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
65991                 LDKLogger_JCalls_cloned(&logger_conv);
65992         }
65993         uint8_t random_seed_bytes_arr[32];
65994         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
65995         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
65996         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
65997         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
65998         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
65999         return tag_ptr(ret_conv, true);
66000 }
66001
66002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreLookUp_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
66003         if (!ptr_is_owned(this_ptr)) return;
66004         void* this_ptr_ptr = untag_ptr(this_ptr);
66005         CHECK_ACCESS(this_ptr_ptr);
66006         LDKScoreLookUp this_ptr_conv = *(LDKScoreLookUp*)(this_ptr_ptr);
66007         FREE(untag_ptr(this_ptr));
66008         ScoreLookUp_free(this_ptr_conv);
66009 }
66010
66011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
66012         if (!ptr_is_owned(this_ptr)) return;
66013         void* this_ptr_ptr = untag_ptr(this_ptr);
66014         CHECK_ACCESS(this_ptr_ptr);
66015         LDKScoreUpdate this_ptr_conv = *(LDKScoreUpdate*)(this_ptr_ptr);
66016         FREE(untag_ptr(this_ptr));
66017         ScoreUpdate_free(this_ptr_conv);
66018 }
66019
66020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
66021         if (!ptr_is_owned(this_ptr)) return;
66022         void* this_ptr_ptr = untag_ptr(this_ptr);
66023         CHECK_ACCESS(this_ptr_ptr);
66024         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
66025         FREE(untag_ptr(this_ptr));
66026         Score_free(this_ptr_conv);
66027 }
66028
66029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
66030         if (!ptr_is_owned(this_ptr)) return;
66031         void* this_ptr_ptr = untag_ptr(this_ptr);
66032         CHECK_ACCESS(this_ptr_ptr);
66033         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
66034         FREE(untag_ptr(this_ptr));
66035         LockableScore_free(this_ptr_conv);
66036 }
66037
66038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WriteableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
66039         if (!ptr_is_owned(this_ptr)) return;
66040         void* this_ptr_ptr = untag_ptr(this_ptr);
66041         CHECK_ACCESS(this_ptr_ptr);
66042         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
66043         FREE(untag_ptr(this_ptr));
66044         WriteableScore_free(this_ptr_conv);
66045 }
66046
66047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66048         LDKMultiThreadedLockableScore this_obj_conv;
66049         this_obj_conv.inner = untag_ptr(this_obj);
66050         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66052         MultiThreadedLockableScore_free(this_obj_conv);
66053 }
66054
66055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1as_1LockableScore(JNIEnv *env, jclass clz, int64_t this_arg) {
66056         LDKMultiThreadedLockableScore this_arg_conv;
66057         this_arg_conv.inner = untag_ptr(this_arg);
66058         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66060         this_arg_conv.is_owned = false;
66061         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
66062         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
66063         return tag_ptr(ret_ret, true);
66064 }
66065
66066 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1write(JNIEnv *env, jclass clz, int64_t obj) {
66067         LDKMultiThreadedLockableScore obj_conv;
66068         obj_conv.inner = untag_ptr(obj);
66069         obj_conv.is_owned = ptr_is_owned(obj);
66070         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66071         obj_conv.is_owned = false;
66072         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
66073         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66074         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66075         CVec_u8Z_free(ret_var);
66076         return ret_arr;
66077 }
66078
66079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1as_1WriteableScore(JNIEnv *env, jclass clz, int64_t this_arg) {
66080         LDKMultiThreadedLockableScore this_arg_conv;
66081         this_arg_conv.inner = untag_ptr(this_arg);
66082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66084         this_arg_conv.is_owned = false;
66085         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
66086         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
66087         return tag_ptr(ret_ret, true);
66088 }
66089
66090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1new(JNIEnv *env, jclass clz, int64_t score) {
66091         void* score_ptr = untag_ptr(score);
66092         CHECK_ACCESS(score_ptr);
66093         LDKScore score_conv = *(LDKScore*)(score_ptr);
66094         if (score_conv.free == LDKScore_JCalls_free) {
66095                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66096                 LDKScore_JCalls_cloned(&score_conv);
66097         }
66098         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
66099         int64_t ret_ref = 0;
66100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66102         return ret_ref;
66103 }
66104
66105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockRead_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66106         LDKMultiThreadedScoreLockRead this_obj_conv;
66107         this_obj_conv.inner = untag_ptr(this_obj);
66108         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66110         MultiThreadedScoreLockRead_free(this_obj_conv);
66111 }
66112
66113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockWrite_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66114         LDKMultiThreadedScoreLockWrite this_obj_conv;
66115         this_obj_conv.inner = untag_ptr(this_obj);
66116         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66118         MultiThreadedScoreLockWrite_free(this_obj_conv);
66119 }
66120
66121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockRead_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
66122         LDKMultiThreadedScoreLockRead 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         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
66128         *ret_ret = MultiThreadedScoreLockRead_as_ScoreLookUp(&this_arg_conv);
66129         return tag_ptr(ret_ret, true);
66130 }
66131
66132 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockWrite_1write(JNIEnv *env, jclass clz, int64_t obj) {
66133         LDKMultiThreadedScoreLockWrite obj_conv;
66134         obj_conv.inner = untag_ptr(obj);
66135         obj_conv.is_owned = ptr_is_owned(obj);
66136         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66137         obj_conv.is_owned = false;
66138         LDKCVec_u8Z ret_var = MultiThreadedScoreLockWrite_write(&obj_conv);
66139         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66140         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66141         CVec_u8Z_free(ret_var);
66142         return ret_arr;
66143 }
66144
66145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockWrite_1as_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t this_arg) {
66146         LDKMultiThreadedScoreLockWrite this_arg_conv;
66147         this_arg_conv.inner = untag_ptr(this_arg);
66148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66150         this_arg_conv.is_owned = false;
66151         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
66152         *ret_ret = MultiThreadedScoreLockWrite_as_ScoreUpdate(&this_arg_conv);
66153         return tag_ptr(ret_ret, true);
66154 }
66155
66156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66157         LDKChannelUsage this_obj_conv;
66158         this_obj_conv.inner = untag_ptr(this_obj);
66159         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66161         ChannelUsage_free(this_obj_conv);
66162 }
66163
66164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
66165         LDKChannelUsage this_ptr_conv;
66166         this_ptr_conv.inner = untag_ptr(this_ptr);
66167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66169         this_ptr_conv.is_owned = false;
66170         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
66171         return ret_conv;
66172 }
66173
66174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66175         LDKChannelUsage this_ptr_conv;
66176         this_ptr_conv.inner = untag_ptr(this_ptr);
66177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66179         this_ptr_conv.is_owned = false;
66180         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
66181 }
66182
66183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
66184         LDKChannelUsage this_ptr_conv;
66185         this_ptr_conv.inner = untag_ptr(this_ptr);
66186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66188         this_ptr_conv.is_owned = false;
66189         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
66190         return ret_conv;
66191 }
66192
66193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66194         LDKChannelUsage this_ptr_conv;
66195         this_ptr_conv.inner = untag_ptr(this_ptr);
66196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66198         this_ptr_conv.is_owned = false;
66199         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
66200 }
66201
66202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr) {
66203         LDKChannelUsage this_ptr_conv;
66204         this_ptr_conv.inner = untag_ptr(this_ptr);
66205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66207         this_ptr_conv.is_owned = false;
66208         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
66209         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
66210         int64_t ret_ref = tag_ptr(ret_copy, true);
66211         return ret_ref;
66212 }
66213
66214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66215         LDKChannelUsage this_ptr_conv;
66216         this_ptr_conv.inner = untag_ptr(this_ptr);
66217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66219         this_ptr_conv.is_owned = false;
66220         void* val_ptr = untag_ptr(val);
66221         CHECK_ACCESS(val_ptr);
66222         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
66223         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
66224         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
66225 }
66226
66227 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) {
66228         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
66229         CHECK_ACCESS(effective_capacity_arg_ptr);
66230         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
66231         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
66232         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
66233         int64_t ret_ref = 0;
66234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66236         return ret_ref;
66237 }
66238
66239 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
66240         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
66241         int64_t ret_ref = 0;
66242         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66243         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66244         return ret_ref;
66245 }
66246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66247         LDKChannelUsage arg_conv;
66248         arg_conv.inner = untag_ptr(arg);
66249         arg_conv.is_owned = ptr_is_owned(arg);
66250         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66251         arg_conv.is_owned = false;
66252         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
66253         return ret_conv;
66254 }
66255
66256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66257         LDKChannelUsage orig_conv;
66258         orig_conv.inner = untag_ptr(orig);
66259         orig_conv.is_owned = ptr_is_owned(orig);
66260         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66261         orig_conv.is_owned = false;
66262         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
66263         int64_t ret_ref = 0;
66264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66266         return ret_ref;
66267 }
66268
66269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66270         LDKFixedPenaltyScorer this_obj_conv;
66271         this_obj_conv.inner = untag_ptr(this_obj);
66272         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66274         FixedPenaltyScorer_free(this_obj_conv);
66275 }
66276
66277 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
66278         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
66279         int64_t ret_ref = 0;
66280         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66281         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66282         return ret_ref;
66283 }
66284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66285         LDKFixedPenaltyScorer arg_conv;
66286         arg_conv.inner = untag_ptr(arg);
66287         arg_conv.is_owned = ptr_is_owned(arg);
66288         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66289         arg_conv.is_owned = false;
66290         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
66291         return ret_conv;
66292 }
66293
66294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66295         LDKFixedPenaltyScorer orig_conv;
66296         orig_conv.inner = untag_ptr(orig);
66297         orig_conv.is_owned = ptr_is_owned(orig);
66298         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66299         orig_conv.is_owned = false;
66300         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
66301         int64_t ret_ref = 0;
66302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66304         return ret_ref;
66305 }
66306
66307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty(JNIEnv *env, jclass clz, int64_t penalty_msat) {
66308         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
66309         int64_t ret_ref = 0;
66310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66312         return ret_ref;
66313 }
66314
66315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
66316         LDKFixedPenaltyScorer this_arg_conv;
66317         this_arg_conv.inner = untag_ptr(this_arg);
66318         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66320         this_arg_conv.is_owned = false;
66321         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
66322         *ret_ret = FixedPenaltyScorer_as_ScoreLookUp(&this_arg_conv);
66323         return tag_ptr(ret_ret, true);
66324 }
66325
66326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t this_arg) {
66327         LDKFixedPenaltyScorer this_arg_conv;
66328         this_arg_conv.inner = untag_ptr(this_arg);
66329         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66331         this_arg_conv.is_owned = false;
66332         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
66333         *ret_ret = FixedPenaltyScorer_as_ScoreUpdate(&this_arg_conv);
66334         return tag_ptr(ret_ret, true);
66335 }
66336
66337 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
66338         LDKFixedPenaltyScorer obj_conv;
66339         obj_conv.inner = untag_ptr(obj);
66340         obj_conv.is_owned = ptr_is_owned(obj);
66341         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66342         obj_conv.is_owned = false;
66343         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
66344         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66345         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66346         CVec_u8Z_free(ret_var);
66347         return ret_arr;
66348 }
66349
66350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
66351         LDKu8slice ser_ref;
66352         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
66353         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
66354         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
66355         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
66356         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
66357         return tag_ptr(ret_conv, true);
66358 }
66359
66360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66361         LDKProbabilisticScorer this_obj_conv;
66362         this_obj_conv.inner = untag_ptr(this_obj);
66363         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66365         ProbabilisticScorer_free(this_obj_conv);
66366 }
66367
66368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66369         LDKProbabilisticScoringFeeParameters this_obj_conv;
66370         this_obj_conv.inner = untag_ptr(this_obj);
66371         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66373         ProbabilisticScoringFeeParameters_free(this_obj_conv);
66374 }
66375
66376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
66377         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66378         this_ptr_conv.inner = untag_ptr(this_ptr);
66379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66381         this_ptr_conv.is_owned = false;
66382         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_msat(&this_ptr_conv);
66383         return ret_conv;
66384 }
66385
66386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66387         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66388         this_ptr_conv.inner = untag_ptr(this_ptr);
66389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66391         this_ptr_conv.is_owned = false;
66392         ProbabilisticScoringFeeParameters_set_base_penalty_msat(&this_ptr_conv, val);
66393 }
66394
66395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1base_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
66396         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66397         this_ptr_conv.inner = untag_ptr(this_ptr);
66398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66400         this_ptr_conv.is_owned = false;
66401         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
66402         return ret_conv;
66403 }
66404
66405 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) {
66406         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66407         this_ptr_conv.inner = untag_ptr(this_ptr);
66408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66410         this_ptr_conv.is_owned = false;
66411         ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
66412 }
66413
66414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
66415         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66416         this_ptr_conv.inner = untag_ptr(this_ptr);
66417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66419         this_ptr_conv.is_owned = false;
66420         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
66421         return ret_conv;
66422 }
66423
66424 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) {
66425         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66426         this_ptr_conv.inner = untag_ptr(this_ptr);
66427         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66429         this_ptr_conv.is_owned = false;
66430         ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
66431 }
66432
66433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
66434         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66435         this_ptr_conv.inner = untag_ptr(this_ptr);
66436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66438         this_ptr_conv.is_owned = false;
66439         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
66440         return ret_conv;
66441 }
66442
66443 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) {
66444         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66445         this_ptr_conv.inner = untag_ptr(this_ptr);
66446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66448         this_ptr_conv.is_owned = false;
66449         ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
66450 }
66451
66452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1historical_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
66453         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66454         this_ptr_conv.inner = untag_ptr(this_ptr);
66455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66457         this_ptr_conv.is_owned = false;
66458         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
66459         return ret_conv;
66460 }
66461
66462 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) {
66463         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66464         this_ptr_conv.inner = untag_ptr(this_ptr);
66465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66467         this_ptr_conv.is_owned = false;
66468         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
66469 }
66470
66471 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) {
66472         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66473         this_ptr_conv.inner = untag_ptr(this_ptr);
66474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66476         this_ptr_conv.is_owned = false;
66477         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
66478         return ret_conv;
66479 }
66480
66481 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) {
66482         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66483         this_ptr_conv.inner = untag_ptr(this_ptr);
66484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66486         this_ptr_conv.is_owned = false;
66487         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
66488 }
66489
66490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1anti_1probing_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
66491         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66492         this_ptr_conv.inner = untag_ptr(this_ptr);
66493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66495         this_ptr_conv.is_owned = false;
66496         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
66497         return ret_conv;
66498 }
66499
66500 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) {
66501         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66502         this_ptr_conv.inner = untag_ptr(this_ptr);
66503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66505         this_ptr_conv.is_owned = false;
66506         ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
66507 }
66508
66509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1considered_1impossible_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
66510         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66511         this_ptr_conv.inner = untag_ptr(this_ptr);
66512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66514         this_ptr_conv.is_owned = false;
66515         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
66516         return ret_conv;
66517 }
66518
66519 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) {
66520         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66521         this_ptr_conv.inner = untag_ptr(this_ptr);
66522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66524         this_ptr_conv.is_owned = false;
66525         ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
66526 }
66527
66528 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1linear_1success_1probability(JNIEnv *env, jclass clz, int64_t this_ptr) {
66529         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66530         this_ptr_conv.inner = untag_ptr(this_ptr);
66531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66533         this_ptr_conv.is_owned = false;
66534         jboolean ret_conv = ProbabilisticScoringFeeParameters_get_linear_success_probability(&this_ptr_conv);
66535         return ret_conv;
66536 }
66537
66538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1linear_1success_1probability(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
66539         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66540         this_ptr_conv.inner = untag_ptr(this_ptr);
66541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66543         this_ptr_conv.is_owned = false;
66544         ProbabilisticScoringFeeParameters_set_linear_success_probability(&this_ptr_conv, val);
66545 }
66546
66547 static inline uint64_t ProbabilisticScoringFeeParameters_clone_ptr(LDKProbabilisticScoringFeeParameters *NONNULL_PTR arg) {
66548         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(arg);
66549         int64_t ret_ref = 0;
66550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66552         return ret_ref;
66553 }
66554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66555         LDKProbabilisticScoringFeeParameters arg_conv;
66556         arg_conv.inner = untag_ptr(arg);
66557         arg_conv.is_owned = ptr_is_owned(arg);
66558         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66559         arg_conv.is_owned = false;
66560         int64_t ret_conv = ProbabilisticScoringFeeParameters_clone_ptr(&arg_conv);
66561         return ret_conv;
66562 }
66563
66564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66565         LDKProbabilisticScoringFeeParameters orig_conv;
66566         orig_conv.inner = untag_ptr(orig);
66567         orig_conv.is_owned = ptr_is_owned(orig);
66568         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66569         orig_conv.is_owned = false;
66570         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(&orig_conv);
66571         int64_t ret_ref = 0;
66572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66574         return ret_ref;
66575 }
66576
66577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1default(JNIEnv *env, jclass clz) {
66578         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_default();
66579         int64_t ret_ref = 0;
66580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66582         return ret_ref;
66583 }
66584
66585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1add_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
66586         LDKProbabilisticScoringFeeParameters this_arg_conv;
66587         this_arg_conv.inner = untag_ptr(this_arg);
66588         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66590         this_arg_conv.is_owned = false;
66591         LDKNodeId node_id_conv;
66592         node_id_conv.inner = untag_ptr(node_id);
66593         node_id_conv.is_owned = ptr_is_owned(node_id);
66594         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
66595         node_id_conv.is_owned = false;
66596         ProbabilisticScoringFeeParameters_add_banned(&this_arg_conv, &node_id_conv);
66597 }
66598
66599 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) {
66600         LDKProbabilisticScoringFeeParameters this_arg_conv;
66601         this_arg_conv.inner = untag_ptr(this_arg);
66602         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66604         this_arg_conv.is_owned = false;
66605         LDKCVec_NodeIdZ node_ids_constr;
66606         node_ids_constr.datalen = (*env)->GetArrayLength(env, node_ids);
66607         if (node_ids_constr.datalen > 0)
66608                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
66609         else
66610                 node_ids_constr.data = NULL;
66611         int64_t* node_ids_vals = (*env)->GetLongArrayElements (env, node_ids, NULL);
66612         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
66613                 int64_t node_ids_conv_8 = node_ids_vals[i];
66614                 LDKNodeId node_ids_conv_8_conv;
66615                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
66616                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
66617                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
66618                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
66619                 node_ids_constr.data[i] = node_ids_conv_8_conv;
66620         }
66621         (*env)->ReleaseLongArrayElements(env, node_ids, node_ids_vals, 0);
66622         ProbabilisticScoringFeeParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
66623 }
66624
66625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1remove_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
66626         LDKProbabilisticScoringFeeParameters this_arg_conv;
66627         this_arg_conv.inner = untag_ptr(this_arg);
66628         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66630         this_arg_conv.is_owned = false;
66631         LDKNodeId node_id_conv;
66632         node_id_conv.inner = untag_ptr(node_id);
66633         node_id_conv.is_owned = ptr_is_owned(node_id);
66634         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
66635         node_id_conv.is_owned = false;
66636         ProbabilisticScoringFeeParameters_remove_banned(&this_arg_conv, &node_id_conv);
66637 }
66638
66639 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) {
66640         LDKProbabilisticScoringFeeParameters this_arg_conv;
66641         this_arg_conv.inner = untag_ptr(this_arg);
66642         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66644         this_arg_conv.is_owned = false;
66645         LDKNodeId node_id_conv;
66646         node_id_conv.inner = untag_ptr(node_id);
66647         node_id_conv.is_owned = ptr_is_owned(node_id);
66648         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
66649         node_id_conv.is_owned = false;
66650         ProbabilisticScoringFeeParameters_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
66651 }
66652
66653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1remove_1manual_1penalty(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
66654         LDKProbabilisticScoringFeeParameters this_arg_conv;
66655         this_arg_conv.inner = untag_ptr(this_arg);
66656         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66658         this_arg_conv.is_owned = false;
66659         LDKNodeId node_id_conv;
66660         node_id_conv.inner = untag_ptr(node_id);
66661         node_id_conv.is_owned = ptr_is_owned(node_id);
66662         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
66663         node_id_conv.is_owned = false;
66664         ProbabilisticScoringFeeParameters_remove_manual_penalty(&this_arg_conv, &node_id_conv);
66665 }
66666
66667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clear_1manual_1penalties(JNIEnv *env, jclass clz, int64_t this_arg) {
66668         LDKProbabilisticScoringFeeParameters this_arg_conv;
66669         this_arg_conv.inner = untag_ptr(this_arg);
66670         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66672         this_arg_conv.is_owned = false;
66673         ProbabilisticScoringFeeParameters_clear_manual_penalties(&this_arg_conv);
66674 }
66675
66676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66677         LDKProbabilisticScoringDecayParameters this_obj_conv;
66678         this_obj_conv.inner = untag_ptr(this_obj);
66679         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66681         ProbabilisticScoringDecayParameters_free(this_obj_conv);
66682 }
66683
66684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1get_1historical_1no_1updates_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
66685         LDKProbabilisticScoringDecayParameters this_ptr_conv;
66686         this_ptr_conv.inner = untag_ptr(this_ptr);
66687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66689         this_ptr_conv.is_owned = false;
66690         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(&this_ptr_conv);
66691         return ret_conv;
66692 }
66693
66694 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) {
66695         LDKProbabilisticScoringDecayParameters this_ptr_conv;
66696         this_ptr_conv.inner = untag_ptr(this_ptr);
66697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66699         this_ptr_conv.is_owned = false;
66700         ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
66701 }
66702
66703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1get_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
66704         LDKProbabilisticScoringDecayParameters this_ptr_conv;
66705         this_ptr_conv.inner = untag_ptr(this_ptr);
66706         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66708         this_ptr_conv.is_owned = false;
66709         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(&this_ptr_conv);
66710         return ret_conv;
66711 }
66712
66713 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) {
66714         LDKProbabilisticScoringDecayParameters this_ptr_conv;
66715         this_ptr_conv.inner = untag_ptr(this_ptr);
66716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66718         this_ptr_conv.is_owned = false;
66719         ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
66720 }
66721
66722 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) {
66723         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_new(historical_no_updates_half_life_arg, liquidity_offset_half_life_arg);
66724         int64_t ret_ref = 0;
66725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66727         return ret_ref;
66728 }
66729
66730 static inline uint64_t ProbabilisticScoringDecayParameters_clone_ptr(LDKProbabilisticScoringDecayParameters *NONNULL_PTR arg) {
66731         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(arg);
66732         int64_t ret_ref = 0;
66733         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66734         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66735         return ret_ref;
66736 }
66737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66738         LDKProbabilisticScoringDecayParameters arg_conv;
66739         arg_conv.inner = untag_ptr(arg);
66740         arg_conv.is_owned = ptr_is_owned(arg);
66741         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66742         arg_conv.is_owned = false;
66743         int64_t ret_conv = ProbabilisticScoringDecayParameters_clone_ptr(&arg_conv);
66744         return ret_conv;
66745 }
66746
66747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66748         LDKProbabilisticScoringDecayParameters orig_conv;
66749         orig_conv.inner = untag_ptr(orig);
66750         orig_conv.is_owned = ptr_is_owned(orig);
66751         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66752         orig_conv.is_owned = false;
66753         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(&orig_conv);
66754         int64_t ret_ref = 0;
66755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66757         return ret_ref;
66758 }
66759
66760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1default(JNIEnv *env, jclass clz) {
66761         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_default();
66762         int64_t ret_ref = 0;
66763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66765         return ret_ref;
66766 }
66767
66768 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) {
66769         LDKProbabilisticScoringDecayParameters decay_params_conv;
66770         decay_params_conv.inner = untag_ptr(decay_params);
66771         decay_params_conv.is_owned = ptr_is_owned(decay_params);
66772         CHECK_INNER_FIELD_ACCESS_OR_NULL(decay_params_conv);
66773         decay_params_conv = ProbabilisticScoringDecayParameters_clone(&decay_params_conv);
66774         LDKNetworkGraph network_graph_conv;
66775         network_graph_conv.inner = untag_ptr(network_graph);
66776         network_graph_conv.is_owned = ptr_is_owned(network_graph);
66777         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
66778         network_graph_conv.is_owned = false;
66779         void* logger_ptr = untag_ptr(logger);
66780         CHECK_ACCESS(logger_ptr);
66781         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
66782         if (logger_conv.free == LDKLogger_JCalls_free) {
66783                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66784                 LDKLogger_JCalls_cloned(&logger_conv);
66785         }
66786         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(decay_params_conv, &network_graph_conv, logger_conv);
66787         int64_t ret_ref = 0;
66788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66789         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66790         return ret_ref;
66791 }
66792
66793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1debug_1log_1liquidity_1stats(JNIEnv *env, jclass clz, int64_t this_arg) {
66794         LDKProbabilisticScorer this_arg_conv;
66795         this_arg_conv.inner = untag_ptr(this_arg);
66796         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66798         this_arg_conv.is_owned = false;
66799         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
66800 }
66801
66802 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) {
66803         LDKProbabilisticScorer this_arg_conv;
66804         this_arg_conv.inner = untag_ptr(this_arg);
66805         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66807         this_arg_conv.is_owned = false;
66808         LDKNodeId target_conv;
66809         target_conv.inner = untag_ptr(target);
66810         target_conv.is_owned = ptr_is_owned(target);
66811         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
66812         target_conv.is_owned = false;
66813         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
66814         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
66815         int64_t ret_ref = tag_ptr(ret_copy, true);
66816         return ret_ref;
66817 }
66818
66819 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) {
66820         LDKProbabilisticScorer this_arg_conv;
66821         this_arg_conv.inner = untag_ptr(this_arg);
66822         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66824         this_arg_conv.is_owned = false;
66825         LDKNodeId target_conv;
66826         target_conv.inner = untag_ptr(target);
66827         target_conv.is_owned = ptr_is_owned(target);
66828         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
66829         target_conv.is_owned = false;
66830         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
66831         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
66832         int64_t ret_ref = tag_ptr(ret_copy, true);
66833         return ret_ref;
66834 }
66835
66836 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) {
66837         LDKProbabilisticScorer this_arg_conv;
66838         this_arg_conv.inner = untag_ptr(this_arg);
66839         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66841         this_arg_conv.is_owned = false;
66842         LDKNodeId target_conv;
66843         target_conv.inner = untag_ptr(target);
66844         target_conv.is_owned = ptr_is_owned(target);
66845         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
66846         target_conv.is_owned = false;
66847         LDKProbabilisticScoringFeeParameters params_conv;
66848         params_conv.inner = untag_ptr(params);
66849         params_conv.is_owned = ptr_is_owned(params);
66850         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
66851         params_conv.is_owned = false;
66852         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
66853         *ret_copy = ProbabilisticScorer_historical_estimated_payment_success_probability(&this_arg_conv, scid, &target_conv, amount_msat, &params_conv);
66854         int64_t ret_ref = tag_ptr(ret_copy, true);
66855         return ret_ref;
66856 }
66857
66858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
66859         LDKProbabilisticScorer this_arg_conv;
66860         this_arg_conv.inner = untag_ptr(this_arg);
66861         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66863         this_arg_conv.is_owned = false;
66864         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
66865         *ret_ret = ProbabilisticScorer_as_ScoreLookUp(&this_arg_conv);
66866         return tag_ptr(ret_ret, true);
66867 }
66868
66869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t this_arg) {
66870         LDKProbabilisticScorer this_arg_conv;
66871         this_arg_conv.inner = untag_ptr(this_arg);
66872         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66874         this_arg_conv.is_owned = false;
66875         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
66876         *ret_ret = ProbabilisticScorer_as_ScoreUpdate(&this_arg_conv);
66877         return tag_ptr(ret_ret, true);
66878 }
66879
66880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
66881         LDKProbabilisticScorer this_arg_conv;
66882         this_arg_conv.inner = untag_ptr(this_arg);
66883         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66885         this_arg_conv.is_owned = false;
66886         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
66887         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
66888         return tag_ptr(ret_ret, true);
66889 }
66890
66891 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
66892         LDKProbabilisticScorer obj_conv;
66893         obj_conv.inner = untag_ptr(obj);
66894         obj_conv.is_owned = ptr_is_owned(obj);
66895         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66896         obj_conv.is_owned = false;
66897         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
66898         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66899         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66900         CVec_u8Z_free(ret_var);
66901         return ret_arr;
66902 }
66903
66904 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) {
66905         LDKu8slice ser_ref;
66906         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
66907         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
66908         LDKProbabilisticScoringDecayParameters arg_a_conv;
66909         arg_a_conv.inner = untag_ptr(arg_a);
66910         arg_a_conv.is_owned = ptr_is_owned(arg_a);
66911         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
66912         arg_a_conv = ProbabilisticScoringDecayParameters_clone(&arg_a_conv);
66913         LDKNetworkGraph arg_b_conv;
66914         arg_b_conv.inner = untag_ptr(arg_b);
66915         arg_b_conv.is_owned = ptr_is_owned(arg_b);
66916         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
66917         arg_b_conv.is_owned = false;
66918         void* arg_c_ptr = untag_ptr(arg_c);
66919         CHECK_ACCESS(arg_c_ptr);
66920         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
66921         if (arg_c_conv.free == LDKLogger_JCalls_free) {
66922                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66923                 LDKLogger_JCalls_cloned(&arg_c_conv);
66924         }
66925         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
66926         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
66927         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
66928         return tag_ptr(ret_conv, true);
66929 }
66930
66931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66932         LDKDelayedPaymentOutputDescriptor this_obj_conv;
66933         this_obj_conv.inner = untag_ptr(this_obj);
66934         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66936         DelayedPaymentOutputDescriptor_free(this_obj_conv);
66937 }
66938
66939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
66940         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66941         this_ptr_conv.inner = untag_ptr(this_ptr);
66942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66944         this_ptr_conv.is_owned = false;
66945         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
66946         int64_t ret_ref = 0;
66947         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66948         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66949         return ret_ref;
66950 }
66951
66952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66953         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66954         this_ptr_conv.inner = untag_ptr(this_ptr);
66955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66957         this_ptr_conv.is_owned = false;
66958         LDKOutPoint val_conv;
66959         val_conv.inner = untag_ptr(val);
66960         val_conv.is_owned = ptr_is_owned(val);
66961         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66962         val_conv = OutPoint_clone(&val_conv);
66963         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
66964 }
66965
66966 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
66967         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66968         this_ptr_conv.inner = untag_ptr(this_ptr);
66969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66971         this_ptr_conv.is_owned = false;
66972         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
66973         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
66974         return ret_arr;
66975 }
66976
66977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
66978         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66979         this_ptr_conv.inner = untag_ptr(this_ptr);
66980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66982         this_ptr_conv.is_owned = false;
66983         LDKPublicKey val_ref;
66984         CHECK((*env)->GetArrayLength(env, val) == 33);
66985         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
66986         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
66987 }
66988
66989 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
66990         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66991         this_ptr_conv.inner = untag_ptr(this_ptr);
66992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66994         this_ptr_conv.is_owned = false;
66995         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
66996         return ret_conv;
66997 }
66998
66999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
67000         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67001         this_ptr_conv.inner = untag_ptr(this_ptr);
67002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67004         this_ptr_conv.is_owned = false;
67005         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
67006 }
67007
67008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
67009         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67010         this_ptr_conv.inner = untag_ptr(this_ptr);
67011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67013         this_ptr_conv.is_owned = false;
67014         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
67015         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
67016         return tag_ptr(ret_ref, true);
67017 }
67018
67019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67020         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67021         this_ptr_conv.inner = untag_ptr(this_ptr);
67022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67024         this_ptr_conv.is_owned = false;
67025         void* val_ptr = untag_ptr(val);
67026         CHECK_ACCESS(val_ptr);
67027         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
67028         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
67029         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
67030 }
67031
67032 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
67033         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67034         this_ptr_conv.inner = untag_ptr(this_ptr);
67035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67037         this_ptr_conv.is_owned = false;
67038         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
67039         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
67040         return ret_arr;
67041 }
67042
67043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
67044         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67045         this_ptr_conv.inner = untag_ptr(this_ptr);
67046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67048         this_ptr_conv.is_owned = false;
67049         LDKPublicKey val_ref;
67050         CHECK((*env)->GetArrayLength(env, val) == 33);
67051         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
67052         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
67053 }
67054
67055 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
67056         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67057         this_ptr_conv.inner = untag_ptr(this_ptr);
67058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67060         this_ptr_conv.is_owned = false;
67061         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
67062         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
67063         return ret_arr;
67064 }
67065
67066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
67067         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67068         this_ptr_conv.inner = untag_ptr(this_ptr);
67069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67071         this_ptr_conv.is_owned = false;
67072         LDKThirtyTwoBytes val_ref;
67073         CHECK((*env)->GetArrayLength(env, val) == 32);
67074         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
67075         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
67076 }
67077
67078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
67079         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67080         this_ptr_conv.inner = untag_ptr(this_ptr);
67081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67083         this_ptr_conv.is_owned = false;
67084         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
67085         return ret_conv;
67086 }
67087
67088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67089         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67090         this_ptr_conv.inner = untag_ptr(this_ptr);
67091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67093         this_ptr_conv.is_owned = false;
67094         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
67095 }
67096
67097 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) {
67098         LDKOutPoint outpoint_arg_conv;
67099         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
67100         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
67101         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
67102         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
67103         LDKPublicKey per_commitment_point_arg_ref;
67104         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
67105         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
67106         void* output_arg_ptr = untag_ptr(output_arg);
67107         CHECK_ACCESS(output_arg_ptr);
67108         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
67109         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
67110         LDKPublicKey revocation_pubkey_arg_ref;
67111         CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
67112         (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
67113         LDKThirtyTwoBytes channel_keys_id_arg_ref;
67114         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
67115         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
67116         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);
67117         int64_t ret_ref = 0;
67118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67120         return ret_ref;
67121 }
67122
67123 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
67124         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
67125         int64_t ret_ref = 0;
67126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67128         return ret_ref;
67129 }
67130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67131         LDKDelayedPaymentOutputDescriptor arg_conv;
67132         arg_conv.inner = untag_ptr(arg);
67133         arg_conv.is_owned = ptr_is_owned(arg);
67134         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67135         arg_conv.is_owned = false;
67136         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
67137         return ret_conv;
67138 }
67139
67140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67141         LDKDelayedPaymentOutputDescriptor orig_conv;
67142         orig_conv.inner = untag_ptr(orig);
67143         orig_conv.is_owned = ptr_is_owned(orig);
67144         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67145         orig_conv.is_owned = false;
67146         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
67147         int64_t ret_ref = 0;
67148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67150         return ret_ref;
67151 }
67152
67153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1hash(JNIEnv *env, jclass clz, int64_t o) {
67154         LDKDelayedPaymentOutputDescriptor o_conv;
67155         o_conv.inner = untag_ptr(o);
67156         o_conv.is_owned = ptr_is_owned(o);
67157         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67158         o_conv.is_owned = false;
67159         int64_t ret_conv = DelayedPaymentOutputDescriptor_hash(&o_conv);
67160         return ret_conv;
67161 }
67162
67163 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67164         LDKDelayedPaymentOutputDescriptor a_conv;
67165         a_conv.inner = untag_ptr(a);
67166         a_conv.is_owned = ptr_is_owned(a);
67167         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67168         a_conv.is_owned = false;
67169         LDKDelayedPaymentOutputDescriptor b_conv;
67170         b_conv.inner = untag_ptr(b);
67171         b_conv.is_owned = ptr_is_owned(b);
67172         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67173         b_conv.is_owned = false;
67174         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
67175         return ret_conv;
67176 }
67177
67178 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
67179         LDKDelayedPaymentOutputDescriptor obj_conv;
67180         obj_conv.inner = untag_ptr(obj);
67181         obj_conv.is_owned = ptr_is_owned(obj);
67182         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67183         obj_conv.is_owned = false;
67184         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
67185         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
67186         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
67187         CVec_u8Z_free(ret_var);
67188         return ret_arr;
67189 }
67190
67191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
67192         LDKu8slice ser_ref;
67193         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
67194         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
67195         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
67196         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
67197         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
67198         return tag_ptr(ret_conv, true);
67199 }
67200
67201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67202         LDKStaticPaymentOutputDescriptor this_obj_conv;
67203         this_obj_conv.inner = untag_ptr(this_obj);
67204         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67206         StaticPaymentOutputDescriptor_free(this_obj_conv);
67207 }
67208
67209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
67210         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67211         this_ptr_conv.inner = untag_ptr(this_ptr);
67212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67214         this_ptr_conv.is_owned = false;
67215         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
67216         int64_t ret_ref = 0;
67217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67219         return ret_ref;
67220 }
67221
67222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67223         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67224         this_ptr_conv.inner = untag_ptr(this_ptr);
67225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67227         this_ptr_conv.is_owned = false;
67228         LDKOutPoint val_conv;
67229         val_conv.inner = untag_ptr(val);
67230         val_conv.is_owned = ptr_is_owned(val);
67231         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67232         val_conv = OutPoint_clone(&val_conv);
67233         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
67234 }
67235
67236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
67237         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67238         this_ptr_conv.inner = untag_ptr(this_ptr);
67239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67241         this_ptr_conv.is_owned = false;
67242         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
67243         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
67244         return tag_ptr(ret_ref, true);
67245 }
67246
67247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67248         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67249         this_ptr_conv.inner = untag_ptr(this_ptr);
67250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67252         this_ptr_conv.is_owned = false;
67253         void* val_ptr = untag_ptr(val);
67254         CHECK_ACCESS(val_ptr);
67255         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
67256         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
67257         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
67258 }
67259
67260 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
67261         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67262         this_ptr_conv.inner = untag_ptr(this_ptr);
67263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67265         this_ptr_conv.is_owned = false;
67266         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
67267         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
67268         return ret_arr;
67269 }
67270
67271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
67272         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67273         this_ptr_conv.inner = untag_ptr(this_ptr);
67274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67276         this_ptr_conv.is_owned = false;
67277         LDKThirtyTwoBytes val_ref;
67278         CHECK((*env)->GetArrayLength(env, val) == 32);
67279         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
67280         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
67281 }
67282
67283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
67284         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67285         this_ptr_conv.inner = untag_ptr(this_ptr);
67286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67288         this_ptr_conv.is_owned = false;
67289         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
67290         return ret_conv;
67291 }
67292
67293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67294         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67295         this_ptr_conv.inner = untag_ptr(this_ptr);
67296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67298         this_ptr_conv.is_owned = false;
67299         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
67300 }
67301
67302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
67303         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67304         this_ptr_conv.inner = untag_ptr(this_ptr);
67305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67307         this_ptr_conv.is_owned = false;
67308         LDKChannelTransactionParameters ret_var = StaticPaymentOutputDescriptor_get_channel_transaction_parameters(&this_ptr_conv);
67309         int64_t ret_ref = 0;
67310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67312         return ret_ref;
67313 }
67314
67315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67316         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67317         this_ptr_conv.inner = untag_ptr(this_ptr);
67318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67320         this_ptr_conv.is_owned = false;
67321         LDKChannelTransactionParameters val_conv;
67322         val_conv.inner = untag_ptr(val);
67323         val_conv.is_owned = ptr_is_owned(val);
67324         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67325         val_conv = ChannelTransactionParameters_clone(&val_conv);
67326         StaticPaymentOutputDescriptor_set_channel_transaction_parameters(&this_ptr_conv, val_conv);
67327 }
67328
67329 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) {
67330         LDKOutPoint outpoint_arg_conv;
67331         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
67332         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
67333         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
67334         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
67335         void* output_arg_ptr = untag_ptr(output_arg);
67336         CHECK_ACCESS(output_arg_ptr);
67337         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
67338         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
67339         LDKThirtyTwoBytes channel_keys_id_arg_ref;
67340         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
67341         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
67342         LDKChannelTransactionParameters channel_transaction_parameters_arg_conv;
67343         channel_transaction_parameters_arg_conv.inner = untag_ptr(channel_transaction_parameters_arg);
67344         channel_transaction_parameters_arg_conv.is_owned = ptr_is_owned(channel_transaction_parameters_arg);
67345         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_transaction_parameters_arg_conv);
67346         channel_transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&channel_transaction_parameters_arg_conv);
67347         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);
67348         int64_t ret_ref = 0;
67349         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67350         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67351         return ret_ref;
67352 }
67353
67354 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
67355         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
67356         int64_t ret_ref = 0;
67357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67359         return ret_ref;
67360 }
67361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67362         LDKStaticPaymentOutputDescriptor arg_conv;
67363         arg_conv.inner = untag_ptr(arg);
67364         arg_conv.is_owned = ptr_is_owned(arg);
67365         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67366         arg_conv.is_owned = false;
67367         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
67368         return ret_conv;
67369 }
67370
67371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67372         LDKStaticPaymentOutputDescriptor orig_conv;
67373         orig_conv.inner = untag_ptr(orig);
67374         orig_conv.is_owned = ptr_is_owned(orig);
67375         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67376         orig_conv.is_owned = false;
67377         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
67378         int64_t ret_ref = 0;
67379         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67380         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67381         return ret_ref;
67382 }
67383
67384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1hash(JNIEnv *env, jclass clz, int64_t o) {
67385         LDKStaticPaymentOutputDescriptor o_conv;
67386         o_conv.inner = untag_ptr(o);
67387         o_conv.is_owned = ptr_is_owned(o);
67388         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67389         o_conv.is_owned = false;
67390         int64_t ret_conv = StaticPaymentOutputDescriptor_hash(&o_conv);
67391         return ret_conv;
67392 }
67393
67394 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67395         LDKStaticPaymentOutputDescriptor a_conv;
67396         a_conv.inner = untag_ptr(a);
67397         a_conv.is_owned = ptr_is_owned(a);
67398         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67399         a_conv.is_owned = false;
67400         LDKStaticPaymentOutputDescriptor b_conv;
67401         b_conv.inner = untag_ptr(b);
67402         b_conv.is_owned = ptr_is_owned(b);
67403         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67404         b_conv.is_owned = false;
67405         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
67406         return ret_conv;
67407 }
67408
67409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
67410         LDKStaticPaymentOutputDescriptor this_arg_conv;
67411         this_arg_conv.inner = untag_ptr(this_arg);
67412         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67414         this_arg_conv.is_owned = false;
67415         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
67416         *ret_copy = StaticPaymentOutputDescriptor_witness_script(&this_arg_conv);
67417         int64_t ret_ref = tag_ptr(ret_copy, true);
67418         return ret_ref;
67419 }
67420
67421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1max_1witness_1length(JNIEnv *env, jclass clz, int64_t this_arg) {
67422         LDKStaticPaymentOutputDescriptor this_arg_conv;
67423         this_arg_conv.inner = untag_ptr(this_arg);
67424         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67426         this_arg_conv.is_owned = false;
67427         int64_t ret_conv = StaticPaymentOutputDescriptor_max_witness_length(&this_arg_conv);
67428         return ret_conv;
67429 }
67430
67431 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
67432         LDKStaticPaymentOutputDescriptor obj_conv;
67433         obj_conv.inner = untag_ptr(obj);
67434         obj_conv.is_owned = ptr_is_owned(obj);
67435         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67436         obj_conv.is_owned = false;
67437         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
67438         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
67439         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
67440         CVec_u8Z_free(ret_var);
67441         return ret_arr;
67442 }
67443
67444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
67445         LDKu8slice ser_ref;
67446         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
67447         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
67448         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
67449         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
67450         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
67451         return tag_ptr(ret_conv, true);
67452 }
67453
67454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
67455         if (!ptr_is_owned(this_ptr)) return;
67456         void* this_ptr_ptr = untag_ptr(this_ptr);
67457         CHECK_ACCESS(this_ptr_ptr);
67458         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
67459         FREE(untag_ptr(this_ptr));
67460         SpendableOutputDescriptor_free(this_ptr_conv);
67461 }
67462
67463 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
67464         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
67465         *ret_copy = SpendableOutputDescriptor_clone(arg);
67466         int64_t ret_ref = tag_ptr(ret_copy, true);
67467         return ret_ref;
67468 }
67469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67470         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
67471         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
67472         return ret_conv;
67473 }
67474
67475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67476         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
67477         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
67478         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
67479         int64_t ret_ref = tag_ptr(ret_copy, true);
67480         return ret_ref;
67481 }
67482
67483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output) {
67484         LDKOutPoint outpoint_conv;
67485         outpoint_conv.inner = untag_ptr(outpoint);
67486         outpoint_conv.is_owned = ptr_is_owned(outpoint);
67487         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
67488         outpoint_conv = OutPoint_clone(&outpoint_conv);
67489         void* output_ptr = untag_ptr(output);
67490         CHECK_ACCESS(output_ptr);
67491         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
67492         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
67493         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
67494         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
67495         int64_t ret_ref = tag_ptr(ret_copy, true);
67496         return ret_ref;
67497 }
67498
67499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
67500         LDKDelayedPaymentOutputDescriptor a_conv;
67501         a_conv.inner = untag_ptr(a);
67502         a_conv.is_owned = ptr_is_owned(a);
67503         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67504         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
67505         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
67506         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
67507         int64_t ret_ref = tag_ptr(ret_copy, true);
67508         return ret_ref;
67509 }
67510
67511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
67512         LDKStaticPaymentOutputDescriptor a_conv;
67513         a_conv.inner = untag_ptr(a);
67514         a_conv.is_owned = ptr_is_owned(a);
67515         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67516         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
67517         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
67518         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
67519         int64_t ret_ref = tag_ptr(ret_copy, true);
67520         return ret_ref;
67521 }
67522
67523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1hash(JNIEnv *env, jclass clz, int64_t o) {
67524         LDKSpendableOutputDescriptor* o_conv = (LDKSpendableOutputDescriptor*)untag_ptr(o);
67525         int64_t ret_conv = SpendableOutputDescriptor_hash(o_conv);
67526         return ret_conv;
67527 }
67528
67529 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67530         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
67531         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
67532         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
67533         return ret_conv;
67534 }
67535
67536 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
67537         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
67538         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
67539         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
67540         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
67541         CVec_u8Z_free(ret_var);
67542         return ret_arr;
67543 }
67544
67545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
67546         LDKu8slice ser_ref;
67547         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
67548         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
67549         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
67550         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
67551         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
67552         return tag_ptr(ret_conv, true);
67553 }
67554
67555 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) {
67556         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
67557         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
67558         if (descriptors_constr.datalen > 0)
67559                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
67560         else
67561                 descriptors_constr.data = NULL;
67562         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
67563         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
67564                 int64_t descriptors_conv_27 = descriptors_vals[b];
67565                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
67566                 CHECK_ACCESS(descriptors_conv_27_ptr);
67567                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
67568                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
67569                 descriptors_constr.data[b] = descriptors_conv_27_conv;
67570         }
67571         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
67572         LDKCVec_TxOutZ outputs_constr;
67573         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
67574         if (outputs_constr.datalen > 0)
67575                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
67576         else
67577                 outputs_constr.data = NULL;
67578         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
67579         for (size_t h = 0; h < outputs_constr.datalen; h++) {
67580                 int64_t outputs_conv_7 = outputs_vals[h];
67581                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
67582                 CHECK_ACCESS(outputs_conv_7_ptr);
67583                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
67584                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
67585                 outputs_constr.data[h] = outputs_conv_7_conv;
67586         }
67587         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
67588         LDKCVec_u8Z change_destination_script_ref;
67589         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
67590         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
67591         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
67592         void* locktime_ptr = untag_ptr(locktime);
67593         CHECK_ACCESS(locktime_ptr);
67594         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
67595         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
67596         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
67597         *ret_conv = SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
67598         return tag_ptr(ret_conv, true);
67599 }
67600
67601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67602         LDKChannelDerivationParameters this_obj_conv;
67603         this_obj_conv.inner = untag_ptr(this_obj);
67604         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67606         ChannelDerivationParameters_free(this_obj_conv);
67607 }
67608
67609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
67610         LDKChannelDerivationParameters this_ptr_conv;
67611         this_ptr_conv.inner = untag_ptr(this_ptr);
67612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67614         this_ptr_conv.is_owned = false;
67615         int64_t ret_conv = ChannelDerivationParameters_get_value_satoshis(&this_ptr_conv);
67616         return ret_conv;
67617 }
67618
67619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67620         LDKChannelDerivationParameters this_ptr_conv;
67621         this_ptr_conv.inner = untag_ptr(this_ptr);
67622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67624         this_ptr_conv.is_owned = false;
67625         ChannelDerivationParameters_set_value_satoshis(&this_ptr_conv, val);
67626 }
67627
67628 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
67629         LDKChannelDerivationParameters this_ptr_conv;
67630         this_ptr_conv.inner = untag_ptr(this_ptr);
67631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67633         this_ptr_conv.is_owned = false;
67634         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
67635         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDerivationParameters_get_keys_id(&this_ptr_conv));
67636         return ret_arr;
67637 }
67638
67639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
67640         LDKChannelDerivationParameters this_ptr_conv;
67641         this_ptr_conv.inner = untag_ptr(this_ptr);
67642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67644         this_ptr_conv.is_owned = false;
67645         LDKThirtyTwoBytes val_ref;
67646         CHECK((*env)->GetArrayLength(env, val) == 32);
67647         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
67648         ChannelDerivationParameters_set_keys_id(&this_ptr_conv, val_ref);
67649 }
67650
67651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
67652         LDKChannelDerivationParameters this_ptr_conv;
67653         this_ptr_conv.inner = untag_ptr(this_ptr);
67654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67656         this_ptr_conv.is_owned = false;
67657         LDKChannelTransactionParameters ret_var = ChannelDerivationParameters_get_transaction_parameters(&this_ptr_conv);
67658         int64_t ret_ref = 0;
67659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67661         return ret_ref;
67662 }
67663
67664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67665         LDKChannelDerivationParameters this_ptr_conv;
67666         this_ptr_conv.inner = untag_ptr(this_ptr);
67667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67669         this_ptr_conv.is_owned = false;
67670         LDKChannelTransactionParameters val_conv;
67671         val_conv.inner = untag_ptr(val);
67672         val_conv.is_owned = ptr_is_owned(val);
67673         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67674         val_conv = ChannelTransactionParameters_clone(&val_conv);
67675         ChannelDerivationParameters_set_transaction_parameters(&this_ptr_conv, val_conv);
67676 }
67677
67678 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) {
67679         LDKThirtyTwoBytes keys_id_arg_ref;
67680         CHECK((*env)->GetArrayLength(env, keys_id_arg) == 32);
67681         (*env)->GetByteArrayRegion(env, keys_id_arg, 0, 32, keys_id_arg_ref.data);
67682         LDKChannelTransactionParameters transaction_parameters_arg_conv;
67683         transaction_parameters_arg_conv.inner = untag_ptr(transaction_parameters_arg);
67684         transaction_parameters_arg_conv.is_owned = ptr_is_owned(transaction_parameters_arg);
67685         CHECK_INNER_FIELD_ACCESS_OR_NULL(transaction_parameters_arg_conv);
67686         transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&transaction_parameters_arg_conv);
67687         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_new(value_satoshis_arg, keys_id_arg_ref, transaction_parameters_arg_conv);
67688         int64_t ret_ref = 0;
67689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67691         return ret_ref;
67692 }
67693
67694 static inline uint64_t ChannelDerivationParameters_clone_ptr(LDKChannelDerivationParameters *NONNULL_PTR arg) {
67695         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(arg);
67696         int64_t ret_ref = 0;
67697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67699         return ret_ref;
67700 }
67701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67702         LDKChannelDerivationParameters arg_conv;
67703         arg_conv.inner = untag_ptr(arg);
67704         arg_conv.is_owned = ptr_is_owned(arg);
67705         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67706         arg_conv.is_owned = false;
67707         int64_t ret_conv = ChannelDerivationParameters_clone_ptr(&arg_conv);
67708         return ret_conv;
67709 }
67710
67711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67712         LDKChannelDerivationParameters orig_conv;
67713         orig_conv.inner = untag_ptr(orig);
67714         orig_conv.is_owned = ptr_is_owned(orig);
67715         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67716         orig_conv.is_owned = false;
67717         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(&orig_conv);
67718         int64_t ret_ref = 0;
67719         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67720         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67721         return ret_ref;
67722 }
67723
67724 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67725         LDKChannelDerivationParameters a_conv;
67726         a_conv.inner = untag_ptr(a);
67727         a_conv.is_owned = ptr_is_owned(a);
67728         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67729         a_conv.is_owned = false;
67730         LDKChannelDerivationParameters b_conv;
67731         b_conv.inner = untag_ptr(b);
67732         b_conv.is_owned = ptr_is_owned(b);
67733         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67734         b_conv.is_owned = false;
67735         jboolean ret_conv = ChannelDerivationParameters_eq(&a_conv, &b_conv);
67736         return ret_conv;
67737 }
67738
67739 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
67740         LDKChannelDerivationParameters obj_conv;
67741         obj_conv.inner = untag_ptr(obj);
67742         obj_conv.is_owned = ptr_is_owned(obj);
67743         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67744         obj_conv.is_owned = false;
67745         LDKCVec_u8Z ret_var = ChannelDerivationParameters_write(&obj_conv);
67746         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
67747         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
67748         CVec_u8Z_free(ret_var);
67749         return ret_arr;
67750 }
67751
67752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
67753         LDKu8slice ser_ref;
67754         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
67755         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
67756         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
67757         *ret_conv = ChannelDerivationParameters_read(ser_ref);
67758         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
67759         return tag_ptr(ret_conv, true);
67760 }
67761
67762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67763         LDKHTLCDescriptor this_obj_conv;
67764         this_obj_conv.inner = untag_ptr(this_obj);
67765         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67767         HTLCDescriptor_free(this_obj_conv);
67768 }
67769
67770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
67771         LDKHTLCDescriptor this_ptr_conv;
67772         this_ptr_conv.inner = untag_ptr(this_ptr);
67773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67775         this_ptr_conv.is_owned = false;
67776         LDKChannelDerivationParameters ret_var = HTLCDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
67777         int64_t ret_ref = 0;
67778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67780         return ret_ref;
67781 }
67782
67783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67784         LDKHTLCDescriptor this_ptr_conv;
67785         this_ptr_conv.inner = untag_ptr(this_ptr);
67786         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67788         this_ptr_conv.is_owned = false;
67789         LDKChannelDerivationParameters val_conv;
67790         val_conv.inner = untag_ptr(val);
67791         val_conv.is_owned = ptr_is_owned(val);
67792         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67793         val_conv = ChannelDerivationParameters_clone(&val_conv);
67794         HTLCDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
67795 }
67796
67797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1per_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
67798         LDKHTLCDescriptor this_ptr_conv;
67799         this_ptr_conv.inner = untag_ptr(this_ptr);
67800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67802         this_ptr_conv.is_owned = false;
67803         int64_t ret_conv = HTLCDescriptor_get_per_commitment_number(&this_ptr_conv);
67804         return ret_conv;
67805 }
67806
67807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1per_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67808         LDKHTLCDescriptor this_ptr_conv;
67809         this_ptr_conv.inner = untag_ptr(this_ptr);
67810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67812         this_ptr_conv.is_owned = false;
67813         HTLCDescriptor_set_per_commitment_number(&this_ptr_conv, val);
67814 }
67815
67816 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
67817         LDKHTLCDescriptor this_ptr_conv;
67818         this_ptr_conv.inner = untag_ptr(this_ptr);
67819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67821         this_ptr_conv.is_owned = false;
67822         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
67823         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HTLCDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
67824         return ret_arr;
67825 }
67826
67827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
67828         LDKHTLCDescriptor this_ptr_conv;
67829         this_ptr_conv.inner = untag_ptr(this_ptr);
67830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67832         this_ptr_conv.is_owned = false;
67833         LDKPublicKey val_ref;
67834         CHECK((*env)->GetArrayLength(env, val) == 33);
67835         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
67836         HTLCDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
67837 }
67838
67839 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
67840         LDKHTLCDescriptor this_ptr_conv;
67841         this_ptr_conv.inner = untag_ptr(this_ptr);
67842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67844         this_ptr_conv.is_owned = false;
67845         int32_t ret_conv = HTLCDescriptor_get_feerate_per_kw(&this_ptr_conv);
67846         return ret_conv;
67847 }
67848
67849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
67850         LDKHTLCDescriptor 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         HTLCDescriptor_set_feerate_per_kw(&this_ptr_conv, val);
67856 }
67857
67858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1htlc(JNIEnv *env, jclass clz, int64_t this_ptr) {
67859         LDKHTLCDescriptor this_ptr_conv;
67860         this_ptr_conv.inner = untag_ptr(this_ptr);
67861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67863         this_ptr_conv.is_owned = false;
67864         LDKHTLCOutputInCommitment ret_var = HTLCDescriptor_get_htlc(&this_ptr_conv);
67865         int64_t ret_ref = 0;
67866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67868         return ret_ref;
67869 }
67870
67871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1htlc(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67872         LDKHTLCDescriptor this_ptr_conv;
67873         this_ptr_conv.inner = untag_ptr(this_ptr);
67874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67876         this_ptr_conv.is_owned = false;
67877         LDKHTLCOutputInCommitment val_conv;
67878         val_conv.inner = untag_ptr(val);
67879         val_conv.is_owned = ptr_is_owned(val);
67880         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67881         val_conv = HTLCOutputInCommitment_clone(&val_conv);
67882         HTLCDescriptor_set_htlc(&this_ptr_conv, val_conv);
67883 }
67884
67885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
67886         LDKHTLCDescriptor this_ptr_conv;
67887         this_ptr_conv.inner = untag_ptr(this_ptr);
67888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67890         this_ptr_conv.is_owned = false;
67891         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
67892         *ret_copy = HTLCDescriptor_get_preimage(&this_ptr_conv);
67893         int64_t ret_ref = tag_ptr(ret_copy, true);
67894         return ret_ref;
67895 }
67896
67897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67898         LDKHTLCDescriptor this_ptr_conv;
67899         this_ptr_conv.inner = untag_ptr(this_ptr);
67900         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67902         this_ptr_conv.is_owned = false;
67903         void* val_ptr = untag_ptr(val);
67904         CHECK_ACCESS(val_ptr);
67905         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
67906         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
67907         HTLCDescriptor_set_preimage(&this_ptr_conv, val_conv);
67908 }
67909
67910 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
67911         LDKHTLCDescriptor this_ptr_conv;
67912         this_ptr_conv.inner = untag_ptr(this_ptr);
67913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67915         this_ptr_conv.is_owned = false;
67916         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
67917         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HTLCDescriptor_get_counterparty_sig(&this_ptr_conv).compact_form);
67918         return ret_arr;
67919 }
67920
67921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
67922         LDKHTLCDescriptor this_ptr_conv;
67923         this_ptr_conv.inner = untag_ptr(this_ptr);
67924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67926         this_ptr_conv.is_owned = false;
67927         LDKECDSASignature val_ref;
67928         CHECK((*env)->GetArrayLength(env, val) == 64);
67929         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
67930         HTLCDescriptor_set_counterparty_sig(&this_ptr_conv, val_ref);
67931 }
67932
67933 static inline uint64_t HTLCDescriptor_clone_ptr(LDKHTLCDescriptor *NONNULL_PTR arg) {
67934         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(arg);
67935         int64_t ret_ref = 0;
67936         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67937         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67938         return ret_ref;
67939 }
67940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67941         LDKHTLCDescriptor arg_conv;
67942         arg_conv.inner = untag_ptr(arg);
67943         arg_conv.is_owned = ptr_is_owned(arg);
67944         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67945         arg_conv.is_owned = false;
67946         int64_t ret_conv = HTLCDescriptor_clone_ptr(&arg_conv);
67947         return ret_conv;
67948 }
67949
67950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67951         LDKHTLCDescriptor orig_conv;
67952         orig_conv.inner = untag_ptr(orig);
67953         orig_conv.is_owned = ptr_is_owned(orig);
67954         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67955         orig_conv.is_owned = false;
67956         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(&orig_conv);
67957         int64_t ret_ref = 0;
67958         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67959         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67960         return ret_ref;
67961 }
67962
67963 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67964         LDKHTLCDescriptor a_conv;
67965         a_conv.inner = untag_ptr(a);
67966         a_conv.is_owned = ptr_is_owned(a);
67967         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67968         a_conv.is_owned = false;
67969         LDKHTLCDescriptor b_conv;
67970         b_conv.inner = untag_ptr(b);
67971         b_conv.is_owned = ptr_is_owned(b);
67972         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67973         b_conv.is_owned = false;
67974         jboolean ret_conv = HTLCDescriptor_eq(&a_conv, &b_conv);
67975         return ret_conv;
67976 }
67977
67978 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
67979         LDKHTLCDescriptor obj_conv;
67980         obj_conv.inner = untag_ptr(obj);
67981         obj_conv.is_owned = ptr_is_owned(obj);
67982         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67983         obj_conv.is_owned = false;
67984         LDKCVec_u8Z ret_var = HTLCDescriptor_write(&obj_conv);
67985         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
67986         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
67987         CVec_u8Z_free(ret_var);
67988         return ret_arr;
67989 }
67990
67991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
67992         LDKu8slice ser_ref;
67993         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
67994         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
67995         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
67996         *ret_conv = HTLCDescriptor_read(ser_ref);
67997         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
67998         return tag_ptr(ret_conv, true);
67999 }
68000
68001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
68002         LDKHTLCDescriptor this_arg_conv;
68003         this_arg_conv.inner = untag_ptr(this_arg);
68004         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68006         this_arg_conv.is_owned = false;
68007         LDKOutPoint ret_var = HTLCDescriptor_outpoint(&this_arg_conv);
68008         int64_t ret_ref = 0;
68009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68011         return ret_ref;
68012 }
68013
68014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_arg) {
68015         LDKHTLCDescriptor this_arg_conv;
68016         this_arg_conv.inner = untag_ptr(this_arg);
68017         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68019         this_arg_conv.is_owned = false;
68020         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
68021         *ret_ref = HTLCDescriptor_previous_utxo(&this_arg_conv);
68022         return tag_ptr(ret_ref, true);
68023 }
68024
68025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1unsigned_1tx_1input(JNIEnv *env, jclass clz, int64_t this_arg) {
68026         LDKHTLCDescriptor this_arg_conv;
68027         this_arg_conv.inner = untag_ptr(this_arg);
68028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68030         this_arg_conv.is_owned = false;
68031         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
68032         *ret_ref = HTLCDescriptor_unsigned_tx_input(&this_arg_conv);
68033         return tag_ptr(ret_ref, true);
68034 }
68035
68036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1tx_1output(JNIEnv *env, jclass clz, int64_t this_arg) {
68037         LDKHTLCDescriptor this_arg_conv;
68038         this_arg_conv.inner = untag_ptr(this_arg);
68039         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68041         this_arg_conv.is_owned = false;
68042         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
68043         *ret_ref = HTLCDescriptor_tx_output(&this_arg_conv);
68044         return tag_ptr(ret_ref, true);
68045 }
68046
68047 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
68048         LDKHTLCDescriptor this_arg_conv;
68049         this_arg_conv.inner = untag_ptr(this_arg);
68050         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68052         this_arg_conv.is_owned = false;
68053         LDKCVec_u8Z ret_var = HTLCDescriptor_witness_script(&this_arg_conv);
68054         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68055         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68056         CVec_u8Z_free(ret_var);
68057         return ret_arr;
68058 }
68059
68060 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) {
68061         LDKHTLCDescriptor this_arg_conv;
68062         this_arg_conv.inner = untag_ptr(this_arg);
68063         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68065         this_arg_conv.is_owned = false;
68066         LDKECDSASignature signature_ref;
68067         CHECK((*env)->GetArrayLength(env, signature) == 64);
68068         (*env)->GetByteArrayRegion(env, signature, 0, 64, signature_ref.compact_form);
68069         LDKu8slice witness_script_ref;
68070         witness_script_ref.datalen = (*env)->GetArrayLength(env, witness_script);
68071         witness_script_ref.data = (*env)->GetByteArrayElements (env, witness_script, NULL);
68072         LDKWitness ret_var = HTLCDescriptor_tx_input_witness(&this_arg_conv, signature_ref, witness_script_ref);
68073         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68074         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68075         Witness_free(ret_var);
68076         (*env)->ReleaseByteArrayElements(env, witness_script, (int8_t*)witness_script_ref.data, 0);
68077         return ret_arr;
68078 }
68079
68080 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) {
68081         LDKHTLCDescriptor this_arg_conv;
68082         this_arg_conv.inner = untag_ptr(this_arg);
68083         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68085         this_arg_conv.is_owned = false;
68086         void* signer_provider_ptr = untag_ptr(signer_provider);
68087         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
68088         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
68089         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
68090         *ret_ret = HTLCDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
68091         return tag_ptr(ret_ret, true);
68092 }
68093
68094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68095         if (!ptr_is_owned(this_ptr)) return;
68096         void* this_ptr_ptr = untag_ptr(this_ptr);
68097         CHECK_ACCESS(this_ptr_ptr);
68098         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
68099         FREE(untag_ptr(this_ptr));
68100         ChannelSigner_free(this_ptr_conv);
68101 }
68102
68103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68104         if (!ptr_is_owned(this_ptr)) return;
68105         void* this_ptr_ptr = untag_ptr(this_ptr);
68106         CHECK_ACCESS(this_ptr_ptr);
68107         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
68108         FREE(untag_ptr(this_ptr));
68109         EcdsaChannelSigner_free(this_ptr_conv);
68110 }
68111
68112 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
68113         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
68114         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
68115         return tag_ptr(ret_ret, true);
68116 }
68117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68118         void* arg_ptr = untag_ptr(arg);
68119         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
68120         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
68121         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
68122         return ret_conv;
68123 }
68124
68125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68126         void* orig_ptr = untag_ptr(orig);
68127         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
68128         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
68129         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
68130         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
68131         return tag_ptr(ret_ret, true);
68132 }
68133
68134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68135         if (!ptr_is_owned(this_ptr)) return;
68136         void* this_ptr_ptr = untag_ptr(this_ptr);
68137         CHECK_ACCESS(this_ptr_ptr);
68138         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
68139         FREE(untag_ptr(this_ptr));
68140         WriteableEcdsaChannelSigner_free(this_ptr_conv);
68141 }
68142
68143 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68144         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
68145         jclass ret_conv = LDKRecipient_to_java(env, Recipient_clone(orig_conv));
68146         return ret_conv;
68147 }
68148
68149 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1node(JNIEnv *env, jclass clz) {
68150         jclass ret_conv = LDKRecipient_to_java(env, Recipient_node());
68151         return ret_conv;
68152 }
68153
68154 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1phantom_1node(JNIEnv *env, jclass clz) {
68155         jclass ret_conv = LDKRecipient_to_java(env, Recipient_phantom_node());
68156         return ret_conv;
68157 }
68158
68159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EntropySource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68160         if (!ptr_is_owned(this_ptr)) return;
68161         void* this_ptr_ptr = untag_ptr(this_ptr);
68162         CHECK_ACCESS(this_ptr_ptr);
68163         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
68164         FREE(untag_ptr(this_ptr));
68165         EntropySource_free(this_ptr_conv);
68166 }
68167
68168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68169         if (!ptr_is_owned(this_ptr)) return;
68170         void* this_ptr_ptr = untag_ptr(this_ptr);
68171         CHECK_ACCESS(this_ptr_ptr);
68172         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
68173         FREE(untag_ptr(this_ptr));
68174         NodeSigner_free(this_ptr_conv);
68175 }
68176
68177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignerProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68178         if (!ptr_is_owned(this_ptr)) return;
68179         void* this_ptr_ptr = untag_ptr(this_ptr);
68180         CHECK_ACCESS(this_ptr_ptr);
68181         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
68182         FREE(untag_ptr(this_ptr));
68183         SignerProvider_free(this_ptr_conv);
68184 }
68185
68186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68187         LDKInMemorySigner this_obj_conv;
68188         this_obj_conv.inner = untag_ptr(this_obj);
68189         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68191         InMemorySigner_free(this_obj_conv);
68192 }
68193
68194 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
68195         LDKInMemorySigner this_ptr_conv;
68196         this_ptr_conv.inner = untag_ptr(this_ptr);
68197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68199         this_ptr_conv.is_owned = false;
68200         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68201         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
68202         return ret_arr;
68203 }
68204
68205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68206         LDKInMemorySigner this_ptr_conv;
68207         this_ptr_conv.inner = untag_ptr(this_ptr);
68208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68210         this_ptr_conv.is_owned = false;
68211         LDKSecretKey val_ref;
68212         CHECK((*env)->GetArrayLength(env, val) == 32);
68213         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
68214         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
68215 }
68216
68217 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
68218         LDKInMemorySigner this_ptr_conv;
68219         this_ptr_conv.inner = untag_ptr(this_ptr);
68220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68222         this_ptr_conv.is_owned = false;
68223         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68224         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
68225         return ret_arr;
68226 }
68227
68228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68229         LDKInMemorySigner this_ptr_conv;
68230         this_ptr_conv.inner = untag_ptr(this_ptr);
68231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68233         this_ptr_conv.is_owned = false;
68234         LDKSecretKey val_ref;
68235         CHECK((*env)->GetArrayLength(env, val) == 32);
68236         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
68237         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
68238 }
68239
68240 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
68241         LDKInMemorySigner this_ptr_conv;
68242         this_ptr_conv.inner = untag_ptr(this_ptr);
68243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68245         this_ptr_conv.is_owned = false;
68246         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68247         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
68248         return ret_arr;
68249 }
68250
68251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68252         LDKInMemorySigner this_ptr_conv;
68253         this_ptr_conv.inner = untag_ptr(this_ptr);
68254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68256         this_ptr_conv.is_owned = false;
68257         LDKSecretKey val_ref;
68258         CHECK((*env)->GetArrayLength(env, val) == 32);
68259         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
68260         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
68261 }
68262
68263 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
68264         LDKInMemorySigner this_ptr_conv;
68265         this_ptr_conv.inner = untag_ptr(this_ptr);
68266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68268         this_ptr_conv.is_owned = false;
68269         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68270         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
68271         return ret_arr;
68272 }
68273
68274 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) {
68275         LDKInMemorySigner this_ptr_conv;
68276         this_ptr_conv.inner = untag_ptr(this_ptr);
68277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68279         this_ptr_conv.is_owned = false;
68280         LDKSecretKey val_ref;
68281         CHECK((*env)->GetArrayLength(env, val) == 32);
68282         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
68283         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
68284 }
68285
68286 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
68287         LDKInMemorySigner this_ptr_conv;
68288         this_ptr_conv.inner = untag_ptr(this_ptr);
68289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68291         this_ptr_conv.is_owned = false;
68292         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68293         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
68294         return ret_arr;
68295 }
68296
68297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68298         LDKInMemorySigner this_ptr_conv;
68299         this_ptr_conv.inner = untag_ptr(this_ptr);
68300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68302         this_ptr_conv.is_owned = false;
68303         LDKSecretKey val_ref;
68304         CHECK((*env)->GetArrayLength(env, val) == 32);
68305         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
68306         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
68307 }
68308
68309 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
68310         LDKInMemorySigner this_ptr_conv;
68311         this_ptr_conv.inner = untag_ptr(this_ptr);
68312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68314         this_ptr_conv.is_owned = false;
68315         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68316         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
68317         return ret_arr;
68318 }
68319
68320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68321         LDKInMemorySigner this_ptr_conv;
68322         this_ptr_conv.inner = untag_ptr(this_ptr);
68323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68325         this_ptr_conv.is_owned = false;
68326         LDKThirtyTwoBytes val_ref;
68327         CHECK((*env)->GetArrayLength(env, val) == 32);
68328         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
68329         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
68330 }
68331
68332 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
68333         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
68334         int64_t ret_ref = 0;
68335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68337         return ret_ref;
68338 }
68339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68340         LDKInMemorySigner arg_conv;
68341         arg_conv.inner = untag_ptr(arg);
68342         arg_conv.is_owned = ptr_is_owned(arg);
68343         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68344         arg_conv.is_owned = false;
68345         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
68346         return ret_conv;
68347 }
68348
68349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68350         LDKInMemorySigner orig_conv;
68351         orig_conv.inner = untag_ptr(orig);
68352         orig_conv.is_owned = ptr_is_owned(orig);
68353         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68354         orig_conv.is_owned = false;
68355         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
68356         int64_t ret_ref = 0;
68357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68359         return ret_ref;
68360 }
68361
68362 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) {
68363         LDKSecretKey funding_key_ref;
68364         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
68365         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
68366         LDKSecretKey revocation_base_key_ref;
68367         CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
68368         (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
68369         LDKSecretKey payment_key_ref;
68370         CHECK((*env)->GetArrayLength(env, payment_key) == 32);
68371         (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
68372         LDKSecretKey delayed_payment_base_key_ref;
68373         CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
68374         (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
68375         LDKSecretKey htlc_base_key_ref;
68376         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
68377         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
68378         LDKThirtyTwoBytes commitment_seed_ref;
68379         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
68380         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
68381         LDKThirtyTwoBytes channel_keys_id_ref;
68382         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
68383         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
68384         LDKThirtyTwoBytes rand_bytes_unique_start_ref;
68385         CHECK((*env)->GetArrayLength(env, rand_bytes_unique_start) == 32);
68386         (*env)->GetByteArrayRegion(env, rand_bytes_unique_start, 0, 32, rand_bytes_unique_start_ref.data);
68387         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);
68388         int64_t ret_ref = 0;
68389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68391         return ret_ref;
68392 }
68393
68394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
68395         LDKInMemorySigner this_arg_conv;
68396         this_arg_conv.inner = untag_ptr(this_arg);
68397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68399         this_arg_conv.is_owned = false;
68400         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
68401         int64_t ret_ref = 0;
68402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68404         return ret_ref;
68405 }
68406
68407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
68408         LDKInMemorySigner this_arg_conv;
68409         this_arg_conv.inner = untag_ptr(this_arg);
68410         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68412         this_arg_conv.is_owned = false;
68413         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
68414         *ret_copy = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
68415         int64_t ret_ref = tag_ptr(ret_copy, true);
68416         return ret_ref;
68417 }
68418
68419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
68420         LDKInMemorySigner this_arg_conv;
68421         this_arg_conv.inner = untag_ptr(this_arg);
68422         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68424         this_arg_conv.is_owned = false;
68425         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
68426         *ret_copy = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
68427         int64_t ret_ref = tag_ptr(ret_copy, true);
68428         return ret_ref;
68429 }
68430
68431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
68432         LDKInMemorySigner this_arg_conv;
68433         this_arg_conv.inner = untag_ptr(this_arg);
68434         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68436         this_arg_conv.is_owned = false;
68437         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
68438         *ret_copy = InMemorySigner_is_outbound(&this_arg_conv);
68439         int64_t ret_ref = tag_ptr(ret_copy, true);
68440         return ret_ref;
68441 }
68442
68443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
68444         LDKInMemorySigner this_arg_conv;
68445         this_arg_conv.inner = untag_ptr(this_arg);
68446         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68448         this_arg_conv.is_owned = false;
68449         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
68450         int64_t ret_ref = 0;
68451         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68452         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68453         return ret_ref;
68454 }
68455
68456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
68457         LDKInMemorySigner this_arg_conv;
68458         this_arg_conv.inner = untag_ptr(this_arg);
68459         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68461         this_arg_conv.is_owned = false;
68462         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
68463         int64_t ret_ref = 0;
68464         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68465         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68466         return ret_ref;
68467 }
68468
68469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
68470         LDKInMemorySigner this_arg_conv;
68471         this_arg_conv.inner = untag_ptr(this_arg);
68472         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68474         this_arg_conv.is_owned = false;
68475         LDKChannelTypeFeatures ret_var = InMemorySigner_channel_type_features(&this_arg_conv);
68476         int64_t ret_ref = 0;
68477         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68478         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68479         return ret_ref;
68480 }
68481
68482 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) {
68483         LDKInMemorySigner this_arg_conv;
68484         this_arg_conv.inner = untag_ptr(this_arg);
68485         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68487         this_arg_conv.is_owned = false;
68488         LDKTransaction spend_tx_ref;
68489         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
68490         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
68491         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
68492         spend_tx_ref.data_is_owned = true;
68493         LDKStaticPaymentOutputDescriptor descriptor_conv;
68494         descriptor_conv.inner = untag_ptr(descriptor);
68495         descriptor_conv.is_owned = ptr_is_owned(descriptor);
68496         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
68497         descriptor_conv.is_owned = false;
68498         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
68499         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
68500         return tag_ptr(ret_conv, true);
68501 }
68502
68503 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) {
68504         LDKInMemorySigner this_arg_conv;
68505         this_arg_conv.inner = untag_ptr(this_arg);
68506         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68508         this_arg_conv.is_owned = false;
68509         LDKTransaction spend_tx_ref;
68510         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
68511         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
68512         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
68513         spend_tx_ref.data_is_owned = true;
68514         LDKDelayedPaymentOutputDescriptor descriptor_conv;
68515         descriptor_conv.inner = untag_ptr(descriptor);
68516         descriptor_conv.is_owned = ptr_is_owned(descriptor);
68517         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
68518         descriptor_conv.is_owned = false;
68519         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
68520         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
68521         return tag_ptr(ret_conv, true);
68522 }
68523
68524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
68525         LDKInMemorySigner this_arg_conv;
68526         this_arg_conv.inner = untag_ptr(this_arg);
68527         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68529         this_arg_conv.is_owned = false;
68530         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
68531         *ret_ret = InMemorySigner_as_EntropySource(&this_arg_conv);
68532         return tag_ptr(ret_ret, true);
68533 }
68534
68535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1ChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
68536         LDKInMemorySigner this_arg_conv;
68537         this_arg_conv.inner = untag_ptr(this_arg);
68538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68540         this_arg_conv.is_owned = false;
68541         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
68542         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
68543         return tag_ptr(ret_ret, true);
68544 }
68545
68546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1EcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
68547         LDKInMemorySigner this_arg_conv;
68548         this_arg_conv.inner = untag_ptr(this_arg);
68549         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68551         this_arg_conv.is_owned = false;
68552         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
68553         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
68554         return tag_ptr(ret_ret, true);
68555 }
68556
68557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1WriteableEcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
68558         LDKInMemorySigner this_arg_conv;
68559         this_arg_conv.inner = untag_ptr(this_arg);
68560         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68562         this_arg_conv.is_owned = false;
68563         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
68564         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
68565         return tag_ptr(ret_ret, true);
68566 }
68567
68568 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
68569         LDKInMemorySigner obj_conv;
68570         obj_conv.inner = untag_ptr(obj);
68571         obj_conv.is_owned = ptr_is_owned(obj);
68572         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68573         obj_conv.is_owned = false;
68574         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
68575         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68576         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68577         CVec_u8Z_free(ret_var);
68578         return ret_arr;
68579 }
68580
68581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
68582         LDKu8slice ser_ref;
68583         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
68584         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
68585         void* arg_ptr = untag_ptr(arg);
68586         CHECK_ACCESS(arg_ptr);
68587         LDKEntropySource arg_conv = *(LDKEntropySource*)(arg_ptr);
68588         if (arg_conv.free == LDKEntropySource_JCalls_free) {
68589                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
68590                 LDKEntropySource_JCalls_cloned(&arg_conv);
68591         }
68592         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
68593         *ret_conv = InMemorySigner_read(ser_ref, arg_conv);
68594         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
68595         return tag_ptr(ret_conv, true);
68596 }
68597
68598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68599         LDKKeysManager this_obj_conv;
68600         this_obj_conv.inner = untag_ptr(this_obj);
68601         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68603         KeysManager_free(this_obj_conv);
68604 }
68605
68606 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) {
68607         uint8_t seed_arr[32];
68608         CHECK((*env)->GetArrayLength(env, seed) == 32);
68609         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
68610         uint8_t (*seed_ref)[32] = &seed_arr;
68611         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
68612         int64_t ret_ref = 0;
68613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68615         return ret_ref;
68616 }
68617
68618 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysManager_1get_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
68619         LDKKeysManager this_arg_conv;
68620         this_arg_conv.inner = untag_ptr(this_arg);
68621         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68623         this_arg_conv.is_owned = false;
68624         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68625         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, KeysManager_get_node_secret_key(&this_arg_conv).bytes);
68626         return ret_arr;
68627 }
68628
68629 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) {
68630         LDKKeysManager this_arg_conv;
68631         this_arg_conv.inner = untag_ptr(this_arg);
68632         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68634         this_arg_conv.is_owned = false;
68635         uint8_t params_arr[32];
68636         CHECK((*env)->GetArrayLength(env, params) == 32);
68637         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
68638         uint8_t (*params_ref)[32] = &params_arr;
68639         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
68640         int64_t ret_ref = 0;
68641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68643         return ret_ref;
68644 }
68645
68646 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) {
68647         LDKKeysManager this_arg_conv;
68648         this_arg_conv.inner = untag_ptr(this_arg);
68649         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68651         this_arg_conv.is_owned = false;
68652         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
68653         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
68654         if (descriptors_constr.datalen > 0)
68655                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
68656         else
68657                 descriptors_constr.data = NULL;
68658         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
68659         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
68660                 int64_t descriptors_conv_27 = descriptors_vals[b];
68661                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
68662                 CHECK_ACCESS(descriptors_conv_27_ptr);
68663                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
68664                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
68665                 descriptors_constr.data[b] = descriptors_conv_27_conv;
68666         }
68667         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
68668         LDKCVec_u8Z psbt_ref;
68669         psbt_ref.datalen = (*env)->GetArrayLength(env, psbt);
68670         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
68671         (*env)->GetByteArrayRegion(env, psbt, 0, psbt_ref.datalen, psbt_ref.data);
68672         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
68673         *ret_conv = KeysManager_sign_spendable_outputs_psbt(&this_arg_conv, descriptors_constr, psbt_ref);
68674         return tag_ptr(ret_conv, true);
68675 }
68676
68677 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) {
68678         LDKKeysManager this_arg_conv;
68679         this_arg_conv.inner = untag_ptr(this_arg);
68680         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68682         this_arg_conv.is_owned = false;
68683         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
68684         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
68685         if (descriptors_constr.datalen > 0)
68686                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
68687         else
68688                 descriptors_constr.data = NULL;
68689         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
68690         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
68691                 int64_t descriptors_conv_27 = descriptors_vals[b];
68692                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
68693                 CHECK_ACCESS(descriptors_conv_27_ptr);
68694                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
68695                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
68696                 descriptors_constr.data[b] = descriptors_conv_27_conv;
68697         }
68698         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
68699         LDKCVec_TxOutZ outputs_constr;
68700         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
68701         if (outputs_constr.datalen > 0)
68702                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
68703         else
68704                 outputs_constr.data = NULL;
68705         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
68706         for (size_t h = 0; h < outputs_constr.datalen; h++) {
68707                 int64_t outputs_conv_7 = outputs_vals[h];
68708                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
68709                 CHECK_ACCESS(outputs_conv_7_ptr);
68710                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
68711                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
68712                 outputs_constr.data[h] = outputs_conv_7_conv;
68713         }
68714         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
68715         LDKCVec_u8Z change_destination_script_ref;
68716         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
68717         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
68718         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
68719         void* locktime_ptr = untag_ptr(locktime);
68720         CHECK_ACCESS(locktime_ptr);
68721         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
68722         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
68723         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
68724         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
68725         return tag_ptr(ret_conv, true);
68726 }
68727
68728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
68729         LDKKeysManager this_arg_conv;
68730         this_arg_conv.inner = untag_ptr(this_arg);
68731         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68733         this_arg_conv.is_owned = false;
68734         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
68735         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
68736         return tag_ptr(ret_ret, true);
68737 }
68738
68739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1NodeSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
68740         LDKKeysManager this_arg_conv;
68741         this_arg_conv.inner = untag_ptr(this_arg);
68742         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68744         this_arg_conv.is_owned = false;
68745         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
68746         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
68747         return tag_ptr(ret_ret, true);
68748 }
68749
68750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1SignerProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
68751         LDKKeysManager this_arg_conv;
68752         this_arg_conv.inner = untag_ptr(this_arg);
68753         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68755         this_arg_conv.is_owned = false;
68756         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
68757         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
68758         return tag_ptr(ret_ret, true);
68759 }
68760
68761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68762         LDKPhantomKeysManager this_obj_conv;
68763         this_obj_conv.inner = untag_ptr(this_obj);
68764         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68766         PhantomKeysManager_free(this_obj_conv);
68767 }
68768
68769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
68770         LDKPhantomKeysManager this_arg_conv;
68771         this_arg_conv.inner = untag_ptr(this_arg);
68772         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68774         this_arg_conv.is_owned = false;
68775         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
68776         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
68777         return tag_ptr(ret_ret, true);
68778 }
68779
68780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1NodeSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
68781         LDKPhantomKeysManager this_arg_conv;
68782         this_arg_conv.inner = untag_ptr(this_arg);
68783         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68785         this_arg_conv.is_owned = false;
68786         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
68787         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
68788         return tag_ptr(ret_ret, true);
68789 }
68790
68791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1SignerProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
68792         LDKPhantomKeysManager this_arg_conv;
68793         this_arg_conv.inner = untag_ptr(this_arg);
68794         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68796         this_arg_conv.is_owned = false;
68797         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
68798         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
68799         return tag_ptr(ret_ret, true);
68800 }
68801
68802 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) {
68803         uint8_t seed_arr[32];
68804         CHECK((*env)->GetArrayLength(env, seed) == 32);
68805         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
68806         uint8_t (*seed_ref)[32] = &seed_arr;
68807         uint8_t cross_node_seed_arr[32];
68808         CHECK((*env)->GetArrayLength(env, cross_node_seed) == 32);
68809         (*env)->GetByteArrayRegion(env, cross_node_seed, 0, 32, cross_node_seed_arr);
68810         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
68811         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
68812         int64_t ret_ref = 0;
68813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68815         return ret_ref;
68816 }
68817
68818 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) {
68819         LDKPhantomKeysManager this_arg_conv;
68820         this_arg_conv.inner = untag_ptr(this_arg);
68821         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68823         this_arg_conv.is_owned = false;
68824         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
68825         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
68826         if (descriptors_constr.datalen > 0)
68827                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
68828         else
68829                 descriptors_constr.data = NULL;
68830         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
68831         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
68832                 int64_t descriptors_conv_27 = descriptors_vals[b];
68833                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
68834                 CHECK_ACCESS(descriptors_conv_27_ptr);
68835                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
68836                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
68837                 descriptors_constr.data[b] = descriptors_conv_27_conv;
68838         }
68839         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
68840         LDKCVec_TxOutZ outputs_constr;
68841         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
68842         if (outputs_constr.datalen > 0)
68843                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
68844         else
68845                 outputs_constr.data = NULL;
68846         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
68847         for (size_t h = 0; h < outputs_constr.datalen; h++) {
68848                 int64_t outputs_conv_7 = outputs_vals[h];
68849                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
68850                 CHECK_ACCESS(outputs_conv_7_ptr);
68851                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
68852                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
68853                 outputs_constr.data[h] = outputs_conv_7_conv;
68854         }
68855         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
68856         LDKCVec_u8Z change_destination_script_ref;
68857         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
68858         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
68859         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
68860         void* locktime_ptr = untag_ptr(locktime);
68861         CHECK_ACCESS(locktime_ptr);
68862         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
68863         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
68864         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
68865         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
68866         return tag_ptr(ret_conv, true);
68867 }
68868
68869 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) {
68870         LDKPhantomKeysManager this_arg_conv;
68871         this_arg_conv.inner = untag_ptr(this_arg);
68872         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68874         this_arg_conv.is_owned = false;
68875         uint8_t params_arr[32];
68876         CHECK((*env)->GetArrayLength(env, params) == 32);
68877         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
68878         uint8_t (*params_ref)[32] = &params_arr;
68879         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
68880         int64_t ret_ref = 0;
68881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68883         return ret_ref;
68884 }
68885
68886 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1get_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
68887         LDKPhantomKeysManager this_arg_conv;
68888         this_arg_conv.inner = untag_ptr(this_arg);
68889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68891         this_arg_conv.is_owned = false;
68892         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68893         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes);
68894         return ret_arr;
68895 }
68896
68897 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1get_1phantom_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
68898         LDKPhantomKeysManager this_arg_conv;
68899         this_arg_conv.inner = untag_ptr(this_arg);
68900         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68902         this_arg_conv.is_owned = false;
68903         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68904         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes);
68905         return ret_arr;
68906 }
68907
68908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68909         LDKOnionMessenger this_obj_conv;
68910         this_obj_conv.inner = untag_ptr(this_obj);
68911         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68913         OnionMessenger_free(this_obj_conv);
68914 }
68915
68916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageRouter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68917         if (!ptr_is_owned(this_ptr)) return;
68918         void* this_ptr_ptr = untag_ptr(this_ptr);
68919         CHECK_ACCESS(this_ptr_ptr);
68920         LDKMessageRouter this_ptr_conv = *(LDKMessageRouter*)(this_ptr_ptr);
68921         FREE(untag_ptr(this_ptr));
68922         MessageRouter_free(this_ptr_conv);
68923 }
68924
68925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68926         LDKDefaultMessageRouter this_obj_conv;
68927         this_obj_conv.inner = untag_ptr(this_obj);
68928         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68930         DefaultMessageRouter_free(this_obj_conv);
68931 }
68932
68933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1new(JNIEnv *env, jclass clz) {
68934         LDKDefaultMessageRouter ret_var = DefaultMessageRouter_new();
68935         int64_t ret_ref = 0;
68936         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68937         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68938         return ret_ref;
68939 }
68940
68941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1as_1MessageRouter(JNIEnv *env, jclass clz, int64_t this_arg) {
68942         LDKDefaultMessageRouter this_arg_conv;
68943         this_arg_conv.inner = untag_ptr(this_arg);
68944         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68946         this_arg_conv.is_owned = false;
68947         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
68948         *ret_ret = DefaultMessageRouter_as_MessageRouter(&this_arg_conv);
68949         return tag_ptr(ret_ret, true);
68950 }
68951
68952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68953         LDKOnionMessagePath this_obj_conv;
68954         this_obj_conv.inner = untag_ptr(this_obj);
68955         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68957         OnionMessagePath_free(this_obj_conv);
68958 }
68959
68960 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1get_1intermediate_1nodes(JNIEnv *env, jclass clz, int64_t this_ptr) {
68961         LDKOnionMessagePath this_ptr_conv;
68962         this_ptr_conv.inner = untag_ptr(this_ptr);
68963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68965         this_ptr_conv.is_owned = false;
68966         LDKCVec_PublicKeyZ ret_var = OnionMessagePath_get_intermediate_nodes(&this_ptr_conv);
68967         jobjectArray ret_arr = NULL;
68968         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
68969         ;
68970         for (size_t i = 0; i < ret_var.datalen; i++) {
68971                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
68972                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
68973                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
68974         }
68975         
68976         FREE(ret_var.data);
68977         return ret_arr;
68978 }
68979
68980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1set_1intermediate_1nodes(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
68981         LDKOnionMessagePath this_ptr_conv;
68982         this_ptr_conv.inner = untag_ptr(this_ptr);
68983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68985         this_ptr_conv.is_owned = false;
68986         LDKCVec_PublicKeyZ val_constr;
68987         val_constr.datalen = (*env)->GetArrayLength(env, val);
68988         if (val_constr.datalen > 0)
68989                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
68990         else
68991                 val_constr.data = NULL;
68992         for (size_t i = 0; i < val_constr.datalen; i++) {
68993                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
68994                 LDKPublicKey val_conv_8_ref;
68995                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 33);
68996                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 33, val_conv_8_ref.compressed_form);
68997                 val_constr.data[i] = val_conv_8_ref;
68998         }
68999         OnionMessagePath_set_intermediate_nodes(&this_ptr_conv, val_constr);
69000 }
69001
69002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1get_1destination(JNIEnv *env, jclass clz, int64_t this_ptr) {
69003         LDKOnionMessagePath this_ptr_conv;
69004         this_ptr_conv.inner = untag_ptr(this_ptr);
69005         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69007         this_ptr_conv.is_owned = false;
69008         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
69009         *ret_copy = OnionMessagePath_get_destination(&this_ptr_conv);
69010         int64_t ret_ref = tag_ptr(ret_copy, true);
69011         return ret_ref;
69012 }
69013
69014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1set_1destination(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
69015         LDKOnionMessagePath this_ptr_conv;
69016         this_ptr_conv.inner = untag_ptr(this_ptr);
69017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69019         this_ptr_conv.is_owned = false;
69020         void* val_ptr = untag_ptr(val);
69021         CHECK_ACCESS(val_ptr);
69022         LDKDestination val_conv = *(LDKDestination*)(val_ptr);
69023         val_conv = Destination_clone((LDKDestination*)untag_ptr(val));
69024         OnionMessagePath_set_destination(&this_ptr_conv, val_conv);
69025 }
69026
69027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1new(JNIEnv *env, jclass clz, jobjectArray intermediate_nodes_arg, int64_t destination_arg) {
69028         LDKCVec_PublicKeyZ intermediate_nodes_arg_constr;
69029         intermediate_nodes_arg_constr.datalen = (*env)->GetArrayLength(env, intermediate_nodes_arg);
69030         if (intermediate_nodes_arg_constr.datalen > 0)
69031                 intermediate_nodes_arg_constr.data = MALLOC(intermediate_nodes_arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
69032         else
69033                 intermediate_nodes_arg_constr.data = NULL;
69034         for (size_t i = 0; i < intermediate_nodes_arg_constr.datalen; i++) {
69035                 int8_tArray intermediate_nodes_arg_conv_8 = (*env)->GetObjectArrayElement(env, intermediate_nodes_arg, i);
69036                 LDKPublicKey intermediate_nodes_arg_conv_8_ref;
69037                 CHECK((*env)->GetArrayLength(env, intermediate_nodes_arg_conv_8) == 33);
69038                 (*env)->GetByteArrayRegion(env, intermediate_nodes_arg_conv_8, 0, 33, intermediate_nodes_arg_conv_8_ref.compressed_form);
69039                 intermediate_nodes_arg_constr.data[i] = intermediate_nodes_arg_conv_8_ref;
69040         }
69041         void* destination_arg_ptr = untag_ptr(destination_arg);
69042         CHECK_ACCESS(destination_arg_ptr);
69043         LDKDestination destination_arg_conv = *(LDKDestination*)(destination_arg_ptr);
69044         destination_arg_conv = Destination_clone((LDKDestination*)untag_ptr(destination_arg));
69045         LDKOnionMessagePath ret_var = OnionMessagePath_new(intermediate_nodes_arg_constr, destination_arg_conv);
69046         int64_t ret_ref = 0;
69047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69049         return ret_ref;
69050 }
69051
69052 static inline uint64_t OnionMessagePath_clone_ptr(LDKOnionMessagePath *NONNULL_PTR arg) {
69053         LDKOnionMessagePath ret_var = OnionMessagePath_clone(arg);
69054         int64_t ret_ref = 0;
69055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69057         return ret_ref;
69058 }
69059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69060         LDKOnionMessagePath arg_conv;
69061         arg_conv.inner = untag_ptr(arg);
69062         arg_conv.is_owned = ptr_is_owned(arg);
69063         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69064         arg_conv.is_owned = false;
69065         int64_t ret_conv = OnionMessagePath_clone_ptr(&arg_conv);
69066         return ret_conv;
69067 }
69068
69069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69070         LDKOnionMessagePath orig_conv;
69071         orig_conv.inner = untag_ptr(orig);
69072         orig_conv.is_owned = ptr_is_owned(orig);
69073         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69074         orig_conv.is_owned = false;
69075         LDKOnionMessagePath ret_var = OnionMessagePath_clone(&orig_conv);
69076         int64_t ret_ref = 0;
69077         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69078         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69079         return ret_ref;
69080 }
69081
69082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Destination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69083         if (!ptr_is_owned(this_ptr)) return;
69084         void* this_ptr_ptr = untag_ptr(this_ptr);
69085         CHECK_ACCESS(this_ptr_ptr);
69086         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
69087         FREE(untag_ptr(this_ptr));
69088         Destination_free(this_ptr_conv);
69089 }
69090
69091 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
69092         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
69093         *ret_copy = Destination_clone(arg);
69094         int64_t ret_ref = tag_ptr(ret_copy, true);
69095         return ret_ref;
69096 }
69097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69098         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
69099         int64_t ret_conv = Destination_clone_ptr(arg_conv);
69100         return ret_conv;
69101 }
69102
69103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69104         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
69105         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
69106         *ret_copy = Destination_clone(orig_conv);
69107         int64_t ret_ref = tag_ptr(ret_copy, true);
69108         return ret_ref;
69109 }
69110
69111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1node(JNIEnv *env, jclass clz, int8_tArray a) {
69112         LDKPublicKey a_ref;
69113         CHECK((*env)->GetArrayLength(env, a) == 33);
69114         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
69115         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
69116         *ret_copy = Destination_node(a_ref);
69117         int64_t ret_ref = tag_ptr(ret_copy, true);
69118         return ret_ref;
69119 }
69120
69121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1blinded_1path(JNIEnv *env, jclass clz, int64_t a) {
69122         LDKBlindedPath a_conv;
69123         a_conv.inner = untag_ptr(a);
69124         a_conv.is_owned = ptr_is_owned(a);
69125         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69126         a_conv = BlindedPath_clone(&a_conv);
69127         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
69128         *ret_copy = Destination_blinded_path(a_conv);
69129         int64_t ret_ref = tag_ptr(ret_copy, true);
69130         return ret_ref;
69131 }
69132
69133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SendError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69134         if (!ptr_is_owned(this_ptr)) return;
69135         void* this_ptr_ptr = untag_ptr(this_ptr);
69136         CHECK_ACCESS(this_ptr_ptr);
69137         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
69138         FREE(untag_ptr(this_ptr));
69139         SendError_free(this_ptr_conv);
69140 }
69141
69142 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
69143         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69144         *ret_copy = SendError_clone(arg);
69145         int64_t ret_ref = tag_ptr(ret_copy, true);
69146         return ret_ref;
69147 }
69148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69149         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
69150         int64_t ret_conv = SendError_clone_ptr(arg_conv);
69151         return ret_conv;
69152 }
69153
69154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69155         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
69156         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69157         *ret_copy = SendError_clone(orig_conv);
69158         int64_t ret_ref = tag_ptr(ret_copy, true);
69159         return ret_ref;
69160 }
69161
69162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1secp256k1(JNIEnv *env, jclass clz, jclass a) {
69163         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
69164         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69165         *ret_copy = SendError_secp256k1(a_conv);
69166         int64_t ret_ref = tag_ptr(ret_copy, true);
69167         return ret_ref;
69168 }
69169
69170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1too_1big_1packet(JNIEnv *env, jclass clz) {
69171         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69172         *ret_copy = SendError_too_big_packet();
69173         int64_t ret_ref = tag_ptr(ret_copy, true);
69174         return ret_ref;
69175 }
69176
69177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1too_1few_1blinded_1hops(JNIEnv *env, jclass clz) {
69178         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69179         *ret_copy = SendError_too_few_blinded_hops();
69180         int64_t ret_ref = tag_ptr(ret_copy, true);
69181         return ret_ref;
69182 }
69183
69184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1invalid_1first_1hop(JNIEnv *env, jclass clz) {
69185         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69186         *ret_copy = SendError_invalid_first_hop();
69187         int64_t ret_ref = tag_ptr(ret_copy, true);
69188         return ret_ref;
69189 }
69190
69191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1invalid_1message(JNIEnv *env, jclass clz) {
69192         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69193         *ret_copy = SendError_invalid_message();
69194         int64_t ret_ref = tag_ptr(ret_copy, true);
69195         return ret_ref;
69196 }
69197
69198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1buffer_1full(JNIEnv *env, jclass clz) {
69199         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69200         *ret_copy = SendError_buffer_full();
69201         int64_t ret_ref = tag_ptr(ret_copy, true);
69202         return ret_ref;
69203 }
69204
69205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1get_1node_1id_1failed(JNIEnv *env, jclass clz) {
69206         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69207         *ret_copy = SendError_get_node_id_failed();
69208         int64_t ret_ref = tag_ptr(ret_copy, true);
69209         return ret_ref;
69210 }
69211
69212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1blinded_1path_1advance_1failed(JNIEnv *env, jclass clz) {
69213         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69214         *ret_copy = SendError_blinded_path_advance_failed();
69215         int64_t ret_ref = tag_ptr(ret_copy, true);
69216         return ret_ref;
69217 }
69218
69219 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SendError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
69220         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
69221         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
69222         jboolean ret_conv = SendError_eq(a_conv, b_conv);
69223         return ret_conv;
69224 }
69225
69226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69227         if (!ptr_is_owned(this_ptr)) return;
69228         void* this_ptr_ptr = untag_ptr(this_ptr);
69229         CHECK_ACCESS(this_ptr_ptr);
69230         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
69231         FREE(untag_ptr(this_ptr));
69232         CustomOnionMessageHandler_free(this_ptr_conv);
69233 }
69234
69235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69236         if (!ptr_is_owned(this_ptr)) return;
69237         void* this_ptr_ptr = untag_ptr(this_ptr);
69238         CHECK_ACCESS(this_ptr_ptr);
69239         LDKPeeledOnion this_ptr_conv = *(LDKPeeledOnion*)(this_ptr_ptr);
69240         FREE(untag_ptr(this_ptr));
69241         PeeledOnion_free(this_ptr_conv);
69242 }
69243
69244 static inline uint64_t PeeledOnion_clone_ptr(LDKPeeledOnion *NONNULL_PTR arg) {
69245         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
69246         *ret_copy = PeeledOnion_clone(arg);
69247         int64_t ret_ref = tag_ptr(ret_copy, true);
69248         return ret_ref;
69249 }
69250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69251         LDKPeeledOnion* arg_conv = (LDKPeeledOnion*)untag_ptr(arg);
69252         int64_t ret_conv = PeeledOnion_clone_ptr(arg_conv);
69253         return ret_conv;
69254 }
69255
69256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69257         LDKPeeledOnion* orig_conv = (LDKPeeledOnion*)untag_ptr(orig);
69258         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
69259         *ret_copy = PeeledOnion_clone(orig_conv);
69260         int64_t ret_ref = tag_ptr(ret_copy, true);
69261         return ret_ref;
69262 }
69263
69264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1forward(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
69265         LDKPublicKey a_ref;
69266         CHECK((*env)->GetArrayLength(env, a) == 33);
69267         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
69268         LDKOnionMessage b_conv;
69269         b_conv.inner = untag_ptr(b);
69270         b_conv.is_owned = ptr_is_owned(b);
69271         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69272         b_conv = OnionMessage_clone(&b_conv);
69273         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
69274         *ret_copy = PeeledOnion_forward(a_ref, b_conv);
69275         int64_t ret_ref = tag_ptr(ret_copy, true);
69276         return ret_ref;
69277 }
69278
69279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1receive(JNIEnv *env, jclass clz, int64_t a, int8_tArray b, int64_t c) {
69280         void* a_ptr = untag_ptr(a);
69281         CHECK_ACCESS(a_ptr);
69282         LDKParsedOnionMessageContents a_conv = *(LDKParsedOnionMessageContents*)(a_ptr);
69283         a_conv = ParsedOnionMessageContents_clone((LDKParsedOnionMessageContents*)untag_ptr(a));
69284         LDKThirtyTwoBytes b_ref;
69285         CHECK((*env)->GetArrayLength(env, b) == 32);
69286         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
69287         LDKBlindedPath c_conv;
69288         c_conv.inner = untag_ptr(c);
69289         c_conv.is_owned = ptr_is_owned(c);
69290         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
69291         c_conv = BlindedPath_clone(&c_conv);
69292         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
69293         *ret_copy = PeeledOnion_receive(a_conv, b_ref, c_conv);
69294         int64_t ret_ref = tag_ptr(ret_copy, true);
69295         return ret_ref;
69296 }
69297
69298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1onion_1message(JNIEnv *env, jclass clz, int64_t entropy_source, int64_t node_signer, int64_t path, int64_t contents, int64_t reply_path) {
69299         void* entropy_source_ptr = untag_ptr(entropy_source);
69300         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
69301         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
69302         void* node_signer_ptr = untag_ptr(node_signer);
69303         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
69304         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
69305         LDKOnionMessagePath path_conv;
69306         path_conv.inner = untag_ptr(path);
69307         path_conv.is_owned = ptr_is_owned(path);
69308         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
69309         path_conv = OnionMessagePath_clone(&path_conv);
69310         void* contents_ptr = untag_ptr(contents);
69311         CHECK_ACCESS(contents_ptr);
69312         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
69313         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
69314                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69315                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
69316         }
69317         LDKBlindedPath reply_path_conv;
69318         reply_path_conv.inner = untag_ptr(reply_path);
69319         reply_path_conv.is_owned = ptr_is_owned(reply_path);
69320         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
69321         reply_path_conv = BlindedPath_clone(&reply_path_conv);
69322         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ), "LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ");
69323         *ret_conv = create_onion_message(entropy_source_conv, node_signer_conv, path_conv, contents_conv, reply_path_conv);
69324         return tag_ptr(ret_conv, true);
69325 }
69326
69327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_peel_1onion_1message(JNIEnv *env, jclass clz, int64_t msg, int64_t node_signer, int64_t logger, int64_t custom_handler) {
69328         LDKOnionMessage msg_conv;
69329         msg_conv.inner = untag_ptr(msg);
69330         msg_conv.is_owned = ptr_is_owned(msg);
69331         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69332         msg_conv.is_owned = false;
69333         void* node_signer_ptr = untag_ptr(node_signer);
69334         CHECK_ACCESS(node_signer_ptr);
69335         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69336         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69337                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69338                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69339         }
69340         void* logger_ptr = untag_ptr(logger);
69341         CHECK_ACCESS(logger_ptr);
69342         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69343         if (logger_conv.free == LDKLogger_JCalls_free) {
69344                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69345                 LDKLogger_JCalls_cloned(&logger_conv);
69346         }
69347         void* custom_handler_ptr = untag_ptr(custom_handler);
69348         CHECK_ACCESS(custom_handler_ptr);
69349         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
69350         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
69351                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69352                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
69353         }
69354         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
69355         *ret_conv = peel_onion_message(&msg_conv, node_signer_conv, logger_conv, custom_handler_conv);
69356         return tag_ptr(ret_conv, true);
69357 }
69358
69359 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) {
69360         void* entropy_source_ptr = untag_ptr(entropy_source);
69361         CHECK_ACCESS(entropy_source_ptr);
69362         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
69363         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
69364                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69365                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
69366         }
69367         void* node_signer_ptr = untag_ptr(node_signer);
69368         CHECK_ACCESS(node_signer_ptr);
69369         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69370         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69371                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69372                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69373         }
69374         void* logger_ptr = untag_ptr(logger);
69375         CHECK_ACCESS(logger_ptr);
69376         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69377         if (logger_conv.free == LDKLogger_JCalls_free) {
69378                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69379                 LDKLogger_JCalls_cloned(&logger_conv);
69380         }
69381         void* message_router_ptr = untag_ptr(message_router);
69382         CHECK_ACCESS(message_router_ptr);
69383         LDKMessageRouter message_router_conv = *(LDKMessageRouter*)(message_router_ptr);
69384         if (message_router_conv.free == LDKMessageRouter_JCalls_free) {
69385                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69386                 LDKMessageRouter_JCalls_cloned(&message_router_conv);
69387         }
69388         void* offers_handler_ptr = untag_ptr(offers_handler);
69389         CHECK_ACCESS(offers_handler_ptr);
69390         LDKOffersMessageHandler offers_handler_conv = *(LDKOffersMessageHandler*)(offers_handler_ptr);
69391         if (offers_handler_conv.free == LDKOffersMessageHandler_JCalls_free) {
69392                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69393                 LDKOffersMessageHandler_JCalls_cloned(&offers_handler_conv);
69394         }
69395         void* custom_handler_ptr = untag_ptr(custom_handler);
69396         CHECK_ACCESS(custom_handler_ptr);
69397         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
69398         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
69399                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69400                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
69401         }
69402         LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, message_router_conv, offers_handler_conv, custom_handler_conv);
69403         int64_t ret_ref = 0;
69404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69406         return ret_ref;
69407 }
69408
69409 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 contents, int64_t reply_path) {
69410         LDKOnionMessenger this_arg_conv;
69411         this_arg_conv.inner = untag_ptr(this_arg);
69412         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69414         this_arg_conv.is_owned = false;
69415         LDKOnionMessagePath path_conv;
69416         path_conv.inner = untag_ptr(path);
69417         path_conv.is_owned = ptr_is_owned(path);
69418         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
69419         path_conv = OnionMessagePath_clone(&path_conv);
69420         void* contents_ptr = untag_ptr(contents);
69421         CHECK_ACCESS(contents_ptr);
69422         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
69423         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
69424                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69425                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
69426         }
69427         LDKBlindedPath reply_path_conv;
69428         reply_path_conv.inner = untag_ptr(reply_path);
69429         reply_path_conv.is_owned = ptr_is_owned(reply_path);
69430         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
69431         reply_path_conv = BlindedPath_clone(&reply_path_conv);
69432         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
69433         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, path_conv, contents_conv, reply_path_conv);
69434         return tag_ptr(ret_conv, true);
69435 }
69436
69437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1as_1OnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
69438         LDKOnionMessenger this_arg_conv;
69439         this_arg_conv.inner = untag_ptr(this_arg);
69440         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69442         this_arg_conv.is_owned = false;
69443         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
69444         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
69445         return tag_ptr(ret_ret, true);
69446 }
69447
69448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69449         if (!ptr_is_owned(this_ptr)) return;
69450         void* this_ptr_ptr = untag_ptr(this_ptr);
69451         CHECK_ACCESS(this_ptr_ptr);
69452         LDKOffersMessageHandler this_ptr_conv = *(LDKOffersMessageHandler*)(this_ptr_ptr);
69453         FREE(untag_ptr(this_ptr));
69454         OffersMessageHandler_free(this_ptr_conv);
69455 }
69456
69457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OffersMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69458         if (!ptr_is_owned(this_ptr)) return;
69459         void* this_ptr_ptr = untag_ptr(this_ptr);
69460         CHECK_ACCESS(this_ptr_ptr);
69461         LDKOffersMessage this_ptr_conv = *(LDKOffersMessage*)(this_ptr_ptr);
69462         FREE(untag_ptr(this_ptr));
69463         OffersMessage_free(this_ptr_conv);
69464 }
69465
69466 static inline uint64_t OffersMessage_clone_ptr(LDKOffersMessage *NONNULL_PTR arg) {
69467         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
69468         *ret_copy = OffersMessage_clone(arg);
69469         int64_t ret_ref = tag_ptr(ret_copy, true);
69470         return ret_ref;
69471 }
69472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69473         LDKOffersMessage* arg_conv = (LDKOffersMessage*)untag_ptr(arg);
69474         int64_t ret_conv = OffersMessage_clone_ptr(arg_conv);
69475         return ret_conv;
69476 }
69477
69478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69479         LDKOffersMessage* orig_conv = (LDKOffersMessage*)untag_ptr(orig);
69480         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
69481         *ret_copy = OffersMessage_clone(orig_conv);
69482         int64_t ret_ref = tag_ptr(ret_copy, true);
69483         return ret_ref;
69484 }
69485
69486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice_1request(JNIEnv *env, jclass clz, int64_t a) {
69487         LDKInvoiceRequest a_conv;
69488         a_conv.inner = untag_ptr(a);
69489         a_conv.is_owned = ptr_is_owned(a);
69490         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69491         a_conv = InvoiceRequest_clone(&a_conv);
69492         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
69493         *ret_copy = OffersMessage_invoice_request(a_conv);
69494         int64_t ret_ref = tag_ptr(ret_copy, true);
69495         return ret_ref;
69496 }
69497
69498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice(JNIEnv *env, jclass clz, int64_t a) {
69499         LDKBolt12Invoice a_conv;
69500         a_conv.inner = untag_ptr(a);
69501         a_conv.is_owned = ptr_is_owned(a);
69502         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69503         a_conv = Bolt12Invoice_clone(&a_conv);
69504         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
69505         *ret_copy = OffersMessage_invoice(a_conv);
69506         int64_t ret_ref = tag_ptr(ret_copy, true);
69507         return ret_ref;
69508 }
69509
69510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice_1error(JNIEnv *env, jclass clz, int64_t a) {
69511         LDKInvoiceError a_conv;
69512         a_conv.inner = untag_ptr(a);
69513         a_conv.is_owned = ptr_is_owned(a);
69514         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69515         a_conv = InvoiceError_clone(&a_conv);
69516         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
69517         *ret_copy = OffersMessage_invoice_error(a_conv);
69518         int64_t ret_ref = tag_ptr(ret_copy, true);
69519         return ret_ref;
69520 }
69521
69522 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OffersMessage_1is_1known_1type(JNIEnv *env, jclass clz, int64_t tlv_type) {
69523         jboolean ret_conv = OffersMessage_is_known_type(tlv_type);
69524         return ret_conv;
69525 }
69526
69527 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OffersMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
69528         LDKOffersMessage* obj_conv = (LDKOffersMessage*)untag_ptr(obj);
69529         LDKCVec_u8Z ret_var = OffersMessage_write(obj_conv);
69530         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69531         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69532         CVec_u8Z_free(ret_var);
69533         return ret_arr;
69534 }
69535
69536 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) {
69537         LDKu8slice ser_ref;
69538         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
69539         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
69540         void* arg_b_ptr = untag_ptr(arg_b);
69541         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
69542         LDKLogger* arg_b_conv = (LDKLogger*)arg_b_ptr;
69543         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
69544         *ret_conv = OffersMessage_read(ser_ref, arg_a, arg_b_conv);
69545         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
69546         return tag_ptr(ret_conv, true);
69547 }
69548
69549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69550         LDKPacket this_obj_conv;
69551         this_obj_conv.inner = untag_ptr(this_obj);
69552         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69554         Packet_free(this_obj_conv);
69555 }
69556
69557 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Packet_1get_1version(JNIEnv *env, jclass clz, int64_t this_ptr) {
69558         LDKPacket this_ptr_conv;
69559         this_ptr_conv.inner = untag_ptr(this_ptr);
69560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69562         this_ptr_conv.is_owned = false;
69563         int8_t ret_conv = Packet_get_version(&this_ptr_conv);
69564         return ret_conv;
69565 }
69566
69567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1version(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
69568         LDKPacket this_ptr_conv;
69569         this_ptr_conv.inner = untag_ptr(this_ptr);
69570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69572         this_ptr_conv.is_owned = false;
69573         Packet_set_version(&this_ptr_conv, val);
69574 }
69575
69576 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1get_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
69577         LDKPacket this_ptr_conv;
69578         this_ptr_conv.inner = untag_ptr(this_ptr);
69579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69581         this_ptr_conv.is_owned = false;
69582         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
69583         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Packet_get_public_key(&this_ptr_conv).compressed_form);
69584         return ret_arr;
69585 }
69586
69587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
69588         LDKPacket this_ptr_conv;
69589         this_ptr_conv.inner = untag_ptr(this_ptr);
69590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69592         this_ptr_conv.is_owned = false;
69593         LDKPublicKey val_ref;
69594         CHECK((*env)->GetArrayLength(env, val) == 33);
69595         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
69596         Packet_set_public_key(&this_ptr_conv, val_ref);
69597 }
69598
69599 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1get_1hop_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
69600         LDKPacket this_ptr_conv;
69601         this_ptr_conv.inner = untag_ptr(this_ptr);
69602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69604         this_ptr_conv.is_owned = false;
69605         LDKCVec_u8Z ret_var = Packet_get_hop_data(&this_ptr_conv);
69606         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69607         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69608         CVec_u8Z_free(ret_var);
69609         return ret_arr;
69610 }
69611
69612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1hop_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
69613         LDKPacket this_ptr_conv;
69614         this_ptr_conv.inner = untag_ptr(this_ptr);
69615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69617         this_ptr_conv.is_owned = false;
69618         LDKCVec_u8Z val_ref;
69619         val_ref.datalen = (*env)->GetArrayLength(env, val);
69620         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
69621         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
69622         Packet_set_hop_data(&this_ptr_conv, val_ref);
69623 }
69624
69625 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1get_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr) {
69626         LDKPacket this_ptr_conv;
69627         this_ptr_conv.inner = untag_ptr(this_ptr);
69628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69630         this_ptr_conv.is_owned = false;
69631         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
69632         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Packet_get_hmac(&this_ptr_conv));
69633         return ret_arr;
69634 }
69635
69636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
69637         LDKPacket this_ptr_conv;
69638         this_ptr_conv.inner = untag_ptr(this_ptr);
69639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69641         this_ptr_conv.is_owned = false;
69642         LDKThirtyTwoBytes val_ref;
69643         CHECK((*env)->GetArrayLength(env, val) == 32);
69644         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
69645         Packet_set_hmac(&this_ptr_conv, val_ref);
69646 }
69647
69648 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) {
69649         LDKPublicKey public_key_arg_ref;
69650         CHECK((*env)->GetArrayLength(env, public_key_arg) == 33);
69651         (*env)->GetByteArrayRegion(env, public_key_arg, 0, 33, public_key_arg_ref.compressed_form);
69652         LDKCVec_u8Z hop_data_arg_ref;
69653         hop_data_arg_ref.datalen = (*env)->GetArrayLength(env, hop_data_arg);
69654         hop_data_arg_ref.data = MALLOC(hop_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
69655         (*env)->GetByteArrayRegion(env, hop_data_arg, 0, hop_data_arg_ref.datalen, hop_data_arg_ref.data);
69656         LDKThirtyTwoBytes hmac_arg_ref;
69657         CHECK((*env)->GetArrayLength(env, hmac_arg) == 32);
69658         (*env)->GetByteArrayRegion(env, hmac_arg, 0, 32, hmac_arg_ref.data);
69659         LDKPacket ret_var = Packet_new(version_arg, public_key_arg_ref, hop_data_arg_ref, hmac_arg_ref);
69660         int64_t ret_ref = 0;
69661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69662         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69663         return ret_ref;
69664 }
69665
69666 static inline uint64_t Packet_clone_ptr(LDKPacket *NONNULL_PTR arg) {
69667         LDKPacket ret_var = Packet_clone(arg);
69668         int64_t ret_ref = 0;
69669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69671         return ret_ref;
69672 }
69673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Packet_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69674         LDKPacket arg_conv;
69675         arg_conv.inner = untag_ptr(arg);
69676         arg_conv.is_owned = ptr_is_owned(arg);
69677         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69678         arg_conv.is_owned = false;
69679         int64_t ret_conv = Packet_clone_ptr(&arg_conv);
69680         return ret_conv;
69681 }
69682
69683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Packet_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69684         LDKPacket orig_conv;
69685         orig_conv.inner = untag_ptr(orig);
69686         orig_conv.is_owned = ptr_is_owned(orig);
69687         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69688         orig_conv.is_owned = false;
69689         LDKPacket ret_var = Packet_clone(&orig_conv);
69690         int64_t ret_ref = 0;
69691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69693         return ret_ref;
69694 }
69695
69696 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Packet_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
69697         LDKPacket a_conv;
69698         a_conv.inner = untag_ptr(a);
69699         a_conv.is_owned = ptr_is_owned(a);
69700         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69701         a_conv.is_owned = false;
69702         LDKPacket b_conv;
69703         b_conv.inner = untag_ptr(b);
69704         b_conv.is_owned = ptr_is_owned(b);
69705         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69706         b_conv.is_owned = false;
69707         jboolean ret_conv = Packet_eq(&a_conv, &b_conv);
69708         return ret_conv;
69709 }
69710
69711 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1write(JNIEnv *env, jclass clz, int64_t obj) {
69712         LDKPacket obj_conv;
69713         obj_conv.inner = untag_ptr(obj);
69714         obj_conv.is_owned = ptr_is_owned(obj);
69715         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69716         obj_conv.is_owned = false;
69717         LDKCVec_u8Z ret_var = Packet_write(&obj_conv);
69718         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69719         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69720         CVec_u8Z_free(ret_var);
69721         return ret_arr;
69722 }
69723
69724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69725         if (!ptr_is_owned(this_ptr)) return;
69726         void* this_ptr_ptr = untag_ptr(this_ptr);
69727         CHECK_ACCESS(this_ptr_ptr);
69728         LDKParsedOnionMessageContents this_ptr_conv = *(LDKParsedOnionMessageContents*)(this_ptr_ptr);
69729         FREE(untag_ptr(this_ptr));
69730         ParsedOnionMessageContents_free(this_ptr_conv);
69731 }
69732
69733 static inline uint64_t ParsedOnionMessageContents_clone_ptr(LDKParsedOnionMessageContents *NONNULL_PTR arg) {
69734         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
69735         *ret_copy = ParsedOnionMessageContents_clone(arg);
69736         int64_t ret_ref = tag_ptr(ret_copy, true);
69737         return ret_ref;
69738 }
69739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69740         LDKParsedOnionMessageContents* arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(arg);
69741         int64_t ret_conv = ParsedOnionMessageContents_clone_ptr(arg_conv);
69742         return ret_conv;
69743 }
69744
69745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69746         LDKParsedOnionMessageContents* orig_conv = (LDKParsedOnionMessageContents*)untag_ptr(orig);
69747         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
69748         *ret_copy = ParsedOnionMessageContents_clone(orig_conv);
69749         int64_t ret_ref = tag_ptr(ret_copy, true);
69750         return ret_ref;
69751 }
69752
69753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1offers(JNIEnv *env, jclass clz, int64_t a) {
69754         void* a_ptr = untag_ptr(a);
69755         CHECK_ACCESS(a_ptr);
69756         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
69757         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
69758         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
69759         *ret_copy = ParsedOnionMessageContents_offers(a_conv);
69760         int64_t ret_ref = tag_ptr(ret_copy, true);
69761         return ret_ref;
69762 }
69763
69764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1custom(JNIEnv *env, jclass clz, int64_t a) {
69765         void* a_ptr = untag_ptr(a);
69766         CHECK_ACCESS(a_ptr);
69767         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
69768         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
69769                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69770                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
69771         }
69772         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
69773         *ret_copy = ParsedOnionMessageContents_custom(a_conv);
69774         int64_t ret_ref = tag_ptr(ret_copy, true);
69775         return ret_ref;
69776 }
69777
69778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1as_1OnionMessageContents(JNIEnv *env, jclass clz, int64_t this_arg) {
69779         LDKParsedOnionMessageContents* this_arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(this_arg);
69780         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
69781         *ret_ret = ParsedOnionMessageContents_as_OnionMessageContents(this_arg_conv);
69782         return tag_ptr(ret_ret, true);
69783 }
69784
69785 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1write(JNIEnv *env, jclass clz, int64_t obj) {
69786         LDKParsedOnionMessageContents* obj_conv = (LDKParsedOnionMessageContents*)untag_ptr(obj);
69787         LDKCVec_u8Z ret_var = ParsedOnionMessageContents_write(obj_conv);
69788         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69789         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69790         CVec_u8Z_free(ret_var);
69791         return ret_arr;
69792 }
69793
69794 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
69795         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
69796         *ret_ret = OnionMessageContents_clone(arg);
69797         return tag_ptr(ret_ret, true);
69798 }
69799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69800         void* arg_ptr = untag_ptr(arg);
69801         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
69802         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)arg_ptr;
69803         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
69804         return ret_conv;
69805 }
69806
69807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69808         void* orig_ptr = untag_ptr(orig);
69809         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
69810         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)orig_ptr;
69811         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
69812         *ret_ret = OnionMessageContents_clone(orig_conv);
69813         return tag_ptr(ret_ret, true);
69814 }
69815
69816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69817         if (!ptr_is_owned(this_ptr)) return;
69818         void* this_ptr_ptr = untag_ptr(this_ptr);
69819         CHECK_ACCESS(this_ptr_ptr);
69820         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
69821         FREE(untag_ptr(this_ptr));
69822         OnionMessageContents_free(this_ptr_conv);
69823 }
69824
69825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69826         LDKBlindedPath this_obj_conv;
69827         this_obj_conv.inner = untag_ptr(this_obj);
69828         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69830         BlindedPath_free(this_obj_conv);
69831 }
69832
69833 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1get_1introduction_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
69834         LDKBlindedPath this_ptr_conv;
69835         this_ptr_conv.inner = untag_ptr(this_ptr);
69836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69838         this_ptr_conv.is_owned = false;
69839         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
69840         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedPath_get_introduction_node_id(&this_ptr_conv).compressed_form);
69841         return ret_arr;
69842 }
69843
69844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1set_1introduction_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
69845         LDKBlindedPath this_ptr_conv;
69846         this_ptr_conv.inner = untag_ptr(this_ptr);
69847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69849         this_ptr_conv.is_owned = false;
69850         LDKPublicKey val_ref;
69851         CHECK((*env)->GetArrayLength(env, val) == 33);
69852         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
69853         BlindedPath_set_introduction_node_id(&this_ptr_conv, val_ref);
69854 }
69855
69856 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
69857         LDKBlindedPath this_ptr_conv;
69858         this_ptr_conv.inner = untag_ptr(this_ptr);
69859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69861         this_ptr_conv.is_owned = false;
69862         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
69863         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedPath_get_blinding_point(&this_ptr_conv).compressed_form);
69864         return ret_arr;
69865 }
69866
69867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
69868         LDKBlindedPath this_ptr_conv;
69869         this_ptr_conv.inner = untag_ptr(this_ptr);
69870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69872         this_ptr_conv.is_owned = false;
69873         LDKPublicKey val_ref;
69874         CHECK((*env)->GetArrayLength(env, val) == 33);
69875         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
69876         BlindedPath_set_blinding_point(&this_ptr_conv, val_ref);
69877 }
69878
69879 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1get_1blinded_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
69880         LDKBlindedPath this_ptr_conv;
69881         this_ptr_conv.inner = untag_ptr(this_ptr);
69882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69884         this_ptr_conv.is_owned = false;
69885         LDKCVec_BlindedHopZ ret_var = BlindedPath_get_blinded_hops(&this_ptr_conv);
69886         int64_tArray ret_arr = NULL;
69887         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
69888         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
69889         for (size_t m = 0; m < ret_var.datalen; m++) {
69890                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
69891                 int64_t ret_conv_12_ref = 0;
69892                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
69893                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
69894                 ret_arr_ptr[m] = ret_conv_12_ref;
69895         }
69896         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
69897         FREE(ret_var.data);
69898         return ret_arr;
69899 }
69900
69901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1set_1blinded_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
69902         LDKBlindedPath this_ptr_conv;
69903         this_ptr_conv.inner = untag_ptr(this_ptr);
69904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69906         this_ptr_conv.is_owned = false;
69907         LDKCVec_BlindedHopZ val_constr;
69908         val_constr.datalen = (*env)->GetArrayLength(env, val);
69909         if (val_constr.datalen > 0)
69910                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
69911         else
69912                 val_constr.data = NULL;
69913         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
69914         for (size_t m = 0; m < val_constr.datalen; m++) {
69915                 int64_t val_conv_12 = val_vals[m];
69916                 LDKBlindedHop val_conv_12_conv;
69917                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
69918                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
69919                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
69920                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
69921                 val_constr.data[m] = val_conv_12_conv;
69922         }
69923         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
69924         BlindedPath_set_blinded_hops(&this_ptr_conv, val_constr);
69925 }
69926
69927 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) {
69928         LDKPublicKey introduction_node_id_arg_ref;
69929         CHECK((*env)->GetArrayLength(env, introduction_node_id_arg) == 33);
69930         (*env)->GetByteArrayRegion(env, introduction_node_id_arg, 0, 33, introduction_node_id_arg_ref.compressed_form);
69931         LDKPublicKey blinding_point_arg_ref;
69932         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
69933         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
69934         LDKCVec_BlindedHopZ blinded_hops_arg_constr;
69935         blinded_hops_arg_constr.datalen = (*env)->GetArrayLength(env, blinded_hops_arg);
69936         if (blinded_hops_arg_constr.datalen > 0)
69937                 blinded_hops_arg_constr.data = MALLOC(blinded_hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
69938         else
69939                 blinded_hops_arg_constr.data = NULL;
69940         int64_t* blinded_hops_arg_vals = (*env)->GetLongArrayElements (env, blinded_hops_arg, NULL);
69941         for (size_t m = 0; m < blinded_hops_arg_constr.datalen; m++) {
69942                 int64_t blinded_hops_arg_conv_12 = blinded_hops_arg_vals[m];
69943                 LDKBlindedHop blinded_hops_arg_conv_12_conv;
69944                 blinded_hops_arg_conv_12_conv.inner = untag_ptr(blinded_hops_arg_conv_12);
69945                 blinded_hops_arg_conv_12_conv.is_owned = ptr_is_owned(blinded_hops_arg_conv_12);
69946                 CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_hops_arg_conv_12_conv);
69947                 blinded_hops_arg_conv_12_conv = BlindedHop_clone(&blinded_hops_arg_conv_12_conv);
69948                 blinded_hops_arg_constr.data[m] = blinded_hops_arg_conv_12_conv;
69949         }
69950         (*env)->ReleaseLongArrayElements(env, blinded_hops_arg, blinded_hops_arg_vals, 0);
69951         LDKBlindedPath ret_var = BlindedPath_new(introduction_node_id_arg_ref, blinding_point_arg_ref, blinded_hops_arg_constr);
69952         int64_t ret_ref = 0;
69953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69955         return ret_ref;
69956 }
69957
69958 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
69959         LDKBlindedPath ret_var = BlindedPath_clone(arg);
69960         int64_t ret_ref = 0;
69961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69963         return ret_ref;
69964 }
69965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69966         LDKBlindedPath arg_conv;
69967         arg_conv.inner = untag_ptr(arg);
69968         arg_conv.is_owned = ptr_is_owned(arg);
69969         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69970         arg_conv.is_owned = false;
69971         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
69972         return ret_conv;
69973 }
69974
69975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69976         LDKBlindedPath orig_conv;
69977         orig_conv.inner = untag_ptr(orig);
69978         orig_conv.is_owned = ptr_is_owned(orig);
69979         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69980         orig_conv.is_owned = false;
69981         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
69982         int64_t ret_ref = 0;
69983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69985         return ret_ref;
69986 }
69987
69988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1hash(JNIEnv *env, jclass clz, int64_t o) {
69989         LDKBlindedPath o_conv;
69990         o_conv.inner = untag_ptr(o);
69991         o_conv.is_owned = ptr_is_owned(o);
69992         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69993         o_conv.is_owned = false;
69994         int64_t ret_conv = BlindedPath_hash(&o_conv);
69995         return ret_conv;
69996 }
69997
69998 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedPath_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
69999         LDKBlindedPath a_conv;
70000         a_conv.inner = untag_ptr(a);
70001         a_conv.is_owned = ptr_is_owned(a);
70002         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70003         a_conv.is_owned = false;
70004         LDKBlindedPath b_conv;
70005         b_conv.inner = untag_ptr(b);
70006         b_conv.is_owned = ptr_is_owned(b);
70007         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70008         b_conv.is_owned = false;
70009         jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
70010         return ret_conv;
70011 }
70012
70013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70014         LDKBlindedHop this_obj_conv;
70015         this_obj_conv.inner = untag_ptr(this_obj);
70016         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70018         BlindedHop_free(this_obj_conv);
70019 }
70020
70021 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1get_1blinded_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
70022         LDKBlindedHop this_ptr_conv;
70023         this_ptr_conv.inner = untag_ptr(this_ptr);
70024         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70026         this_ptr_conv.is_owned = false;
70027         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
70028         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedHop_get_blinded_node_id(&this_ptr_conv).compressed_form);
70029         return ret_arr;
70030 }
70031
70032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1set_1blinded_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
70033         LDKBlindedHop this_ptr_conv;
70034         this_ptr_conv.inner = untag_ptr(this_ptr);
70035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70037         this_ptr_conv.is_owned = false;
70038         LDKPublicKey val_ref;
70039         CHECK((*env)->GetArrayLength(env, val) == 33);
70040         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
70041         BlindedHop_set_blinded_node_id(&this_ptr_conv, val_ref);
70042 }
70043
70044 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1get_1encrypted_1payload(JNIEnv *env, jclass clz, int64_t this_ptr) {
70045         LDKBlindedHop this_ptr_conv;
70046         this_ptr_conv.inner = untag_ptr(this_ptr);
70047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70049         this_ptr_conv.is_owned = false;
70050         LDKCVec_u8Z ret_var = BlindedHop_get_encrypted_payload(&this_ptr_conv);
70051         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70052         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70053         CVec_u8Z_free(ret_var);
70054         return ret_arr;
70055 }
70056
70057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1set_1encrypted_1payload(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
70058         LDKBlindedHop this_ptr_conv;
70059         this_ptr_conv.inner = untag_ptr(this_ptr);
70060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70062         this_ptr_conv.is_owned = false;
70063         LDKCVec_u8Z val_ref;
70064         val_ref.datalen = (*env)->GetArrayLength(env, val);
70065         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
70066         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
70067         BlindedHop_set_encrypted_payload(&this_ptr_conv, val_ref);
70068 }
70069
70070 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) {
70071         LDKPublicKey blinded_node_id_arg_ref;
70072         CHECK((*env)->GetArrayLength(env, blinded_node_id_arg) == 33);
70073         (*env)->GetByteArrayRegion(env, blinded_node_id_arg, 0, 33, blinded_node_id_arg_ref.compressed_form);
70074         LDKCVec_u8Z encrypted_payload_arg_ref;
70075         encrypted_payload_arg_ref.datalen = (*env)->GetArrayLength(env, encrypted_payload_arg);
70076         encrypted_payload_arg_ref.data = MALLOC(encrypted_payload_arg_ref.datalen, "LDKCVec_u8Z Bytes");
70077         (*env)->GetByteArrayRegion(env, encrypted_payload_arg, 0, encrypted_payload_arg_ref.datalen, encrypted_payload_arg_ref.data);
70078         LDKBlindedHop ret_var = BlindedHop_new(blinded_node_id_arg_ref, encrypted_payload_arg_ref);
70079         int64_t ret_ref = 0;
70080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70082         return ret_ref;
70083 }
70084
70085 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
70086         LDKBlindedHop ret_var = BlindedHop_clone(arg);
70087         int64_t ret_ref = 0;
70088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70090         return ret_ref;
70091 }
70092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70093         LDKBlindedHop arg_conv;
70094         arg_conv.inner = untag_ptr(arg);
70095         arg_conv.is_owned = ptr_is_owned(arg);
70096         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70097         arg_conv.is_owned = false;
70098         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
70099         return ret_conv;
70100 }
70101
70102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70103         LDKBlindedHop orig_conv;
70104         orig_conv.inner = untag_ptr(orig);
70105         orig_conv.is_owned = ptr_is_owned(orig);
70106         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70107         orig_conv.is_owned = false;
70108         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
70109         int64_t ret_ref = 0;
70110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70112         return ret_ref;
70113 }
70114
70115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
70116         LDKBlindedHop o_conv;
70117         o_conv.inner = untag_ptr(o);
70118         o_conv.is_owned = ptr_is_owned(o);
70119         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70120         o_conv.is_owned = false;
70121         int64_t ret_conv = BlindedHop_hash(&o_conv);
70122         return ret_conv;
70123 }
70124
70125 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
70126         LDKBlindedHop a_conv;
70127         a_conv.inner = untag_ptr(a);
70128         a_conv.is_owned = ptr_is_owned(a);
70129         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70130         a_conv.is_owned = false;
70131         LDKBlindedHop b_conv;
70132         b_conv.inner = untag_ptr(b);
70133         b_conv.is_owned = ptr_is_owned(b);
70134         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70135         b_conv.is_owned = false;
70136         jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
70137         return ret_conv;
70138 }
70139
70140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1one_1hop_1for_1message(JNIEnv *env, jclass clz, int8_tArray recipient_node_id, int64_t entropy_source) {
70141         LDKPublicKey recipient_node_id_ref;
70142         CHECK((*env)->GetArrayLength(env, recipient_node_id) == 33);
70143         (*env)->GetByteArrayRegion(env, recipient_node_id, 0, 33, recipient_node_id_ref.compressed_form);
70144         void* entropy_source_ptr = untag_ptr(entropy_source);
70145         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
70146         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
70147         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
70148         *ret_conv = BlindedPath_one_hop_for_message(recipient_node_id_ref, entropy_source_conv);
70149         return tag_ptr(ret_conv, true);
70150 }
70151
70152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new_1for_1message(JNIEnv *env, jclass clz, jobjectArray node_pks, int64_t entropy_source) {
70153         LDKCVec_PublicKeyZ node_pks_constr;
70154         node_pks_constr.datalen = (*env)->GetArrayLength(env, node_pks);
70155         if (node_pks_constr.datalen > 0)
70156                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
70157         else
70158                 node_pks_constr.data = NULL;
70159         for (size_t i = 0; i < node_pks_constr.datalen; i++) {
70160                 int8_tArray node_pks_conv_8 = (*env)->GetObjectArrayElement(env, node_pks, i);
70161                 LDKPublicKey node_pks_conv_8_ref;
70162                 CHECK((*env)->GetArrayLength(env, node_pks_conv_8) == 33);
70163                 (*env)->GetByteArrayRegion(env, node_pks_conv_8, 0, 33, node_pks_conv_8_ref.compressed_form);
70164                 node_pks_constr.data[i] = node_pks_conv_8_ref;
70165         }
70166         void* entropy_source_ptr = untag_ptr(entropy_source);
70167         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
70168         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
70169         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
70170         *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
70171         return tag_ptr(ret_conv, true);
70172 }
70173
70174 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) {
70175         LDKPublicKey payee_node_id_ref;
70176         CHECK((*env)->GetArrayLength(env, payee_node_id) == 33);
70177         (*env)->GetByteArrayRegion(env, payee_node_id, 0, 33, payee_node_id_ref.compressed_form);
70178         LDKReceiveTlvs payee_tlvs_conv;
70179         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
70180         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
70181         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
70182         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
70183         void* entropy_source_ptr = untag_ptr(entropy_source);
70184         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
70185         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
70186         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
70187         *ret_conv = BlindedPath_one_hop_for_payment(payee_node_id_ref, payee_tlvs_conv, entropy_source_conv);
70188         return tag_ptr(ret_conv, true);
70189 }
70190
70191 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1write(JNIEnv *env, jclass clz, int64_t obj) {
70192         LDKBlindedPath obj_conv;
70193         obj_conv.inner = untag_ptr(obj);
70194         obj_conv.is_owned = ptr_is_owned(obj);
70195         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70196         obj_conv.is_owned = false;
70197         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
70198         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70199         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70200         CVec_u8Z_free(ret_var);
70201         return ret_arr;
70202 }
70203
70204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
70205         LDKu8slice ser_ref;
70206         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
70207         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
70208         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
70209         *ret_conv = BlindedPath_read(ser_ref);
70210         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
70211         return tag_ptr(ret_conv, true);
70212 }
70213
70214 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
70215         LDKBlindedHop obj_conv;
70216         obj_conv.inner = untag_ptr(obj);
70217         obj_conv.is_owned = ptr_is_owned(obj);
70218         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70219         obj_conv.is_owned = false;
70220         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
70221         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70222         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70223         CVec_u8Z_free(ret_var);
70224         return ret_arr;
70225 }
70226
70227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
70228         LDKu8slice ser_ref;
70229         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
70230         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
70231         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
70232         *ret_conv = BlindedHop_read(ser_ref);
70233         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
70234         return tag_ptr(ret_conv, true);
70235 }
70236
70237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70238         LDKForwardNode this_obj_conv;
70239         this_obj_conv.inner = untag_ptr(this_obj);
70240         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70242         ForwardNode_free(this_obj_conv);
70243 }
70244
70245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1get_1tlvs(JNIEnv *env, jclass clz, int64_t this_ptr) {
70246         LDKForwardNode this_ptr_conv;
70247         this_ptr_conv.inner = untag_ptr(this_ptr);
70248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70250         this_ptr_conv.is_owned = false;
70251         LDKForwardTlvs ret_var = ForwardNode_get_tlvs(&this_ptr_conv);
70252         int64_t ret_ref = 0;
70253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70255         return ret_ref;
70256 }
70257
70258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1set_1tlvs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70259         LDKForwardNode this_ptr_conv;
70260         this_ptr_conv.inner = untag_ptr(this_ptr);
70261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70263         this_ptr_conv.is_owned = false;
70264         LDKForwardTlvs val_conv;
70265         val_conv.inner = untag_ptr(val);
70266         val_conv.is_owned = ptr_is_owned(val);
70267         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70268         val_conv = ForwardTlvs_clone(&val_conv);
70269         ForwardNode_set_tlvs(&this_ptr_conv, val_conv);
70270 }
70271
70272 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ForwardNode_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
70273         LDKForwardNode this_ptr_conv;
70274         this_ptr_conv.inner = untag_ptr(this_ptr);
70275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70277         this_ptr_conv.is_owned = false;
70278         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
70279         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ForwardNode_get_node_id(&this_ptr_conv).compressed_form);
70280         return ret_arr;
70281 }
70282
70283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
70284         LDKForwardNode this_ptr_conv;
70285         this_ptr_conv.inner = untag_ptr(this_ptr);
70286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70288         this_ptr_conv.is_owned = false;
70289         LDKPublicKey val_ref;
70290         CHECK((*env)->GetArrayLength(env, val) == 33);
70291         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
70292         ForwardNode_set_node_id(&this_ptr_conv, val_ref);
70293 }
70294
70295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
70296         LDKForwardNode this_ptr_conv;
70297         this_ptr_conv.inner = untag_ptr(this_ptr);
70298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70300         this_ptr_conv.is_owned = false;
70301         int64_t ret_conv = ForwardNode_get_htlc_maximum_msat(&this_ptr_conv);
70302         return ret_conv;
70303 }
70304
70305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70306         LDKForwardNode this_ptr_conv;
70307         this_ptr_conv.inner = untag_ptr(this_ptr);
70308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70310         this_ptr_conv.is_owned = false;
70311         ForwardNode_set_htlc_maximum_msat(&this_ptr_conv, val);
70312 }
70313
70314 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) {
70315         LDKForwardTlvs tlvs_arg_conv;
70316         tlvs_arg_conv.inner = untag_ptr(tlvs_arg);
70317         tlvs_arg_conv.is_owned = ptr_is_owned(tlvs_arg);
70318         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_arg_conv);
70319         tlvs_arg_conv = ForwardTlvs_clone(&tlvs_arg_conv);
70320         LDKPublicKey node_id_arg_ref;
70321         CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
70322         (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
70323         LDKForwardNode ret_var = ForwardNode_new(tlvs_arg_conv, node_id_arg_ref, htlc_maximum_msat_arg);
70324         int64_t ret_ref = 0;
70325         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70326         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70327         return ret_ref;
70328 }
70329
70330 static inline uint64_t ForwardNode_clone_ptr(LDKForwardNode *NONNULL_PTR arg) {
70331         LDKForwardNode ret_var = ForwardNode_clone(arg);
70332         int64_t ret_ref = 0;
70333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70335         return ret_ref;
70336 }
70337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70338         LDKForwardNode arg_conv;
70339         arg_conv.inner = untag_ptr(arg);
70340         arg_conv.is_owned = ptr_is_owned(arg);
70341         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70342         arg_conv.is_owned = false;
70343         int64_t ret_conv = ForwardNode_clone_ptr(&arg_conv);
70344         return ret_conv;
70345 }
70346
70347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70348         LDKForwardNode orig_conv;
70349         orig_conv.inner = untag_ptr(orig);
70350         orig_conv.is_owned = ptr_is_owned(orig);
70351         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70352         orig_conv.is_owned = false;
70353         LDKForwardNode ret_var = ForwardNode_clone(&orig_conv);
70354         int64_t ret_ref = 0;
70355         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70356         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70357         return ret_ref;
70358 }
70359
70360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70361         LDKForwardTlvs this_obj_conv;
70362         this_obj_conv.inner = untag_ptr(this_obj);
70363         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70365         ForwardTlvs_free(this_obj_conv);
70366 }
70367
70368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
70369         LDKForwardTlvs this_ptr_conv;
70370         this_ptr_conv.inner = untag_ptr(this_ptr);
70371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70373         this_ptr_conv.is_owned = false;
70374         int64_t ret_conv = ForwardTlvs_get_short_channel_id(&this_ptr_conv);
70375         return ret_conv;
70376 }
70377
70378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70379         LDKForwardTlvs this_ptr_conv;
70380         this_ptr_conv.inner = untag_ptr(this_ptr);
70381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70383         this_ptr_conv.is_owned = false;
70384         ForwardTlvs_set_short_channel_id(&this_ptr_conv, val);
70385 }
70386
70387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1payment_1relay(JNIEnv *env, jclass clz, int64_t this_ptr) {
70388         LDKForwardTlvs this_ptr_conv;
70389         this_ptr_conv.inner = untag_ptr(this_ptr);
70390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70392         this_ptr_conv.is_owned = false;
70393         LDKPaymentRelay ret_var = ForwardTlvs_get_payment_relay(&this_ptr_conv);
70394         int64_t ret_ref = 0;
70395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70397         return ret_ref;
70398 }
70399
70400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1payment_1relay(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70401         LDKForwardTlvs this_ptr_conv;
70402         this_ptr_conv.inner = untag_ptr(this_ptr);
70403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70405         this_ptr_conv.is_owned = false;
70406         LDKPaymentRelay val_conv;
70407         val_conv.inner = untag_ptr(val);
70408         val_conv.is_owned = ptr_is_owned(val);
70409         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70410         val_conv = PaymentRelay_clone(&val_conv);
70411         ForwardTlvs_set_payment_relay(&this_ptr_conv, val_conv);
70412 }
70413
70414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr) {
70415         LDKForwardTlvs this_ptr_conv;
70416         this_ptr_conv.inner = untag_ptr(this_ptr);
70417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70419         this_ptr_conv.is_owned = false;
70420         LDKPaymentConstraints ret_var = ForwardTlvs_get_payment_constraints(&this_ptr_conv);
70421         int64_t ret_ref = 0;
70422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70424         return ret_ref;
70425 }
70426
70427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70428         LDKForwardTlvs this_ptr_conv;
70429         this_ptr_conv.inner = untag_ptr(this_ptr);
70430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70432         this_ptr_conv.is_owned = false;
70433         LDKPaymentConstraints val_conv;
70434         val_conv.inner = untag_ptr(val);
70435         val_conv.is_owned = ptr_is_owned(val);
70436         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70437         val_conv = PaymentConstraints_clone(&val_conv);
70438         ForwardTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
70439 }
70440
70441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
70442         LDKForwardTlvs this_ptr_conv;
70443         this_ptr_conv.inner = untag_ptr(this_ptr);
70444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70446         this_ptr_conv.is_owned = false;
70447         LDKBlindedHopFeatures ret_var = ForwardTlvs_get_features(&this_ptr_conv);
70448         int64_t ret_ref = 0;
70449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70451         return ret_ref;
70452 }
70453
70454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70455         LDKForwardTlvs this_ptr_conv;
70456         this_ptr_conv.inner = untag_ptr(this_ptr);
70457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70459         this_ptr_conv.is_owned = false;
70460         LDKBlindedHopFeatures val_conv;
70461         val_conv.inner = untag_ptr(val);
70462         val_conv.is_owned = ptr_is_owned(val);
70463         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70464         val_conv = BlindedHopFeatures_clone(&val_conv);
70465         ForwardTlvs_set_features(&this_ptr_conv, val_conv);
70466 }
70467
70468 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) {
70469         LDKPaymentRelay payment_relay_arg_conv;
70470         payment_relay_arg_conv.inner = untag_ptr(payment_relay_arg);
70471         payment_relay_arg_conv.is_owned = ptr_is_owned(payment_relay_arg);
70472         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_relay_arg_conv);
70473         payment_relay_arg_conv = PaymentRelay_clone(&payment_relay_arg_conv);
70474         LDKPaymentConstraints payment_constraints_arg_conv;
70475         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
70476         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
70477         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
70478         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
70479         LDKBlindedHopFeatures features_arg_conv;
70480         features_arg_conv.inner = untag_ptr(features_arg);
70481         features_arg_conv.is_owned = ptr_is_owned(features_arg);
70482         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
70483         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
70484         LDKForwardTlvs ret_var = ForwardTlvs_new(short_channel_id_arg, payment_relay_arg_conv, payment_constraints_arg_conv, features_arg_conv);
70485         int64_t ret_ref = 0;
70486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70488         return ret_ref;
70489 }
70490
70491 static inline uint64_t ForwardTlvs_clone_ptr(LDKForwardTlvs *NONNULL_PTR arg) {
70492         LDKForwardTlvs ret_var = ForwardTlvs_clone(arg);
70493         int64_t ret_ref = 0;
70494         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70495         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70496         return ret_ref;
70497 }
70498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70499         LDKForwardTlvs arg_conv;
70500         arg_conv.inner = untag_ptr(arg);
70501         arg_conv.is_owned = ptr_is_owned(arg);
70502         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70503         arg_conv.is_owned = false;
70504         int64_t ret_conv = ForwardTlvs_clone_ptr(&arg_conv);
70505         return ret_conv;
70506 }
70507
70508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70509         LDKForwardTlvs orig_conv;
70510         orig_conv.inner = untag_ptr(orig);
70511         orig_conv.is_owned = ptr_is_owned(orig);
70512         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70513         orig_conv.is_owned = false;
70514         LDKForwardTlvs ret_var = ForwardTlvs_clone(&orig_conv);
70515         int64_t ret_ref = 0;
70516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70518         return ret_ref;
70519 }
70520
70521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70522         LDKReceiveTlvs this_obj_conv;
70523         this_obj_conv.inner = untag_ptr(this_obj);
70524         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70526         ReceiveTlvs_free(this_obj_conv);
70527 }
70528
70529 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1get_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
70530         LDKReceiveTlvs this_ptr_conv;
70531         this_ptr_conv.inner = untag_ptr(this_ptr);
70532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70534         this_ptr_conv.is_owned = false;
70535         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
70536         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReceiveTlvs_get_payment_secret(&this_ptr_conv));
70537         return ret_arr;
70538 }
70539
70540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1set_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
70541         LDKReceiveTlvs this_ptr_conv;
70542         this_ptr_conv.inner = untag_ptr(this_ptr);
70543         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70545         this_ptr_conv.is_owned = false;
70546         LDKThirtyTwoBytes val_ref;
70547         CHECK((*env)->GetArrayLength(env, val) == 32);
70548         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
70549         ReceiveTlvs_set_payment_secret(&this_ptr_conv, val_ref);
70550 }
70551
70552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1get_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr) {
70553         LDKReceiveTlvs this_ptr_conv;
70554         this_ptr_conv.inner = untag_ptr(this_ptr);
70555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70557         this_ptr_conv.is_owned = false;
70558         LDKPaymentConstraints ret_var = ReceiveTlvs_get_payment_constraints(&this_ptr_conv);
70559         int64_t ret_ref = 0;
70560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70562         return ret_ref;
70563 }
70564
70565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1set_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70566         LDKReceiveTlvs this_ptr_conv;
70567         this_ptr_conv.inner = untag_ptr(this_ptr);
70568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70570         this_ptr_conv.is_owned = false;
70571         LDKPaymentConstraints val_conv;
70572         val_conv.inner = untag_ptr(val);
70573         val_conv.is_owned = ptr_is_owned(val);
70574         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70575         val_conv = PaymentConstraints_clone(&val_conv);
70576         ReceiveTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
70577 }
70578
70579 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) {
70580         LDKThirtyTwoBytes payment_secret_arg_ref;
70581         CHECK((*env)->GetArrayLength(env, payment_secret_arg) == 32);
70582         (*env)->GetByteArrayRegion(env, payment_secret_arg, 0, 32, payment_secret_arg_ref.data);
70583         LDKPaymentConstraints payment_constraints_arg_conv;
70584         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
70585         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
70586         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
70587         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
70588         LDKReceiveTlvs ret_var = ReceiveTlvs_new(payment_secret_arg_ref, payment_constraints_arg_conv);
70589         int64_t ret_ref = 0;
70590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70592         return ret_ref;
70593 }
70594
70595 static inline uint64_t ReceiveTlvs_clone_ptr(LDKReceiveTlvs *NONNULL_PTR arg) {
70596         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(arg);
70597         int64_t ret_ref = 0;
70598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70600         return ret_ref;
70601 }
70602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70603         LDKReceiveTlvs arg_conv;
70604         arg_conv.inner = untag_ptr(arg);
70605         arg_conv.is_owned = ptr_is_owned(arg);
70606         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70607         arg_conv.is_owned = false;
70608         int64_t ret_conv = ReceiveTlvs_clone_ptr(&arg_conv);
70609         return ret_conv;
70610 }
70611
70612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70613         LDKReceiveTlvs orig_conv;
70614         orig_conv.inner = untag_ptr(orig);
70615         orig_conv.is_owned = ptr_is_owned(orig);
70616         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70617         orig_conv.is_owned = false;
70618         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(&orig_conv);
70619         int64_t ret_ref = 0;
70620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70622         return ret_ref;
70623 }
70624
70625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70626         LDKPaymentRelay this_obj_conv;
70627         this_obj_conv.inner = untag_ptr(this_obj);
70628         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70630         PaymentRelay_free(this_obj_conv);
70631 }
70632
70633 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
70634         LDKPaymentRelay this_ptr_conv;
70635         this_ptr_conv.inner = untag_ptr(this_ptr);
70636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70638         this_ptr_conv.is_owned = false;
70639         int16_t ret_conv = PaymentRelay_get_cltv_expiry_delta(&this_ptr_conv);
70640         return ret_conv;
70641 }
70642
70643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
70644         LDKPaymentRelay this_ptr_conv;
70645         this_ptr_conv.inner = untag_ptr(this_ptr);
70646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70648         this_ptr_conv.is_owned = false;
70649         PaymentRelay_set_cltv_expiry_delta(&this_ptr_conv, val);
70650 }
70651
70652 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
70653         LDKPaymentRelay this_ptr_conv;
70654         this_ptr_conv.inner = untag_ptr(this_ptr);
70655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70657         this_ptr_conv.is_owned = false;
70658         int32_t ret_conv = PaymentRelay_get_fee_proportional_millionths(&this_ptr_conv);
70659         return ret_conv;
70660 }
70661
70662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
70663         LDKPaymentRelay this_ptr_conv;
70664         this_ptr_conv.inner = untag_ptr(this_ptr);
70665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70667         this_ptr_conv.is_owned = false;
70668         PaymentRelay_set_fee_proportional_millionths(&this_ptr_conv, val);
70669 }
70670
70671 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
70672         LDKPaymentRelay this_ptr_conv;
70673         this_ptr_conv.inner = untag_ptr(this_ptr);
70674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70676         this_ptr_conv.is_owned = false;
70677         int32_t ret_conv = PaymentRelay_get_fee_base_msat(&this_ptr_conv);
70678         return ret_conv;
70679 }
70680
70681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
70682         LDKPaymentRelay this_ptr_conv;
70683         this_ptr_conv.inner = untag_ptr(this_ptr);
70684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70686         this_ptr_conv.is_owned = false;
70687         PaymentRelay_set_fee_base_msat(&this_ptr_conv, val);
70688 }
70689
70690 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) {
70691         LDKPaymentRelay ret_var = PaymentRelay_new(cltv_expiry_delta_arg, fee_proportional_millionths_arg, fee_base_msat_arg);
70692         int64_t ret_ref = 0;
70693         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70694         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70695         return ret_ref;
70696 }
70697
70698 static inline uint64_t PaymentRelay_clone_ptr(LDKPaymentRelay *NONNULL_PTR arg) {
70699         LDKPaymentRelay ret_var = PaymentRelay_clone(arg);
70700         int64_t ret_ref = 0;
70701         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70702         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70703         return ret_ref;
70704 }
70705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70706         LDKPaymentRelay arg_conv;
70707         arg_conv.inner = untag_ptr(arg);
70708         arg_conv.is_owned = ptr_is_owned(arg);
70709         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70710         arg_conv.is_owned = false;
70711         int64_t ret_conv = PaymentRelay_clone_ptr(&arg_conv);
70712         return ret_conv;
70713 }
70714
70715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70716         LDKPaymentRelay orig_conv;
70717         orig_conv.inner = untag_ptr(orig);
70718         orig_conv.is_owned = ptr_is_owned(orig);
70719         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70720         orig_conv.is_owned = false;
70721         LDKPaymentRelay ret_var = PaymentRelay_clone(&orig_conv);
70722         int64_t ret_ref = 0;
70723         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70724         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70725         return ret_ref;
70726 }
70727
70728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70729         LDKPaymentConstraints this_obj_conv;
70730         this_obj_conv.inner = untag_ptr(this_obj);
70731         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70733         PaymentConstraints_free(this_obj_conv);
70734 }
70735
70736 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1get_1max_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
70737         LDKPaymentConstraints this_ptr_conv;
70738         this_ptr_conv.inner = untag_ptr(this_ptr);
70739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70741         this_ptr_conv.is_owned = false;
70742         int32_t ret_conv = PaymentConstraints_get_max_cltv_expiry(&this_ptr_conv);
70743         return ret_conv;
70744 }
70745
70746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1set_1max_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
70747         LDKPaymentConstraints this_ptr_conv;
70748         this_ptr_conv.inner = untag_ptr(this_ptr);
70749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70751         this_ptr_conv.is_owned = false;
70752         PaymentConstraints_set_max_cltv_expiry(&this_ptr_conv, val);
70753 }
70754
70755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
70756         LDKPaymentConstraints this_ptr_conv;
70757         this_ptr_conv.inner = untag_ptr(this_ptr);
70758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70760         this_ptr_conv.is_owned = false;
70761         int64_t ret_conv = PaymentConstraints_get_htlc_minimum_msat(&this_ptr_conv);
70762         return ret_conv;
70763 }
70764
70765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70766         LDKPaymentConstraints this_ptr_conv;
70767         this_ptr_conv.inner = untag_ptr(this_ptr);
70768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70770         this_ptr_conv.is_owned = false;
70771         PaymentConstraints_set_htlc_minimum_msat(&this_ptr_conv, val);
70772 }
70773
70774 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) {
70775         LDKPaymentConstraints ret_var = PaymentConstraints_new(max_cltv_expiry_arg, htlc_minimum_msat_arg);
70776         int64_t ret_ref = 0;
70777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70779         return ret_ref;
70780 }
70781
70782 static inline uint64_t PaymentConstraints_clone_ptr(LDKPaymentConstraints *NONNULL_PTR arg) {
70783         LDKPaymentConstraints ret_var = PaymentConstraints_clone(arg);
70784         int64_t ret_ref = 0;
70785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70787         return ret_ref;
70788 }
70789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70790         LDKPaymentConstraints arg_conv;
70791         arg_conv.inner = untag_ptr(arg);
70792         arg_conv.is_owned = ptr_is_owned(arg);
70793         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70794         arg_conv.is_owned = false;
70795         int64_t ret_conv = PaymentConstraints_clone_ptr(&arg_conv);
70796         return ret_conv;
70797 }
70798
70799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70800         LDKPaymentConstraints orig_conv;
70801         orig_conv.inner = untag_ptr(orig);
70802         orig_conv.is_owned = ptr_is_owned(orig);
70803         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70804         orig_conv.is_owned = false;
70805         LDKPaymentConstraints ret_var = PaymentConstraints_clone(&orig_conv);
70806         int64_t ret_ref = 0;
70807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70809         return ret_ref;
70810 }
70811
70812 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1write(JNIEnv *env, jclass clz, int64_t obj) {
70813         LDKForwardTlvs obj_conv;
70814         obj_conv.inner = untag_ptr(obj);
70815         obj_conv.is_owned = ptr_is_owned(obj);
70816         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70817         obj_conv.is_owned = false;
70818         LDKCVec_u8Z ret_var = ForwardTlvs_write(&obj_conv);
70819         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70820         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70821         CVec_u8Z_free(ret_var);
70822         return ret_arr;
70823 }
70824
70825 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1write(JNIEnv *env, jclass clz, int64_t obj) {
70826         LDKReceiveTlvs obj_conv;
70827         obj_conv.inner = untag_ptr(obj);
70828         obj_conv.is_owned = ptr_is_owned(obj);
70829         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70830         obj_conv.is_owned = false;
70831         LDKCVec_u8Z ret_var = ReceiveTlvs_write(&obj_conv);
70832         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70833         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70834         CVec_u8Z_free(ret_var);
70835         return ret_arr;
70836 }
70837
70838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
70839         LDKu8slice ser_ref;
70840         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
70841         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
70842         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
70843         *ret_conv = ReceiveTlvs_read(ser_ref);
70844         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
70845         return tag_ptr(ret_conv, true);
70846 }
70847
70848 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1write(JNIEnv *env, jclass clz, int64_t obj) {
70849         LDKPaymentRelay obj_conv;
70850         obj_conv.inner = untag_ptr(obj);
70851         obj_conv.is_owned = ptr_is_owned(obj);
70852         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70853         obj_conv.is_owned = false;
70854         LDKCVec_u8Z ret_var = PaymentRelay_write(&obj_conv);
70855         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70856         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70857         CVec_u8Z_free(ret_var);
70858         return ret_arr;
70859 }
70860
70861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
70862         LDKu8slice ser_ref;
70863         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
70864         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
70865         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
70866         *ret_conv = PaymentRelay_read(ser_ref);
70867         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
70868         return tag_ptr(ret_conv, true);
70869 }
70870
70871 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1write(JNIEnv *env, jclass clz, int64_t obj) {
70872         LDKPaymentConstraints obj_conv;
70873         obj_conv.inner = untag_ptr(obj);
70874         obj_conv.is_owned = ptr_is_owned(obj);
70875         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70876         obj_conv.is_owned = false;
70877         LDKCVec_u8Z ret_var = PaymentConstraints_write(&obj_conv);
70878         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70879         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70880         CVec_u8Z_free(ret_var);
70881         return ret_arr;
70882 }
70883
70884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
70885         LDKu8slice ser_ref;
70886         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
70887         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
70888         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
70889         *ret_conv = PaymentConstraints_read(ser_ref);
70890         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
70891         return tag_ptr(ret_conv, true);
70892 }
70893
70894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
70895         if (!ptr_is_owned(this_ptr)) return;
70896         void* this_ptr_ptr = untag_ptr(this_ptr);
70897         CHECK_ACCESS(this_ptr_ptr);
70898         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
70899         FREE(untag_ptr(this_ptr));
70900         PaymentPurpose_free(this_ptr_conv);
70901 }
70902
70903 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
70904         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
70905         *ret_copy = PaymentPurpose_clone(arg);
70906         int64_t ret_ref = tag_ptr(ret_copy, true);
70907         return ret_ref;
70908 }
70909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70910         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
70911         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
70912         return ret_conv;
70913 }
70914
70915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70916         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
70917         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
70918         *ret_copy = PaymentPurpose_clone(orig_conv);
70919         int64_t ret_ref = tag_ptr(ret_copy, true);
70920         return ret_ref;
70921 }
70922
70923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int64_t payment_preimage, int8_tArray payment_secret) {
70924         void* payment_preimage_ptr = untag_ptr(payment_preimage);
70925         CHECK_ACCESS(payment_preimage_ptr);
70926         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
70927         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
70928         LDKThirtyTwoBytes payment_secret_ref;
70929         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
70930         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
70931         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
70932         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_conv, payment_secret_ref);
70933         int64_t ret_ref = tag_ptr(ret_copy, true);
70934         return ret_ref;
70935 }
70936
70937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
70938         LDKThirtyTwoBytes a_ref;
70939         CHECK((*env)->GetArrayLength(env, a) == 32);
70940         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
70941         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
70942         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
70943         int64_t ret_ref = tag_ptr(ret_copy, true);
70944         return ret_ref;
70945 }
70946
70947 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
70948         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
70949         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
70950         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
70951         return ret_conv;
70952 }
70953
70954 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1write(JNIEnv *env, jclass clz, int64_t obj) {
70955         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
70956         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
70957         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70958         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70959         CVec_u8Z_free(ret_var);
70960         return ret_arr;
70961 }
70962
70963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
70964         LDKu8slice ser_ref;
70965         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
70966         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
70967         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
70968         *ret_conv = PaymentPurpose_read(ser_ref);
70969         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
70970         return tag_ptr(ret_conv, true);
70971 }
70972
70973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70974         LDKClaimedHTLC this_obj_conv;
70975         this_obj_conv.inner = untag_ptr(this_obj);
70976         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70978         ClaimedHTLC_free(this_obj_conv);
70979 }
70980
70981 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
70982         LDKClaimedHTLC this_ptr_conv;
70983         this_ptr_conv.inner = untag_ptr(this_ptr);
70984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70986         this_ptr_conv.is_owned = false;
70987         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
70988         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClaimedHTLC_get_channel_id(&this_ptr_conv));
70989         return ret_arr;
70990 }
70991
70992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
70993         LDKClaimedHTLC this_ptr_conv;
70994         this_ptr_conv.inner = untag_ptr(this_ptr);
70995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70997         this_ptr_conv.is_owned = false;
70998         LDKThirtyTwoBytes val_ref;
70999         CHECK((*env)->GetArrayLength(env, val) == 32);
71000         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
71001         ClaimedHTLC_set_channel_id(&this_ptr_conv, val_ref);
71002 }
71003
71004 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
71005         LDKClaimedHTLC this_ptr_conv;
71006         this_ptr_conv.inner = untag_ptr(this_ptr);
71007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71009         this_ptr_conv.is_owned = false;
71010         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
71011         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, ClaimedHTLC_get_user_channel_id(&this_ptr_conv).le_bytes);
71012         return ret_arr;
71013 }
71014
71015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
71016         LDKClaimedHTLC this_ptr_conv;
71017         this_ptr_conv.inner = untag_ptr(this_ptr);
71018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71020         this_ptr_conv.is_owned = false;
71021         LDKU128 val_ref;
71022         CHECK((*env)->GetArrayLength(env, val) == 16);
71023         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
71024         ClaimedHTLC_set_user_channel_id(&this_ptr_conv, val_ref);
71025 }
71026
71027 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
71028         LDKClaimedHTLC this_ptr_conv;
71029         this_ptr_conv.inner = untag_ptr(this_ptr);
71030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71032         this_ptr_conv.is_owned = false;
71033         int32_t ret_conv = ClaimedHTLC_get_cltv_expiry(&this_ptr_conv);
71034         return ret_conv;
71035 }
71036
71037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
71038         LDKClaimedHTLC this_ptr_conv;
71039         this_ptr_conv.inner = untag_ptr(this_ptr);
71040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71042         this_ptr_conv.is_owned = false;
71043         ClaimedHTLC_set_cltv_expiry(&this_ptr_conv, val);
71044 }
71045
71046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
71047         LDKClaimedHTLC this_ptr_conv;
71048         this_ptr_conv.inner = untag_ptr(this_ptr);
71049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71051         this_ptr_conv.is_owned = false;
71052         int64_t ret_conv = ClaimedHTLC_get_value_msat(&this_ptr_conv);
71053         return ret_conv;
71054 }
71055
71056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71057         LDKClaimedHTLC this_ptr_conv;
71058         this_ptr_conv.inner = untag_ptr(this_ptr);
71059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71061         this_ptr_conv.is_owned = false;
71062         ClaimedHTLC_set_value_msat(&this_ptr_conv, val);
71063 }
71064
71065 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) {
71066         LDKThirtyTwoBytes channel_id_arg_ref;
71067         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
71068         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
71069         LDKU128 user_channel_id_arg_ref;
71070         CHECK((*env)->GetArrayLength(env, user_channel_id_arg) == 16);
71071         (*env)->GetByteArrayRegion(env, user_channel_id_arg, 0, 16, user_channel_id_arg_ref.le_bytes);
71072         LDKClaimedHTLC ret_var = ClaimedHTLC_new(channel_id_arg_ref, user_channel_id_arg_ref, cltv_expiry_arg, value_msat_arg);
71073         int64_t ret_ref = 0;
71074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71076         return ret_ref;
71077 }
71078
71079 static inline uint64_t ClaimedHTLC_clone_ptr(LDKClaimedHTLC *NONNULL_PTR arg) {
71080         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(arg);
71081         int64_t ret_ref = 0;
71082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71084         return ret_ref;
71085 }
71086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71087         LDKClaimedHTLC arg_conv;
71088         arg_conv.inner = untag_ptr(arg);
71089         arg_conv.is_owned = ptr_is_owned(arg);
71090         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71091         arg_conv.is_owned = false;
71092         int64_t ret_conv = ClaimedHTLC_clone_ptr(&arg_conv);
71093         return ret_conv;
71094 }
71095
71096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71097         LDKClaimedHTLC orig_conv;
71098         orig_conv.inner = untag_ptr(orig);
71099         orig_conv.is_owned = ptr_is_owned(orig);
71100         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71101         orig_conv.is_owned = false;
71102         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(&orig_conv);
71103         int64_t ret_ref = 0;
71104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71106         return ret_ref;
71107 }
71108
71109 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
71110         LDKClaimedHTLC a_conv;
71111         a_conv.inner = untag_ptr(a);
71112         a_conv.is_owned = ptr_is_owned(a);
71113         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71114         a_conv.is_owned = false;
71115         LDKClaimedHTLC b_conv;
71116         b_conv.inner = untag_ptr(b);
71117         b_conv.is_owned = ptr_is_owned(b);
71118         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71119         b_conv.is_owned = false;
71120         jboolean ret_conv = ClaimedHTLC_eq(&a_conv, &b_conv);
71121         return ret_conv;
71122 }
71123
71124 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
71125         LDKClaimedHTLC obj_conv;
71126         obj_conv.inner = untag_ptr(obj);
71127         obj_conv.is_owned = ptr_is_owned(obj);
71128         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71129         obj_conv.is_owned = false;
71130         LDKCVec_u8Z ret_var = ClaimedHTLC_write(&obj_conv);
71131         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71132         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71133         CVec_u8Z_free(ret_var);
71134         return ret_arr;
71135 }
71136
71137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
71138         LDKu8slice ser_ref;
71139         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
71140         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
71141         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
71142         *ret_conv = ClaimedHTLC_read(ser_ref);
71143         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
71144         return tag_ptr(ret_conv, true);
71145 }
71146
71147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PathFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
71148         if (!ptr_is_owned(this_ptr)) return;
71149         void* this_ptr_ptr = untag_ptr(this_ptr);
71150         CHECK_ACCESS(this_ptr_ptr);
71151         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
71152         FREE(untag_ptr(this_ptr));
71153         PathFailure_free(this_ptr_conv);
71154 }
71155
71156 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
71157         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
71158         *ret_copy = PathFailure_clone(arg);
71159         int64_t ret_ref = tag_ptr(ret_copy, true);
71160         return ret_ref;
71161 }
71162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71163         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
71164         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
71165         return ret_conv;
71166 }
71167
71168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71169         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
71170         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
71171         *ret_copy = PathFailure_clone(orig_conv);
71172         int64_t ret_ref = tag_ptr(ret_copy, true);
71173         return ret_ref;
71174 }
71175
71176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1initial_1send(JNIEnv *env, jclass clz, int64_t err) {
71177         void* err_ptr = untag_ptr(err);
71178         CHECK_ACCESS(err_ptr);
71179         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
71180         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
71181         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
71182         *ret_copy = PathFailure_initial_send(err_conv);
71183         int64_t ret_ref = tag_ptr(ret_copy, true);
71184         return ret_ref;
71185 }
71186
71187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1on_1path(JNIEnv *env, jclass clz, int64_t network_update) {
71188         void* network_update_ptr = untag_ptr(network_update);
71189         CHECK_ACCESS(network_update_ptr);
71190         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
71191         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
71192         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
71193         *ret_copy = PathFailure_on_path(network_update_conv);
71194         int64_t ret_ref = tag_ptr(ret_copy, true);
71195         return ret_ref;
71196 }
71197
71198 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PathFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
71199         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
71200         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
71201         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
71202         return ret_conv;
71203 }
71204
71205 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PathFailure_1write(JNIEnv *env, jclass clz, int64_t obj) {
71206         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
71207         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
71208         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71209         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71210         CVec_u8Z_free(ret_var);
71211         return ret_arr;
71212 }
71213
71214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
71215         LDKu8slice ser_ref;
71216         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
71217         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
71218         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
71219         *ret_conv = PathFailure_read(ser_ref);
71220         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
71221         return tag_ptr(ret_conv, true);
71222 }
71223
71224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
71225         if (!ptr_is_owned(this_ptr)) return;
71226         void* this_ptr_ptr = untag_ptr(this_ptr);
71227         CHECK_ACCESS(this_ptr_ptr);
71228         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
71229         FREE(untag_ptr(this_ptr));
71230         ClosureReason_free(this_ptr_conv);
71231 }
71232
71233 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
71234         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71235         *ret_copy = ClosureReason_clone(arg);
71236         int64_t ret_ref = tag_ptr(ret_copy, true);
71237         return ret_ref;
71238 }
71239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71240         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
71241         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
71242         return ret_conv;
71243 }
71244
71245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71246         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
71247         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71248         *ret_copy = ClosureReason_clone(orig_conv);
71249         int64_t ret_ref = tag_ptr(ret_copy, true);
71250         return ret_ref;
71251 }
71252
71253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, int64_t peer_msg) {
71254         LDKUntrustedString peer_msg_conv;
71255         peer_msg_conv.inner = untag_ptr(peer_msg);
71256         peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
71257         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
71258         peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
71259         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71260         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
71261         int64_t ret_ref = tag_ptr(ret_copy, true);
71262         return ret_ref;
71263 }
71264
71265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
71266         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71267         *ret_copy = ClosureReason_holder_force_closed();
71268         int64_t ret_ref = tag_ptr(ret_copy, true);
71269         return ret_ref;
71270 }
71271
71272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
71273         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71274         *ret_copy = ClosureReason_cooperative_closure();
71275         int64_t ret_ref = tag_ptr(ret_copy, true);
71276         return ret_ref;
71277 }
71278
71279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
71280         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71281         *ret_copy = ClosureReason_commitment_tx_confirmed();
71282         int64_t ret_ref = tag_ptr(ret_copy, true);
71283         return ret_ref;
71284 }
71285
71286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1timed_1out(JNIEnv *env, jclass clz) {
71287         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71288         *ret_copy = ClosureReason_funding_timed_out();
71289         int64_t ret_ref = tag_ptr(ret_copy, true);
71290         return ret_ref;
71291 }
71292
71293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
71294         LDKStr err_conv = java_to_owned_str(env, err);
71295         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71296         *ret_copy = ClosureReason_processing_error(err_conv);
71297         int64_t ret_ref = tag_ptr(ret_copy, true);
71298         return ret_ref;
71299 }
71300
71301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
71302         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71303         *ret_copy = ClosureReason_disconnected_peer();
71304         int64_t ret_ref = tag_ptr(ret_copy, true);
71305         return ret_ref;
71306 }
71307
71308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
71309         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71310         *ret_copy = ClosureReason_outdated_channel_manager();
71311         int64_t ret_ref = tag_ptr(ret_copy, true);
71312         return ret_ref;
71313 }
71314
71315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1coop_1closed_1unfunded_1channel(JNIEnv *env, jclass clz) {
71316         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71317         *ret_copy = ClosureReason_counterparty_coop_closed_unfunded_channel();
71318         int64_t ret_ref = tag_ptr(ret_copy, true);
71319         return ret_ref;
71320 }
71321
71322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1batch_1closure(JNIEnv *env, jclass clz) {
71323         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71324         *ret_copy = ClosureReason_funding_batch_closure();
71325         int64_t ret_ref = tag_ptr(ret_copy, true);
71326         return ret_ref;
71327 }
71328
71329 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosureReason_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
71330         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
71331         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
71332         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
71333         return ret_conv;
71334 }
71335
71336 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
71337         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
71338         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
71339         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71340         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71341         CVec_u8Z_free(ret_var);
71342         return ret_arr;
71343 }
71344
71345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
71346         LDKu8slice ser_ref;
71347         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
71348         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
71349         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
71350         *ret_conv = ClosureReason_read(ser_ref);
71351         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
71352         return tag_ptr(ret_conv, true);
71353 }
71354
71355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
71356         if (!ptr_is_owned(this_ptr)) return;
71357         void* this_ptr_ptr = untag_ptr(this_ptr);
71358         CHECK_ACCESS(this_ptr_ptr);
71359         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
71360         FREE(untag_ptr(this_ptr));
71361         HTLCDestination_free(this_ptr_conv);
71362 }
71363
71364 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
71365         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
71366         *ret_copy = HTLCDestination_clone(arg);
71367         int64_t ret_ref = tag_ptr(ret_copy, true);
71368         return ret_ref;
71369 }
71370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71371         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
71372         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
71373         return ret_conv;
71374 }
71375
71376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71377         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
71378         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
71379         *ret_copy = HTLCDestination_clone(orig_conv);
71380         int64_t ret_ref = tag_ptr(ret_copy, true);
71381         return ret_ref;
71382 }
71383
71384 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) {
71385         LDKPublicKey node_id_ref;
71386         CHECK((*env)->GetArrayLength(env, node_id) == 33);
71387         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
71388         LDKThirtyTwoBytes channel_id_ref;
71389         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
71390         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
71391         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
71392         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
71393         int64_t ret_ref = tag_ptr(ret_copy, true);
71394         return ret_ref;
71395 }
71396
71397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1unknown_1next_1hop(JNIEnv *env, jclass clz, int64_t requested_forward_scid) {
71398         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
71399         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
71400         int64_t ret_ref = tag_ptr(ret_copy, true);
71401         return ret_ref;
71402 }
71403
71404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1invalid_1forward(JNIEnv *env, jclass clz, int64_t requested_forward_scid) {
71405         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
71406         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
71407         int64_t ret_ref = tag_ptr(ret_copy, true);
71408         return ret_ref;
71409 }
71410
71411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1failed_1payment(JNIEnv *env, jclass clz, int8_tArray payment_hash) {
71412         LDKThirtyTwoBytes payment_hash_ref;
71413         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
71414         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
71415         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
71416         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
71417         int64_t ret_ref = tag_ptr(ret_copy, true);
71418         return ret_ref;
71419 }
71420
71421 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
71422         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
71423         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
71424         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
71425         return ret_conv;
71426 }
71427
71428 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1write(JNIEnv *env, jclass clz, int64_t obj) {
71429         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
71430         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
71431         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71432         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71433         CVec_u8Z_free(ret_var);
71434         return ret_arr;
71435 }
71436
71437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
71438         LDKu8slice ser_ref;
71439         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
71440         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
71441         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
71442         *ret_conv = HTLCDestination_read(ser_ref);
71443         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
71444         return tag_ptr(ret_conv, true);
71445 }
71446
71447 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71448         LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
71449         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_clone(orig_conv));
71450         return ret_conv;
71451 }
71452
71453 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1recipient_1rejected(JNIEnv *env, jclass clz) {
71454         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_recipient_rejected());
71455         return ret_conv;
71456 }
71457
71458 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1user_1abandoned(JNIEnv *env, jclass clz) {
71459         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_user_abandoned());
71460         return ret_conv;
71461 }
71462
71463 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1retries_1exhausted(JNIEnv *env, jclass clz) {
71464         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_retries_exhausted());
71465         return ret_conv;
71466 }
71467
71468 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1payment_1expired(JNIEnv *env, jclass clz) {
71469         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_payment_expired());
71470         return ret_conv;
71471 }
71472
71473 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1route_1not_1found(JNIEnv *env, jclass clz) {
71474         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_route_not_found());
71475         return ret_conv;
71476 }
71477
71478 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1unexpected_1error(JNIEnv *env, jclass clz) {
71479         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_unexpected_error());
71480         return ret_conv;
71481 }
71482
71483 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
71484         LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
71485         LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
71486         jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
71487         return ret_conv;
71488 }
71489
71490 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
71491         LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
71492         LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
71493         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71494         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71495         CVec_u8Z_free(ret_var);
71496         return ret_arr;
71497 }
71498
71499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
71500         LDKu8slice ser_ref;
71501         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
71502         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
71503         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
71504         *ret_conv = PaymentFailureReason_read(ser_ref);
71505         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
71506         return tag_ptr(ret_conv, true);
71507 }
71508
71509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
71510         if (!ptr_is_owned(this_ptr)) return;
71511         void* this_ptr_ptr = untag_ptr(this_ptr);
71512         CHECK_ACCESS(this_ptr_ptr);
71513         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
71514         FREE(untag_ptr(this_ptr));
71515         Event_free(this_ptr_conv);
71516 }
71517
71518 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
71519         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71520         *ret_copy = Event_clone(arg);
71521         int64_t ret_ref = tag_ptr(ret_copy, true);
71522         return ret_ref;
71523 }
71524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71525         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
71526         int64_t ret_conv = Event_clone_ptr(arg_conv);
71527         return ret_conv;
71528 }
71529
71530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71531         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
71532         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71533         *ret_copy = Event_clone(orig_conv);
71534         int64_t ret_ref = tag_ptr(ret_copy, true);
71535         return ret_ref;
71536 }
71537
71538 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) {
71539         LDKThirtyTwoBytes temporary_channel_id_ref;
71540         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
71541         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
71542         LDKPublicKey counterparty_node_id_ref;
71543         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
71544         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
71545         LDKCVec_u8Z output_script_ref;
71546         output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
71547         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
71548         (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
71549         LDKU128 user_channel_id_ref;
71550         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
71551         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
71552         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71553         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
71554         int64_t ret_ref = tag_ptr(ret_copy, true);
71555         return ret_ref;
71556 }
71557
71558 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) {
71559         LDKPublicKey receiver_node_id_ref;
71560         CHECK((*env)->GetArrayLength(env, receiver_node_id) == 33);
71561         (*env)->GetByteArrayRegion(env, receiver_node_id, 0, 33, receiver_node_id_ref.compressed_form);
71562         LDKThirtyTwoBytes payment_hash_ref;
71563         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
71564         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
71565         LDKRecipientOnionFields onion_fields_conv;
71566         onion_fields_conv.inner = untag_ptr(onion_fields);
71567         onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
71568         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
71569         onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
71570         void* purpose_ptr = untag_ptr(purpose);
71571         CHECK_ACCESS(purpose_ptr);
71572         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
71573         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
71574         void* via_channel_id_ptr = untag_ptr(via_channel_id);
71575         CHECK_ACCESS(via_channel_id_ptr);
71576         LDKCOption_ThirtyTwoBytesZ via_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(via_channel_id_ptr);
71577         via_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(via_channel_id));
71578         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
71579         CHECK_ACCESS(via_user_channel_id_ptr);
71580         LDKCOption_U128Z via_user_channel_id_conv = *(LDKCOption_U128Z*)(via_user_channel_id_ptr);
71581         via_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(via_user_channel_id));
71582         void* claim_deadline_ptr = untag_ptr(claim_deadline);
71583         CHECK_ACCESS(claim_deadline_ptr);
71584         LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
71585         claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
71586         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71587         *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);
71588         int64_t ret_ref = tag_ptr(ret_copy, true);
71589         return ret_ref;
71590 }
71591
71592 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) {
71593         LDKPublicKey receiver_node_id_ref;
71594         CHECK((*env)->GetArrayLength(env, receiver_node_id) == 33);
71595         (*env)->GetByteArrayRegion(env, receiver_node_id, 0, 33, receiver_node_id_ref.compressed_form);
71596         LDKThirtyTwoBytes payment_hash_ref;
71597         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
71598         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
71599         void* purpose_ptr = untag_ptr(purpose);
71600         CHECK_ACCESS(purpose_ptr);
71601         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
71602         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
71603         LDKCVec_ClaimedHTLCZ htlcs_constr;
71604         htlcs_constr.datalen = (*env)->GetArrayLength(env, htlcs);
71605         if (htlcs_constr.datalen > 0)
71606                 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
71607         else
71608                 htlcs_constr.data = NULL;
71609         int64_t* htlcs_vals = (*env)->GetLongArrayElements (env, htlcs, NULL);
71610         for (size_t n = 0; n < htlcs_constr.datalen; n++) {
71611                 int64_t htlcs_conv_13 = htlcs_vals[n];
71612                 LDKClaimedHTLC htlcs_conv_13_conv;
71613                 htlcs_conv_13_conv.inner = untag_ptr(htlcs_conv_13);
71614                 htlcs_conv_13_conv.is_owned = ptr_is_owned(htlcs_conv_13);
71615                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_conv);
71616                 htlcs_conv_13_conv = ClaimedHTLC_clone(&htlcs_conv_13_conv);
71617                 htlcs_constr.data[n] = htlcs_conv_13_conv;
71618         }
71619         (*env)->ReleaseLongArrayElements(env, htlcs, htlcs_vals, 0);
71620         void* sender_intended_total_msat_ptr = untag_ptr(sender_intended_total_msat);
71621         CHECK_ACCESS(sender_intended_total_msat_ptr);
71622         LDKCOption_u64Z sender_intended_total_msat_conv = *(LDKCOption_u64Z*)(sender_intended_total_msat_ptr);
71623         sender_intended_total_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(sender_intended_total_msat));
71624         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71625         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv, htlcs_constr, sender_intended_total_msat_conv);
71626         int64_t ret_ref = tag_ptr(ret_copy, true);
71627         return ret_ref;
71628 }
71629
71630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1invoice_1request_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id) {
71631         LDKThirtyTwoBytes payment_id_ref;
71632         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
71633         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
71634         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71635         *ret_copy = Event_invoice_request_failed(payment_id_ref);
71636         int64_t ret_ref = tag_ptr(ret_copy, true);
71637         return ret_ref;
71638 }
71639
71640 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) {
71641         void* payment_id_ptr = untag_ptr(payment_id);
71642         CHECK_ACCESS(payment_id_ptr);
71643         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
71644         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
71645         LDKThirtyTwoBytes payment_preimage_ref;
71646         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
71647         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
71648         LDKThirtyTwoBytes payment_hash_ref;
71649         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
71650         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
71651         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
71652         CHECK_ACCESS(fee_paid_msat_ptr);
71653         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
71654         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
71655         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71656         *ret_copy = Event_payment_sent(payment_id_conv, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
71657         int64_t ret_ref = tag_ptr(ret_copy, true);
71658         return ret_ref;
71659 }
71660
71661 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) {
71662         LDKThirtyTwoBytes payment_id_ref;
71663         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
71664         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
71665         LDKThirtyTwoBytes payment_hash_ref;
71666         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
71667         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
71668         void* reason_ptr = untag_ptr(reason);
71669         CHECK_ACCESS(reason_ptr);
71670         LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
71671         reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
71672         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71673         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
71674         int64_t ret_ref = tag_ptr(ret_copy, true);
71675         return ret_ref;
71676 }
71677
71678 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) {
71679         LDKThirtyTwoBytes payment_id_ref;
71680         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
71681         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
71682         void* payment_hash_ptr = untag_ptr(payment_hash);
71683         CHECK_ACCESS(payment_hash_ptr);
71684         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
71685         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
71686         LDKPath path_conv;
71687         path_conv.inner = untag_ptr(path);
71688         path_conv.is_owned = ptr_is_owned(path);
71689         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
71690         path_conv = Path_clone(&path_conv);
71691         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71692         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_conv, path_conv);
71693         int64_t ret_ref = tag_ptr(ret_copy, true);
71694         return ret_ref;
71695 }
71696
71697 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) {
71698         void* payment_id_ptr = untag_ptr(payment_id);
71699         CHECK_ACCESS(payment_id_ptr);
71700         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
71701         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
71702         LDKThirtyTwoBytes payment_hash_ref;
71703         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
71704         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
71705         void* failure_ptr = untag_ptr(failure);
71706         CHECK_ACCESS(failure_ptr);
71707         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
71708         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
71709         LDKPath path_conv;
71710         path_conv.inner = untag_ptr(path);
71711         path_conv.is_owned = ptr_is_owned(path);
71712         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
71713         path_conv = Path_clone(&path_conv);
71714         void* short_channel_id_ptr = untag_ptr(short_channel_id);
71715         CHECK_ACCESS(short_channel_id_ptr);
71716         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
71717         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
71718         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71719         *ret_copy = Event_payment_path_failed(payment_id_conv, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
71720         int64_t ret_ref = tag_ptr(ret_copy, true);
71721         return ret_ref;
71722 }
71723
71724 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) {
71725         LDKThirtyTwoBytes payment_id_ref;
71726         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
71727         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
71728         LDKThirtyTwoBytes payment_hash_ref;
71729         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
71730         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
71731         LDKPath path_conv;
71732         path_conv.inner = untag_ptr(path);
71733         path_conv.is_owned = ptr_is_owned(path);
71734         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
71735         path_conv = Path_clone(&path_conv);
71736         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71737         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
71738         int64_t ret_ref = tag_ptr(ret_copy, true);
71739         return ret_ref;
71740 }
71741
71742 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) {
71743         LDKThirtyTwoBytes payment_id_ref;
71744         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
71745         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
71746         LDKThirtyTwoBytes payment_hash_ref;
71747         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
71748         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
71749         LDKPath path_conv;
71750         path_conv.inner = untag_ptr(path);
71751         path_conv.is_owned = ptr_is_owned(path);
71752         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
71753         path_conv = Path_clone(&path_conv);
71754         void* short_channel_id_ptr = untag_ptr(short_channel_id);
71755         CHECK_ACCESS(short_channel_id_ptr);
71756         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
71757         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
71758         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71759         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
71760         int64_t ret_ref = tag_ptr(ret_copy, true);
71761         return ret_ref;
71762 }
71763
71764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
71765         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71766         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
71767         int64_t ret_ref = tag_ptr(ret_copy, true);
71768         return ret_ref;
71769 }
71770
71771 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) {
71772         LDKThirtyTwoBytes intercept_id_ref;
71773         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
71774         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
71775         LDKThirtyTwoBytes payment_hash_ref;
71776         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
71777         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
71778         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71779         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
71780         int64_t ret_ref = tag_ptr(ret_copy, true);
71781         return ret_ref;
71782 }
71783
71784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs, int64_t channel_id) {
71785         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
71786         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
71787         if (outputs_constr.datalen > 0)
71788                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
71789         else
71790                 outputs_constr.data = NULL;
71791         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
71792         for (size_t b = 0; b < outputs_constr.datalen; b++) {
71793                 int64_t outputs_conv_27 = outputs_vals[b];
71794                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
71795                 CHECK_ACCESS(outputs_conv_27_ptr);
71796                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
71797                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
71798                 outputs_constr.data[b] = outputs_conv_27_conv;
71799         }
71800         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
71801         void* channel_id_ptr = untag_ptr(channel_id);
71802         CHECK_ACCESS(channel_id_ptr);
71803         LDKCOption_ThirtyTwoBytesZ channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(channel_id_ptr);
71804         channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(channel_id));
71805         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71806         *ret_copy = Event_spendable_outputs(outputs_constr, channel_id_conv);
71807         int64_t ret_ref = tag_ptr(ret_copy, true);
71808         return ret_ref;
71809 }
71810
71811 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) {
71812         void* prev_channel_id_ptr = untag_ptr(prev_channel_id);
71813         CHECK_ACCESS(prev_channel_id_ptr);
71814         LDKCOption_ThirtyTwoBytesZ prev_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(prev_channel_id_ptr);
71815         prev_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(prev_channel_id));
71816         void* next_channel_id_ptr = untag_ptr(next_channel_id);
71817         CHECK_ACCESS(next_channel_id_ptr);
71818         LDKCOption_ThirtyTwoBytesZ next_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_channel_id_ptr);
71819         next_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_channel_id));
71820         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
71821         CHECK_ACCESS(fee_earned_msat_ptr);
71822         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
71823         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
71824         void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
71825         CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
71826         LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
71827         outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
71828         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71829         *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);
71830         int64_t ret_ref = tag_ptr(ret_copy, true);
71831         return ret_ref;
71832 }
71833
71834 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) {
71835         LDKThirtyTwoBytes channel_id_ref;
71836         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
71837         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
71838         LDKU128 user_channel_id_ref;
71839         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
71840         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
71841         void* former_temporary_channel_id_ptr = untag_ptr(former_temporary_channel_id);
71842         CHECK_ACCESS(former_temporary_channel_id_ptr);
71843         LDKCOption_ThirtyTwoBytesZ former_temporary_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(former_temporary_channel_id_ptr);
71844         former_temporary_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(former_temporary_channel_id));
71845         LDKPublicKey counterparty_node_id_ref;
71846         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
71847         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
71848         LDKOutPoint funding_txo_conv;
71849         funding_txo_conv.inner = untag_ptr(funding_txo);
71850         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
71851         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
71852         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
71853         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71854         *ret_copy = Event_channel_pending(channel_id_ref, user_channel_id_ref, former_temporary_channel_id_conv, counterparty_node_id_ref, funding_txo_conv);
71855         int64_t ret_ref = tag_ptr(ret_copy, true);
71856         return ret_ref;
71857 }
71858
71859 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) {
71860         LDKThirtyTwoBytes channel_id_ref;
71861         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
71862         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
71863         LDKU128 user_channel_id_ref;
71864         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
71865         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
71866         LDKPublicKey counterparty_node_id_ref;
71867         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
71868         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
71869         LDKChannelTypeFeatures channel_type_conv;
71870         channel_type_conv.inner = untag_ptr(channel_type);
71871         channel_type_conv.is_owned = ptr_is_owned(channel_type);
71872         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
71873         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
71874         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71875         *ret_copy = Event_channel_ready(channel_id_ref, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
71876         int64_t ret_ref = tag_ptr(ret_copy, true);
71877         return ret_ref;
71878 }
71879
71880 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) {
71881         LDKThirtyTwoBytes channel_id_ref;
71882         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
71883         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
71884         LDKU128 user_channel_id_ref;
71885         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
71886         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
71887         void* reason_ptr = untag_ptr(reason);
71888         CHECK_ACCESS(reason_ptr);
71889         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
71890         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
71891         LDKPublicKey counterparty_node_id_ref;
71892         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
71893         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
71894         void* channel_capacity_sats_ptr = untag_ptr(channel_capacity_sats);
71895         CHECK_ACCESS(channel_capacity_sats_ptr);
71896         LDKCOption_u64Z channel_capacity_sats_conv = *(LDKCOption_u64Z*)(channel_capacity_sats_ptr);
71897         channel_capacity_sats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(channel_capacity_sats));
71898         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71899         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id_ref, reason_conv, counterparty_node_id_ref, channel_capacity_sats_conv);
71900         int64_t ret_ref = tag_ptr(ret_copy, true);
71901         return ret_ref;
71902 }
71903
71904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray transaction) {
71905         LDKThirtyTwoBytes channel_id_ref;
71906         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
71907         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
71908         LDKTransaction transaction_ref;
71909         transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
71910         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
71911         (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
71912         transaction_ref.data_is_owned = true;
71913         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71914         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
71915         int64_t ret_ref = tag_ptr(ret_copy, true);
71916         return ret_ref;
71917 }
71918
71919 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) {
71920         LDKThirtyTwoBytes temporary_channel_id_ref;
71921         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
71922         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
71923         LDKPublicKey counterparty_node_id_ref;
71924         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
71925         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
71926         LDKChannelTypeFeatures channel_type_conv;
71927         channel_type_conv.inner = untag_ptr(channel_type);
71928         channel_type_conv.is_owned = ptr_is_owned(channel_type);
71929         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
71930         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
71931         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71932         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
71933         int64_t ret_ref = tag_ptr(ret_copy, true);
71934         return ret_ref;
71935 }
71936
71937 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) {
71938         LDKThirtyTwoBytes prev_channel_id_ref;
71939         CHECK((*env)->GetArrayLength(env, prev_channel_id) == 32);
71940         (*env)->GetByteArrayRegion(env, prev_channel_id, 0, 32, prev_channel_id_ref.data);
71941         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
71942         CHECK_ACCESS(failed_next_destination_ptr);
71943         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
71944         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
71945         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71946         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
71947         int64_t ret_ref = tag_ptr(ret_copy, true);
71948         return ret_ref;
71949 }
71950
71951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1bump_1transaction(JNIEnv *env, jclass clz, int64_t a) {
71952         void* a_ptr = untag_ptr(a);
71953         CHECK_ACCESS(a_ptr);
71954         LDKBumpTransactionEvent a_conv = *(LDKBumpTransactionEvent*)(a_ptr);
71955         a_conv = BumpTransactionEvent_clone((LDKBumpTransactionEvent*)untag_ptr(a));
71956         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71957         *ret_copy = Event_bump_transaction(a_conv);
71958         int64_t ret_ref = tag_ptr(ret_copy, true);
71959         return ret_ref;
71960 }
71961
71962 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Event_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
71963         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
71964         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
71965         jboolean ret_conv = Event_eq(a_conv, b_conv);
71966         return ret_conv;
71967 }
71968
71969 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
71970         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
71971         LDKCVec_u8Z ret_var = Event_write(obj_conv);
71972         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71973         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71974         CVec_u8Z_free(ret_var);
71975         return ret_arr;
71976 }
71977
71978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
71979         LDKu8slice ser_ref;
71980         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
71981         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
71982         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
71983         *ret_conv = Event_read(ser_ref);
71984         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
71985         return tag_ptr(ret_conv, true);
71986 }
71987
71988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
71989         if (!ptr_is_owned(this_ptr)) return;
71990         void* this_ptr_ptr = untag_ptr(this_ptr);
71991         CHECK_ACCESS(this_ptr_ptr);
71992         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
71993         FREE(untag_ptr(this_ptr));
71994         MessageSendEvent_free(this_ptr_conv);
71995 }
71996
71997 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
71998         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
71999         *ret_copy = MessageSendEvent_clone(arg);
72000         int64_t ret_ref = tag_ptr(ret_copy, true);
72001         return ret_ref;
72002 }
72003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72004         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
72005         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
72006         return ret_conv;
72007 }
72008
72009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72010         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
72011         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72012         *ret_copy = MessageSendEvent_clone(orig_conv);
72013         int64_t ret_ref = tag_ptr(ret_copy, true);
72014         return ret_ref;
72015 }
72016
72017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
72018         LDKPublicKey node_id_ref;
72019         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72020         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72021         LDKAcceptChannel msg_conv;
72022         msg_conv.inner = untag_ptr(msg);
72023         msg_conv.is_owned = ptr_is_owned(msg);
72024         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72025         msg_conv = AcceptChannel_clone(&msg_conv);
72026         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72027         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
72028         int64_t ret_ref = tag_ptr(ret_copy, true);
72029         return ret_ref;
72030 }
72031
72032 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) {
72033         LDKPublicKey node_id_ref;
72034         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72035         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72036         LDKAcceptChannelV2 msg_conv;
72037         msg_conv.inner = untag_ptr(msg);
72038         msg_conv.is_owned = ptr_is_owned(msg);
72039         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72040         msg_conv = AcceptChannelV2_clone(&msg_conv);
72041         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72042         *ret_copy = MessageSendEvent_send_accept_channel_v2(node_id_ref, msg_conv);
72043         int64_t ret_ref = tag_ptr(ret_copy, true);
72044         return ret_ref;
72045 }
72046
72047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
72048         LDKPublicKey node_id_ref;
72049         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72050         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72051         LDKOpenChannel msg_conv;
72052         msg_conv.inner = untag_ptr(msg);
72053         msg_conv.is_owned = ptr_is_owned(msg);
72054         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72055         msg_conv = OpenChannel_clone(&msg_conv);
72056         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72057         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
72058         int64_t ret_ref = tag_ptr(ret_copy, true);
72059         return ret_ref;
72060 }
72061
72062 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) {
72063         LDKPublicKey node_id_ref;
72064         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72065         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72066         LDKOpenChannelV2 msg_conv;
72067         msg_conv.inner = untag_ptr(msg);
72068         msg_conv.is_owned = ptr_is_owned(msg);
72069         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72070         msg_conv = OpenChannelV2_clone(&msg_conv);
72071         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72072         *ret_copy = MessageSendEvent_send_open_channel_v2(node_id_ref, msg_conv);
72073         int64_t ret_ref = tag_ptr(ret_copy, true);
72074         return ret_ref;
72075 }
72076
72077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
72078         LDKPublicKey node_id_ref;
72079         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72080         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72081         LDKFundingCreated msg_conv;
72082         msg_conv.inner = untag_ptr(msg);
72083         msg_conv.is_owned = ptr_is_owned(msg);
72084         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72085         msg_conv = FundingCreated_clone(&msg_conv);
72086         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72087         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
72088         int64_t ret_ref = tag_ptr(ret_copy, true);
72089         return ret_ref;
72090 }
72091
72092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
72093         LDKPublicKey node_id_ref;
72094         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72095         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72096         LDKFundingSigned msg_conv;
72097         msg_conv.inner = untag_ptr(msg);
72098         msg_conv.is_owned = ptr_is_owned(msg);
72099         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72100         msg_conv = FundingSigned_clone(&msg_conv);
72101         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72102         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
72103         int64_t ret_ref = tag_ptr(ret_copy, true);
72104         return ret_ref;
72105 }
72106
72107 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) {
72108         LDKPublicKey node_id_ref;
72109         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72110         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72111         LDKTxAddInput msg_conv;
72112         msg_conv.inner = untag_ptr(msg);
72113         msg_conv.is_owned = ptr_is_owned(msg);
72114         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72115         msg_conv = TxAddInput_clone(&msg_conv);
72116         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72117         *ret_copy = MessageSendEvent_send_tx_add_input(node_id_ref, msg_conv);
72118         int64_t ret_ref = tag_ptr(ret_copy, true);
72119         return ret_ref;
72120 }
72121
72122 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) {
72123         LDKPublicKey node_id_ref;
72124         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72125         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72126         LDKTxAddOutput msg_conv;
72127         msg_conv.inner = untag_ptr(msg);
72128         msg_conv.is_owned = ptr_is_owned(msg);
72129         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72130         msg_conv = TxAddOutput_clone(&msg_conv);
72131         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72132         *ret_copy = MessageSendEvent_send_tx_add_output(node_id_ref, msg_conv);
72133         int64_t ret_ref = tag_ptr(ret_copy, true);
72134         return ret_ref;
72135 }
72136
72137 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) {
72138         LDKPublicKey node_id_ref;
72139         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72140         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72141         LDKTxRemoveInput msg_conv;
72142         msg_conv.inner = untag_ptr(msg);
72143         msg_conv.is_owned = ptr_is_owned(msg);
72144         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72145         msg_conv = TxRemoveInput_clone(&msg_conv);
72146         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72147         *ret_copy = MessageSendEvent_send_tx_remove_input(node_id_ref, msg_conv);
72148         int64_t ret_ref = tag_ptr(ret_copy, true);
72149         return ret_ref;
72150 }
72151
72152 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) {
72153         LDKPublicKey node_id_ref;
72154         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72155         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72156         LDKTxRemoveOutput msg_conv;
72157         msg_conv.inner = untag_ptr(msg);
72158         msg_conv.is_owned = ptr_is_owned(msg);
72159         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72160         msg_conv = TxRemoveOutput_clone(&msg_conv);
72161         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72162         *ret_copy = MessageSendEvent_send_tx_remove_output(node_id_ref, msg_conv);
72163         int64_t ret_ref = tag_ptr(ret_copy, true);
72164         return ret_ref;
72165 }
72166
72167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1complete(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
72168         LDKPublicKey node_id_ref;
72169         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72170         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72171         LDKTxComplete msg_conv;
72172         msg_conv.inner = untag_ptr(msg);
72173         msg_conv.is_owned = ptr_is_owned(msg);
72174         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72175         msg_conv = TxComplete_clone(&msg_conv);
72176         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72177         *ret_copy = MessageSendEvent_send_tx_complete(node_id_ref, msg_conv);
72178         int64_t ret_ref = tag_ptr(ret_copy, true);
72179         return ret_ref;
72180 }
72181
72182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
72183         LDKPublicKey node_id_ref;
72184         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72185         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72186         LDKTxSignatures msg_conv;
72187         msg_conv.inner = untag_ptr(msg);
72188         msg_conv.is_owned = ptr_is_owned(msg);
72189         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72190         msg_conv = TxSignatures_clone(&msg_conv);
72191         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72192         *ret_copy = MessageSendEvent_send_tx_signatures(node_id_ref, msg_conv);
72193         int64_t ret_ref = tag_ptr(ret_copy, true);
72194         return ret_ref;
72195 }
72196
72197 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) {
72198         LDKPublicKey node_id_ref;
72199         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72200         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72201         LDKTxInitRbf msg_conv;
72202         msg_conv.inner = untag_ptr(msg);
72203         msg_conv.is_owned = ptr_is_owned(msg);
72204         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72205         msg_conv = TxInitRbf_clone(&msg_conv);
72206         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72207         *ret_copy = MessageSendEvent_send_tx_init_rbf(node_id_ref, msg_conv);
72208         int64_t ret_ref = tag_ptr(ret_copy, true);
72209         return ret_ref;
72210 }
72211
72212 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) {
72213         LDKPublicKey node_id_ref;
72214         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72215         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72216         LDKTxAckRbf msg_conv;
72217         msg_conv.inner = untag_ptr(msg);
72218         msg_conv.is_owned = ptr_is_owned(msg);
72219         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72220         msg_conv = TxAckRbf_clone(&msg_conv);
72221         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72222         *ret_copy = MessageSendEvent_send_tx_ack_rbf(node_id_ref, msg_conv);
72223         int64_t ret_ref = tag_ptr(ret_copy, true);
72224         return ret_ref;
72225 }
72226
72227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1abort(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
72228         LDKPublicKey node_id_ref;
72229         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72230         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72231         LDKTxAbort msg_conv;
72232         msg_conv.inner = untag_ptr(msg);
72233         msg_conv.is_owned = ptr_is_owned(msg);
72234         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72235         msg_conv = TxAbort_clone(&msg_conv);
72236         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72237         *ret_copy = MessageSendEvent_send_tx_abort(node_id_ref, msg_conv);
72238         int64_t ret_ref = tag_ptr(ret_copy, true);
72239         return ret_ref;
72240 }
72241
72242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1ready(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
72243         LDKPublicKey node_id_ref;
72244         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72245         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72246         LDKChannelReady msg_conv;
72247         msg_conv.inner = untag_ptr(msg);
72248         msg_conv.is_owned = ptr_is_owned(msg);
72249         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72250         msg_conv = ChannelReady_clone(&msg_conv);
72251         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72252         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
72253         int64_t ret_ref = tag_ptr(ret_copy, true);
72254         return ret_ref;
72255 }
72256
72257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
72258         LDKPublicKey node_id_ref;
72259         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72260         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72261         LDKAnnouncementSignatures msg_conv;
72262         msg_conv.inner = untag_ptr(msg);
72263         msg_conv.is_owned = ptr_is_owned(msg);
72264         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72265         msg_conv = AnnouncementSignatures_clone(&msg_conv);
72266         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72267         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
72268         int64_t ret_ref = tag_ptr(ret_copy, true);
72269         return ret_ref;
72270 }
72271
72272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
72273         LDKPublicKey node_id_ref;
72274         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72275         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72276         LDKCommitmentUpdate updates_conv;
72277         updates_conv.inner = untag_ptr(updates);
72278         updates_conv.is_owned = ptr_is_owned(updates);
72279         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
72280         updates_conv = CommitmentUpdate_clone(&updates_conv);
72281         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72282         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
72283         int64_t ret_ref = tag_ptr(ret_copy, true);
72284         return ret_ref;
72285 }
72286
72287 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) {
72288         LDKPublicKey node_id_ref;
72289         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72290         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72291         LDKRevokeAndACK msg_conv;
72292         msg_conv.inner = untag_ptr(msg);
72293         msg_conv.is_owned = ptr_is_owned(msg);
72294         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72295         msg_conv = RevokeAndACK_clone(&msg_conv);
72296         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72297         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
72298         int64_t ret_ref = tag_ptr(ret_copy, true);
72299         return ret_ref;
72300 }
72301
72302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
72303         LDKPublicKey node_id_ref;
72304         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72305         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72306         LDKClosingSigned msg_conv;
72307         msg_conv.inner = untag_ptr(msg);
72308         msg_conv.is_owned = ptr_is_owned(msg);
72309         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72310         msg_conv = ClosingSigned_clone(&msg_conv);
72311         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72312         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
72313         int64_t ret_ref = tag_ptr(ret_copy, true);
72314         return ret_ref;
72315 }
72316
72317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
72318         LDKPublicKey node_id_ref;
72319         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72320         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72321         LDKShutdown msg_conv;
72322         msg_conv.inner = untag_ptr(msg);
72323         msg_conv.is_owned = ptr_is_owned(msg);
72324         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72325         msg_conv = Shutdown_clone(&msg_conv);
72326         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72327         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
72328         int64_t ret_ref = tag_ptr(ret_copy, true);
72329         return ret_ref;
72330 }
72331
72332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
72333         LDKPublicKey node_id_ref;
72334         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72335         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72336         LDKChannelReestablish msg_conv;
72337         msg_conv.inner = untag_ptr(msg);
72338         msg_conv.is_owned = ptr_is_owned(msg);
72339         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72340         msg_conv = ChannelReestablish_clone(&msg_conv);
72341         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72342         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
72343         int64_t ret_ref = tag_ptr(ret_copy, true);
72344         return ret_ref;
72345 }
72346
72347 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) {
72348         LDKPublicKey node_id_ref;
72349         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72350         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72351         LDKChannelAnnouncement msg_conv;
72352         msg_conv.inner = untag_ptr(msg);
72353         msg_conv.is_owned = ptr_is_owned(msg);
72354         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72355         msg_conv = ChannelAnnouncement_clone(&msg_conv);
72356         LDKChannelUpdate update_msg_conv;
72357         update_msg_conv.inner = untag_ptr(update_msg);
72358         update_msg_conv.is_owned = ptr_is_owned(update_msg);
72359         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
72360         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
72361         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72362         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
72363         int64_t ret_ref = tag_ptr(ret_copy, true);
72364         return ret_ref;
72365 }
72366
72367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
72368         LDKChannelAnnouncement msg_conv;
72369         msg_conv.inner = untag_ptr(msg);
72370         msg_conv.is_owned = ptr_is_owned(msg);
72371         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72372         msg_conv = ChannelAnnouncement_clone(&msg_conv);
72373         LDKChannelUpdate update_msg_conv;
72374         update_msg_conv.inner = untag_ptr(update_msg);
72375         update_msg_conv.is_owned = ptr_is_owned(update_msg);
72376         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
72377         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
72378         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72379         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
72380         int64_t ret_ref = tag_ptr(ret_copy, true);
72381         return ret_ref;
72382 }
72383
72384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
72385         LDKChannelUpdate msg_conv;
72386         msg_conv.inner = untag_ptr(msg);
72387         msg_conv.is_owned = ptr_is_owned(msg);
72388         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72389         msg_conv = ChannelUpdate_clone(&msg_conv);
72390         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72391         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
72392         int64_t ret_ref = tag_ptr(ret_copy, true);
72393         return ret_ref;
72394 }
72395
72396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
72397         LDKNodeAnnouncement msg_conv;
72398         msg_conv.inner = untag_ptr(msg);
72399         msg_conv.is_owned = ptr_is_owned(msg);
72400         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72401         msg_conv = NodeAnnouncement_clone(&msg_conv);
72402         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72403         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
72404         int64_t ret_ref = tag_ptr(ret_copy, true);
72405         return ret_ref;
72406 }
72407
72408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
72409         LDKPublicKey node_id_ref;
72410         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72411         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72412         LDKChannelUpdate msg_conv;
72413         msg_conv.inner = untag_ptr(msg);
72414         msg_conv.is_owned = ptr_is_owned(msg);
72415         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72416         msg_conv = ChannelUpdate_clone(&msg_conv);
72417         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72418         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
72419         int64_t ret_ref = tag_ptr(ret_copy, true);
72420         return ret_ref;
72421 }
72422
72423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
72424         LDKPublicKey node_id_ref;
72425         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72426         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72427         void* action_ptr = untag_ptr(action);
72428         CHECK_ACCESS(action_ptr);
72429         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
72430         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
72431         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72432         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
72433         int64_t ret_ref = tag_ptr(ret_copy, true);
72434         return ret_ref;
72435 }
72436
72437 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) {
72438         LDKPublicKey node_id_ref;
72439         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72440         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72441         LDKQueryChannelRange msg_conv;
72442         msg_conv.inner = untag_ptr(msg);
72443         msg_conv.is_owned = ptr_is_owned(msg);
72444         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72445         msg_conv = QueryChannelRange_clone(&msg_conv);
72446         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72447         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
72448         int64_t ret_ref = tag_ptr(ret_copy, true);
72449         return ret_ref;
72450 }
72451
72452 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) {
72453         LDKPublicKey node_id_ref;
72454         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72455         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72456         LDKQueryShortChannelIds msg_conv;
72457         msg_conv.inner = untag_ptr(msg);
72458         msg_conv.is_owned = ptr_is_owned(msg);
72459         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72460         msg_conv = QueryShortChannelIds_clone(&msg_conv);
72461         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72462         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
72463         int64_t ret_ref = tag_ptr(ret_copy, true);
72464         return ret_ref;
72465 }
72466
72467 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) {
72468         LDKPublicKey node_id_ref;
72469         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72470         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72471         LDKReplyChannelRange msg_conv;
72472         msg_conv.inner = untag_ptr(msg);
72473         msg_conv.is_owned = ptr_is_owned(msg);
72474         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72475         msg_conv = ReplyChannelRange_clone(&msg_conv);
72476         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72477         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
72478         int64_t ret_ref = tag_ptr(ret_copy, true);
72479         return ret_ref;
72480 }
72481
72482 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) {
72483         LDKPublicKey node_id_ref;
72484         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72485         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72486         LDKGossipTimestampFilter msg_conv;
72487         msg_conv.inner = untag_ptr(msg);
72488         msg_conv.is_owned = ptr_is_owned(msg);
72489         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72490         msg_conv = GossipTimestampFilter_clone(&msg_conv);
72491         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72492         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
72493         int64_t ret_ref = tag_ptr(ret_copy, true);
72494         return ret_ref;
72495 }
72496
72497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
72498         if (!ptr_is_owned(this_ptr)) return;
72499         void* this_ptr_ptr = untag_ptr(this_ptr);
72500         CHECK_ACCESS(this_ptr_ptr);
72501         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
72502         FREE(untag_ptr(this_ptr));
72503         MessageSendEventsProvider_free(this_ptr_conv);
72504 }
72505
72506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
72507         if (!ptr_is_owned(this_ptr)) return;
72508         void* this_ptr_ptr = untag_ptr(this_ptr);
72509         CHECK_ACCESS(this_ptr_ptr);
72510         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
72511         FREE(untag_ptr(this_ptr));
72512         EventsProvider_free(this_ptr_conv);
72513 }
72514
72515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
72516         if (!ptr_is_owned(this_ptr)) return;
72517         void* this_ptr_ptr = untag_ptr(this_ptr);
72518         CHECK_ACCESS(this_ptr_ptr);
72519         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
72520         FREE(untag_ptr(this_ptr));
72521         EventHandler_free(this_ptr_conv);
72522 }
72523
72524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72525         LDKAnchorDescriptor this_obj_conv;
72526         this_obj_conv.inner = untag_ptr(this_obj);
72527         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72529         AnchorDescriptor_free(this_obj_conv);
72530 }
72531
72532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1get_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
72533         LDKAnchorDescriptor this_ptr_conv;
72534         this_ptr_conv.inner = untag_ptr(this_ptr);
72535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72537         this_ptr_conv.is_owned = false;
72538         LDKChannelDerivationParameters ret_var = AnchorDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
72539         int64_t ret_ref = 0;
72540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72542         return ret_ref;
72543 }
72544
72545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1set_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72546         LDKAnchorDescriptor this_ptr_conv;
72547         this_ptr_conv.inner = untag_ptr(this_ptr);
72548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72550         this_ptr_conv.is_owned = false;
72551         LDKChannelDerivationParameters val_conv;
72552         val_conv.inner = untag_ptr(val);
72553         val_conv.is_owned = ptr_is_owned(val);
72554         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
72555         val_conv = ChannelDerivationParameters_clone(&val_conv);
72556         AnchorDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
72557 }
72558
72559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
72560         LDKAnchorDescriptor this_ptr_conv;
72561         this_ptr_conv.inner = untag_ptr(this_ptr);
72562         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72564         this_ptr_conv.is_owned = false;
72565         LDKOutPoint ret_var = AnchorDescriptor_get_outpoint(&this_ptr_conv);
72566         int64_t ret_ref = 0;
72567         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72568         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72569         return ret_ref;
72570 }
72571
72572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72573         LDKAnchorDescriptor this_ptr_conv;
72574         this_ptr_conv.inner = untag_ptr(this_ptr);
72575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72577         this_ptr_conv.is_owned = false;
72578         LDKOutPoint val_conv;
72579         val_conv.inner = untag_ptr(val);
72580         val_conv.is_owned = ptr_is_owned(val);
72581         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
72582         val_conv = OutPoint_clone(&val_conv);
72583         AnchorDescriptor_set_outpoint(&this_ptr_conv, val_conv);
72584 }
72585
72586 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) {
72587         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
72588         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
72589         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
72590         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
72591         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
72592         LDKOutPoint outpoint_arg_conv;
72593         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
72594         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
72595         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
72596         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
72597         LDKAnchorDescriptor ret_var = AnchorDescriptor_new(channel_derivation_parameters_arg_conv, outpoint_arg_conv);
72598         int64_t ret_ref = 0;
72599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72601         return ret_ref;
72602 }
72603
72604 static inline uint64_t AnchorDescriptor_clone_ptr(LDKAnchorDescriptor *NONNULL_PTR arg) {
72605         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(arg);
72606         int64_t ret_ref = 0;
72607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72609         return ret_ref;
72610 }
72611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72612         LDKAnchorDescriptor arg_conv;
72613         arg_conv.inner = untag_ptr(arg);
72614         arg_conv.is_owned = ptr_is_owned(arg);
72615         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72616         arg_conv.is_owned = false;
72617         int64_t ret_conv = AnchorDescriptor_clone_ptr(&arg_conv);
72618         return ret_conv;
72619 }
72620
72621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72622         LDKAnchorDescriptor orig_conv;
72623         orig_conv.inner = untag_ptr(orig);
72624         orig_conv.is_owned = ptr_is_owned(orig);
72625         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72626         orig_conv.is_owned = false;
72627         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(&orig_conv);
72628         int64_t ret_ref = 0;
72629         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72630         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72631         return ret_ref;
72632 }
72633
72634 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
72635         LDKAnchorDescriptor a_conv;
72636         a_conv.inner = untag_ptr(a);
72637         a_conv.is_owned = ptr_is_owned(a);
72638         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72639         a_conv.is_owned = false;
72640         LDKAnchorDescriptor b_conv;
72641         b_conv.inner = untag_ptr(b);
72642         b_conv.is_owned = ptr_is_owned(b);
72643         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
72644         b_conv.is_owned = false;
72645         jboolean ret_conv = AnchorDescriptor_eq(&a_conv, &b_conv);
72646         return ret_conv;
72647 }
72648
72649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_arg) {
72650         LDKAnchorDescriptor this_arg_conv;
72651         this_arg_conv.inner = untag_ptr(this_arg);
72652         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72654         this_arg_conv.is_owned = false;
72655         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
72656         *ret_ref = AnchorDescriptor_previous_utxo(&this_arg_conv);
72657         return tag_ptr(ret_ref, true);
72658 }
72659
72660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1unsigned_1tx_1input(JNIEnv *env, jclass clz, int64_t this_arg) {
72661         LDKAnchorDescriptor this_arg_conv;
72662         this_arg_conv.inner = untag_ptr(this_arg);
72663         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72665         this_arg_conv.is_owned = false;
72666         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
72667         *ret_ref = AnchorDescriptor_unsigned_tx_input(&this_arg_conv);
72668         return tag_ptr(ret_ref, true);
72669 }
72670
72671 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
72672         LDKAnchorDescriptor this_arg_conv;
72673         this_arg_conv.inner = untag_ptr(this_arg);
72674         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72676         this_arg_conv.is_owned = false;
72677         LDKCVec_u8Z ret_var = AnchorDescriptor_witness_script(&this_arg_conv);
72678         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
72679         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
72680         CVec_u8Z_free(ret_var);
72681         return ret_arr;
72682 }
72683
72684 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1tx_1input_1witness(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray signature) {
72685         LDKAnchorDescriptor this_arg_conv;
72686         this_arg_conv.inner = untag_ptr(this_arg);
72687         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72689         this_arg_conv.is_owned = false;
72690         LDKECDSASignature signature_ref;
72691         CHECK((*env)->GetArrayLength(env, signature) == 64);
72692         (*env)->GetByteArrayRegion(env, signature, 0, 64, signature_ref.compact_form);
72693         LDKWitness ret_var = AnchorDescriptor_tx_input_witness(&this_arg_conv, signature_ref);
72694         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
72695         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
72696         Witness_free(ret_var);
72697         return ret_arr;
72698 }
72699
72700 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) {
72701         LDKAnchorDescriptor this_arg_conv;
72702         this_arg_conv.inner = untag_ptr(this_arg);
72703         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72705         this_arg_conv.is_owned = false;
72706         void* signer_provider_ptr = untag_ptr(signer_provider);
72707         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
72708         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
72709         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
72710         *ret_ret = AnchorDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
72711         return tag_ptr(ret_ret, true);
72712 }
72713
72714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
72715         if (!ptr_is_owned(this_ptr)) return;
72716         void* this_ptr_ptr = untag_ptr(this_ptr);
72717         CHECK_ACCESS(this_ptr_ptr);
72718         LDKBumpTransactionEvent this_ptr_conv = *(LDKBumpTransactionEvent*)(this_ptr_ptr);
72719         FREE(untag_ptr(this_ptr));
72720         BumpTransactionEvent_free(this_ptr_conv);
72721 }
72722
72723 static inline uint64_t BumpTransactionEvent_clone_ptr(LDKBumpTransactionEvent *NONNULL_PTR arg) {
72724         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
72725         *ret_copy = BumpTransactionEvent_clone(arg);
72726         int64_t ret_ref = tag_ptr(ret_copy, true);
72727         return ret_ref;
72728 }
72729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72730         LDKBumpTransactionEvent* arg_conv = (LDKBumpTransactionEvent*)untag_ptr(arg);
72731         int64_t ret_conv = BumpTransactionEvent_clone_ptr(arg_conv);
72732         return ret_conv;
72733 }
72734
72735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72736         LDKBumpTransactionEvent* orig_conv = (LDKBumpTransactionEvent*)untag_ptr(orig);
72737         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
72738         *ret_copy = BumpTransactionEvent_clone(orig_conv);
72739         int64_t ret_ref = tag_ptr(ret_copy, true);
72740         return ret_ref;
72741 }
72742
72743 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) {
72744         LDKThirtyTwoBytes claim_id_ref;
72745         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
72746         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
72747         LDKTransaction commitment_tx_ref;
72748         commitment_tx_ref.datalen = (*env)->GetArrayLength(env, commitment_tx);
72749         commitment_tx_ref.data = MALLOC(commitment_tx_ref.datalen, "LDKTransaction Bytes");
72750         (*env)->GetByteArrayRegion(env, commitment_tx, 0, commitment_tx_ref.datalen, commitment_tx_ref.data);
72751         commitment_tx_ref.data_is_owned = true;
72752         LDKAnchorDescriptor anchor_descriptor_conv;
72753         anchor_descriptor_conv.inner = untag_ptr(anchor_descriptor);
72754         anchor_descriptor_conv.is_owned = ptr_is_owned(anchor_descriptor);
72755         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_conv);
72756         anchor_descriptor_conv = AnchorDescriptor_clone(&anchor_descriptor_conv);
72757         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_constr;
72758         pending_htlcs_constr.datalen = (*env)->GetArrayLength(env, pending_htlcs);
72759         if (pending_htlcs_constr.datalen > 0)
72760                 pending_htlcs_constr.data = MALLOC(pending_htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
72761         else
72762                 pending_htlcs_constr.data = NULL;
72763         int64_t* pending_htlcs_vals = (*env)->GetLongArrayElements (env, pending_htlcs, NULL);
72764         for (size_t y = 0; y < pending_htlcs_constr.datalen; y++) {
72765                 int64_t pending_htlcs_conv_24 = pending_htlcs_vals[y];
72766                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_conv;
72767                 pending_htlcs_conv_24_conv.inner = untag_ptr(pending_htlcs_conv_24);
72768                 pending_htlcs_conv_24_conv.is_owned = ptr_is_owned(pending_htlcs_conv_24);
72769                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_conv);
72770                 pending_htlcs_conv_24_conv = HTLCOutputInCommitment_clone(&pending_htlcs_conv_24_conv);
72771                 pending_htlcs_constr.data[y] = pending_htlcs_conv_24_conv;
72772         }
72773         (*env)->ReleaseLongArrayElements(env, pending_htlcs, pending_htlcs_vals, 0);
72774         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
72775         *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);
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_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) {
72781         LDKThirtyTwoBytes claim_id_ref;
72782         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
72783         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
72784         LDKCVec_HTLCDescriptorZ htlc_descriptors_constr;
72785         htlc_descriptors_constr.datalen = (*env)->GetArrayLength(env, htlc_descriptors);
72786         if (htlc_descriptors_constr.datalen > 0)
72787                 htlc_descriptors_constr.data = MALLOC(htlc_descriptors_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
72788         else
72789                 htlc_descriptors_constr.data = NULL;
72790         int64_t* htlc_descriptors_vals = (*env)->GetLongArrayElements (env, htlc_descriptors, NULL);
72791         for (size_t q = 0; q < htlc_descriptors_constr.datalen; q++) {
72792                 int64_t htlc_descriptors_conv_16 = htlc_descriptors_vals[q];
72793                 LDKHTLCDescriptor htlc_descriptors_conv_16_conv;
72794                 htlc_descriptors_conv_16_conv.inner = untag_ptr(htlc_descriptors_conv_16);
72795                 htlc_descriptors_conv_16_conv.is_owned = ptr_is_owned(htlc_descriptors_conv_16);
72796                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_conv);
72797                 htlc_descriptors_conv_16_conv = HTLCDescriptor_clone(&htlc_descriptors_conv_16_conv);
72798                 htlc_descriptors_constr.data[q] = htlc_descriptors_conv_16_conv;
72799         }
72800         (*env)->ReleaseLongArrayElements(env, htlc_descriptors, htlc_descriptors_vals, 0);
72801         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
72802         *ret_copy = BumpTransactionEvent_htlcresolution(claim_id_ref, target_feerate_sat_per_1000_weight, htlc_descriptors_constr, tx_lock_time);
72803         int64_t ret_ref = tag_ptr(ret_copy, true);
72804         return ret_ref;
72805 }
72806
72807 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
72808         LDKBumpTransactionEvent* a_conv = (LDKBumpTransactionEvent*)untag_ptr(a);
72809         LDKBumpTransactionEvent* b_conv = (LDKBumpTransactionEvent*)untag_ptr(b);
72810         jboolean ret_conv = BumpTransactionEvent_eq(a_conv, b_conv);
72811         return ret_conv;
72812 }
72813
72814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72815         LDKInput this_obj_conv;
72816         this_obj_conv.inner = untag_ptr(this_obj);
72817         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72819         Input_free(this_obj_conv);
72820 }
72821
72822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
72823         LDKInput this_ptr_conv;
72824         this_ptr_conv.inner = untag_ptr(this_ptr);
72825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72827         this_ptr_conv.is_owned = false;
72828         LDKOutPoint ret_var = Input_get_outpoint(&this_ptr_conv);
72829         int64_t ret_ref = 0;
72830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72832         return ret_ref;
72833 }
72834
72835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72836         LDKInput this_ptr_conv;
72837         this_ptr_conv.inner = untag_ptr(this_ptr);
72838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72840         this_ptr_conv.is_owned = false;
72841         LDKOutPoint val_conv;
72842         val_conv.inner = untag_ptr(val);
72843         val_conv.is_owned = ptr_is_owned(val);
72844         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
72845         val_conv = OutPoint_clone(&val_conv);
72846         Input_set_outpoint(&this_ptr_conv, val_conv);
72847 }
72848
72849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_ptr) {
72850         LDKInput this_ptr_conv;
72851         this_ptr_conv.inner = untag_ptr(this_ptr);
72852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72854         this_ptr_conv.is_owned = false;
72855         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
72856         *ret_ref = Input_get_previous_utxo(&this_ptr_conv);
72857         return tag_ptr(ret_ref, true);
72858 }
72859
72860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72861         LDKInput this_ptr_conv;
72862         this_ptr_conv.inner = untag_ptr(this_ptr);
72863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72865         this_ptr_conv.is_owned = false;
72866         void* val_ptr = untag_ptr(val);
72867         CHECK_ACCESS(val_ptr);
72868         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
72869         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
72870         Input_set_previous_utxo(&this_ptr_conv, val_conv);
72871 }
72872
72873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
72874         LDKInput this_ptr_conv;
72875         this_ptr_conv.inner = untag_ptr(this_ptr);
72876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72878         this_ptr_conv.is_owned = false;
72879         int64_t ret_conv = Input_get_satisfaction_weight(&this_ptr_conv);
72880         return ret_conv;
72881 }
72882
72883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72884         LDKInput this_ptr_conv;
72885         this_ptr_conv.inner = untag_ptr(this_ptr);
72886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72888         this_ptr_conv.is_owned = false;
72889         Input_set_satisfaction_weight(&this_ptr_conv, val);
72890 }
72891
72892 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) {
72893         LDKOutPoint outpoint_arg_conv;
72894         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
72895         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
72896         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
72897         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
72898         void* previous_utxo_arg_ptr = untag_ptr(previous_utxo_arg);
72899         CHECK_ACCESS(previous_utxo_arg_ptr);
72900         LDKTxOut previous_utxo_arg_conv = *(LDKTxOut*)(previous_utxo_arg_ptr);
72901         previous_utxo_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(previous_utxo_arg));
72902         LDKInput ret_var = Input_new(outpoint_arg_conv, previous_utxo_arg_conv, satisfaction_weight_arg);
72903         int64_t ret_ref = 0;
72904         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72905         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72906         return ret_ref;
72907 }
72908
72909 static inline uint64_t Input_clone_ptr(LDKInput *NONNULL_PTR arg) {
72910         LDKInput ret_var = Input_clone(arg);
72911         int64_t ret_ref = 0;
72912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72914         return ret_ref;
72915 }
72916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72917         LDKInput arg_conv;
72918         arg_conv.inner = untag_ptr(arg);
72919         arg_conv.is_owned = ptr_is_owned(arg);
72920         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72921         arg_conv.is_owned = false;
72922         int64_t ret_conv = Input_clone_ptr(&arg_conv);
72923         return ret_conv;
72924 }
72925
72926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72927         LDKInput orig_conv;
72928         orig_conv.inner = untag_ptr(orig);
72929         orig_conv.is_owned = ptr_is_owned(orig);
72930         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72931         orig_conv.is_owned = false;
72932         LDKInput ret_var = Input_clone(&orig_conv);
72933         int64_t ret_ref = 0;
72934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72936         return ret_ref;
72937 }
72938
72939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1hash(JNIEnv *env, jclass clz, int64_t o) {
72940         LDKInput o_conv;
72941         o_conv.inner = untag_ptr(o);
72942         o_conv.is_owned = ptr_is_owned(o);
72943         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
72944         o_conv.is_owned = false;
72945         int64_t ret_conv = Input_hash(&o_conv);
72946         return ret_conv;
72947 }
72948
72949 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Input_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
72950         LDKInput a_conv;
72951         a_conv.inner = untag_ptr(a);
72952         a_conv.is_owned = ptr_is_owned(a);
72953         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72954         a_conv.is_owned = false;
72955         LDKInput b_conv;
72956         b_conv.inner = untag_ptr(b);
72957         b_conv.is_owned = ptr_is_owned(b);
72958         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
72959         b_conv.is_owned = false;
72960         jboolean ret_conv = Input_eq(&a_conv, &b_conv);
72961         return ret_conv;
72962 }
72963
72964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72965         LDKUtxo this_obj_conv;
72966         this_obj_conv.inner = untag_ptr(this_obj);
72967         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72969         Utxo_free(this_obj_conv);
72970 }
72971
72972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
72973         LDKUtxo this_ptr_conv;
72974         this_ptr_conv.inner = untag_ptr(this_ptr);
72975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72977         this_ptr_conv.is_owned = false;
72978         LDKOutPoint ret_var = Utxo_get_outpoint(&this_ptr_conv);
72979         int64_t ret_ref = 0;
72980         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72981         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72982         return ret_ref;
72983 }
72984
72985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72986         LDKUtxo this_ptr_conv;
72987         this_ptr_conv.inner = untag_ptr(this_ptr);
72988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72990         this_ptr_conv.is_owned = false;
72991         LDKOutPoint val_conv;
72992         val_conv.inner = untag_ptr(val);
72993         val_conv.is_owned = ptr_is_owned(val);
72994         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
72995         val_conv = OutPoint_clone(&val_conv);
72996         Utxo_set_outpoint(&this_ptr_conv, val_conv);
72997 }
72998
72999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
73000         LDKUtxo this_ptr_conv;
73001         this_ptr_conv.inner = untag_ptr(this_ptr);
73002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73004         this_ptr_conv.is_owned = false;
73005         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
73006         *ret_ref = Utxo_get_output(&this_ptr_conv);
73007         return tag_ptr(ret_ref, true);
73008 }
73009
73010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73011         LDKUtxo this_ptr_conv;
73012         this_ptr_conv.inner = untag_ptr(this_ptr);
73013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73015         this_ptr_conv.is_owned = false;
73016         void* val_ptr = untag_ptr(val);
73017         CHECK_ACCESS(val_ptr);
73018         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
73019         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
73020         Utxo_set_output(&this_ptr_conv, val_conv);
73021 }
73022
73023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
73024         LDKUtxo this_ptr_conv;
73025         this_ptr_conv.inner = untag_ptr(this_ptr);
73026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73028         this_ptr_conv.is_owned = false;
73029         int64_t ret_conv = Utxo_get_satisfaction_weight(&this_ptr_conv);
73030         return ret_conv;
73031 }
73032
73033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73034         LDKUtxo this_ptr_conv;
73035         this_ptr_conv.inner = untag_ptr(this_ptr);
73036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73038         this_ptr_conv.is_owned = false;
73039         Utxo_set_satisfaction_weight(&this_ptr_conv, val);
73040 }
73041
73042 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) {
73043         LDKOutPoint outpoint_arg_conv;
73044         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
73045         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
73046         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
73047         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
73048         void* output_arg_ptr = untag_ptr(output_arg);
73049         CHECK_ACCESS(output_arg_ptr);
73050         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
73051         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
73052         LDKUtxo ret_var = Utxo_new(outpoint_arg_conv, output_arg_conv, satisfaction_weight_arg);
73053         int64_t ret_ref = 0;
73054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73055         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73056         return ret_ref;
73057 }
73058
73059 static inline uint64_t Utxo_clone_ptr(LDKUtxo *NONNULL_PTR arg) {
73060         LDKUtxo ret_var = Utxo_clone(arg);
73061         int64_t ret_ref = 0;
73062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73064         return ret_ref;
73065 }
73066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73067         LDKUtxo arg_conv;
73068         arg_conv.inner = untag_ptr(arg);
73069         arg_conv.is_owned = ptr_is_owned(arg);
73070         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73071         arg_conv.is_owned = false;
73072         int64_t ret_conv = Utxo_clone_ptr(&arg_conv);
73073         return ret_conv;
73074 }
73075
73076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73077         LDKUtxo orig_conv;
73078         orig_conv.inner = untag_ptr(orig);
73079         orig_conv.is_owned = ptr_is_owned(orig);
73080         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73081         orig_conv.is_owned = false;
73082         LDKUtxo ret_var = Utxo_clone(&orig_conv);
73083         int64_t ret_ref = 0;
73084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73086         return ret_ref;
73087 }
73088
73089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1hash(JNIEnv *env, jclass clz, int64_t o) {
73090         LDKUtxo o_conv;
73091         o_conv.inner = untag_ptr(o);
73092         o_conv.is_owned = ptr_is_owned(o);
73093         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73094         o_conv.is_owned = false;
73095         int64_t ret_conv = Utxo_hash(&o_conv);
73096         return ret_conv;
73097 }
73098
73099 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Utxo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73100         LDKUtxo a_conv;
73101         a_conv.inner = untag_ptr(a);
73102         a_conv.is_owned = ptr_is_owned(a);
73103         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73104         a_conv.is_owned = false;
73105         LDKUtxo b_conv;
73106         b_conv.inner = untag_ptr(b);
73107         b_conv.is_owned = ptr_is_owned(b);
73108         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73109         b_conv.is_owned = false;
73110         jboolean ret_conv = Utxo_eq(&a_conv, &b_conv);
73111         return ret_conv;
73112 }
73113
73114 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) {
73115         LDKOutPoint outpoint_conv;
73116         outpoint_conv.inner = untag_ptr(outpoint);
73117         outpoint_conv.is_owned = ptr_is_owned(outpoint);
73118         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
73119         outpoint_conv = OutPoint_clone(&outpoint_conv);
73120         uint8_t pubkey_hash_arr[20];
73121         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
73122         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
73123         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
73124         LDKUtxo ret_var = Utxo_new_p2pkh(outpoint_conv, value, pubkey_hash_ref);
73125         int64_t ret_ref = 0;
73126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73128         return ret_ref;
73129 }
73130
73131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73132         LDKCoinSelection this_obj_conv;
73133         this_obj_conv.inner = untag_ptr(this_obj);
73134         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73136         CoinSelection_free(this_obj_conv);
73137 }
73138
73139 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CoinSelection_1get_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_ptr) {
73140         LDKCoinSelection this_ptr_conv;
73141         this_ptr_conv.inner = untag_ptr(this_ptr);
73142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73144         this_ptr_conv.is_owned = false;
73145         LDKCVec_UtxoZ ret_var = CoinSelection_get_confirmed_utxos(&this_ptr_conv);
73146         int64_tArray ret_arr = NULL;
73147         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
73148         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
73149         for (size_t g = 0; g < ret_var.datalen; g++) {
73150                 LDKUtxo ret_conv_6_var = ret_var.data[g];
73151                 int64_t ret_conv_6_ref = 0;
73152                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
73153                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
73154                 ret_arr_ptr[g] = ret_conv_6_ref;
73155         }
73156         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
73157         FREE(ret_var.data);
73158         return ret_arr;
73159 }
73160
73161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1set_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
73162         LDKCoinSelection this_ptr_conv;
73163         this_ptr_conv.inner = untag_ptr(this_ptr);
73164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73166         this_ptr_conv.is_owned = false;
73167         LDKCVec_UtxoZ val_constr;
73168         val_constr.datalen = (*env)->GetArrayLength(env, val);
73169         if (val_constr.datalen > 0)
73170                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
73171         else
73172                 val_constr.data = NULL;
73173         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
73174         for (size_t g = 0; g < val_constr.datalen; g++) {
73175                 int64_t val_conv_6 = val_vals[g];
73176                 LDKUtxo val_conv_6_conv;
73177                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
73178                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
73179                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
73180                 val_conv_6_conv = Utxo_clone(&val_conv_6_conv);
73181                 val_constr.data[g] = val_conv_6_conv;
73182         }
73183         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
73184         CoinSelection_set_confirmed_utxos(&this_ptr_conv, val_constr);
73185 }
73186
73187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1get_1change_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
73188         LDKCoinSelection this_ptr_conv;
73189         this_ptr_conv.inner = untag_ptr(this_ptr);
73190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73192         this_ptr_conv.is_owned = false;
73193         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
73194         *ret_copy = CoinSelection_get_change_output(&this_ptr_conv);
73195         int64_t ret_ref = tag_ptr(ret_copy, true);
73196         return ret_ref;
73197 }
73198
73199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1set_1change_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73200         LDKCoinSelection this_ptr_conv;
73201         this_ptr_conv.inner = untag_ptr(this_ptr);
73202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73204         this_ptr_conv.is_owned = false;
73205         void* val_ptr = untag_ptr(val);
73206         CHECK_ACCESS(val_ptr);
73207         LDKCOption_TxOutZ val_conv = *(LDKCOption_TxOutZ*)(val_ptr);
73208         val_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(val));
73209         CoinSelection_set_change_output(&this_ptr_conv, val_conv);
73210 }
73211
73212 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) {
73213         LDKCVec_UtxoZ confirmed_utxos_arg_constr;
73214         confirmed_utxos_arg_constr.datalen = (*env)->GetArrayLength(env, confirmed_utxos_arg);
73215         if (confirmed_utxos_arg_constr.datalen > 0)
73216                 confirmed_utxos_arg_constr.data = MALLOC(confirmed_utxos_arg_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
73217         else
73218                 confirmed_utxos_arg_constr.data = NULL;
73219         int64_t* confirmed_utxos_arg_vals = (*env)->GetLongArrayElements (env, confirmed_utxos_arg, NULL);
73220         for (size_t g = 0; g < confirmed_utxos_arg_constr.datalen; g++) {
73221                 int64_t confirmed_utxos_arg_conv_6 = confirmed_utxos_arg_vals[g];
73222                 LDKUtxo confirmed_utxos_arg_conv_6_conv;
73223                 confirmed_utxos_arg_conv_6_conv.inner = untag_ptr(confirmed_utxos_arg_conv_6);
73224                 confirmed_utxos_arg_conv_6_conv.is_owned = ptr_is_owned(confirmed_utxos_arg_conv_6);
73225                 CHECK_INNER_FIELD_ACCESS_OR_NULL(confirmed_utxos_arg_conv_6_conv);
73226                 confirmed_utxos_arg_conv_6_conv = Utxo_clone(&confirmed_utxos_arg_conv_6_conv);
73227                 confirmed_utxos_arg_constr.data[g] = confirmed_utxos_arg_conv_6_conv;
73228         }
73229         (*env)->ReleaseLongArrayElements(env, confirmed_utxos_arg, confirmed_utxos_arg_vals, 0);
73230         void* change_output_arg_ptr = untag_ptr(change_output_arg);
73231         CHECK_ACCESS(change_output_arg_ptr);
73232         LDKCOption_TxOutZ change_output_arg_conv = *(LDKCOption_TxOutZ*)(change_output_arg_ptr);
73233         change_output_arg_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(change_output_arg));
73234         LDKCoinSelection ret_var = CoinSelection_new(confirmed_utxos_arg_constr, change_output_arg_conv);
73235         int64_t ret_ref = 0;
73236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73238         return ret_ref;
73239 }
73240
73241 static inline uint64_t CoinSelection_clone_ptr(LDKCoinSelection *NONNULL_PTR arg) {
73242         LDKCoinSelection ret_var = CoinSelection_clone(arg);
73243         int64_t ret_ref = 0;
73244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73246         return ret_ref;
73247 }
73248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73249         LDKCoinSelection arg_conv;
73250         arg_conv.inner = untag_ptr(arg);
73251         arg_conv.is_owned = ptr_is_owned(arg);
73252         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73253         arg_conv.is_owned = false;
73254         int64_t ret_conv = CoinSelection_clone_ptr(&arg_conv);
73255         return ret_conv;
73256 }
73257
73258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73259         LDKCoinSelection orig_conv;
73260         orig_conv.inner = untag_ptr(orig);
73261         orig_conv.is_owned = ptr_is_owned(orig);
73262         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73263         orig_conv.is_owned = false;
73264         LDKCoinSelection ret_var = CoinSelection_clone(&orig_conv);
73265         int64_t ret_ref = 0;
73266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73268         return ret_ref;
73269 }
73270
73271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelectionSource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
73272         if (!ptr_is_owned(this_ptr)) return;
73273         void* this_ptr_ptr = untag_ptr(this_ptr);
73274         CHECK_ACCESS(this_ptr_ptr);
73275         LDKCoinSelectionSource this_ptr_conv = *(LDKCoinSelectionSource*)(this_ptr_ptr);
73276         FREE(untag_ptr(this_ptr));
73277         CoinSelectionSource_free(this_ptr_conv);
73278 }
73279
73280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WalletSource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
73281         if (!ptr_is_owned(this_ptr)) return;
73282         void* this_ptr_ptr = untag_ptr(this_ptr);
73283         CHECK_ACCESS(this_ptr_ptr);
73284         LDKWalletSource this_ptr_conv = *(LDKWalletSource*)(this_ptr_ptr);
73285         FREE(untag_ptr(this_ptr));
73286         WalletSource_free(this_ptr_conv);
73287 }
73288
73289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Wallet_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73290         LDKWallet this_obj_conv;
73291         this_obj_conv.inner = untag_ptr(this_obj);
73292         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73294         Wallet_free(this_obj_conv);
73295 }
73296
73297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Wallet_1new(JNIEnv *env, jclass clz, int64_t source, int64_t logger) {
73298         void* source_ptr = untag_ptr(source);
73299         CHECK_ACCESS(source_ptr);
73300         LDKWalletSource source_conv = *(LDKWalletSource*)(source_ptr);
73301         if (source_conv.free == LDKWalletSource_JCalls_free) {
73302                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73303                 LDKWalletSource_JCalls_cloned(&source_conv);
73304         }
73305         void* logger_ptr = untag_ptr(logger);
73306         CHECK_ACCESS(logger_ptr);
73307         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
73308         if (logger_conv.free == LDKLogger_JCalls_free) {
73309                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73310                 LDKLogger_JCalls_cloned(&logger_conv);
73311         }
73312         LDKWallet ret_var = Wallet_new(source_conv, logger_conv);
73313         int64_t ret_ref = 0;
73314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73316         return ret_ref;
73317 }
73318
73319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Wallet_1as_1CoinSelectionSource(JNIEnv *env, jclass clz, int64_t this_arg) {
73320         LDKWallet this_arg_conv;
73321         this_arg_conv.inner = untag_ptr(this_arg);
73322         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73324         this_arg_conv.is_owned = false;
73325         LDKCoinSelectionSource* ret_ret = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
73326         *ret_ret = Wallet_as_CoinSelectionSource(&this_arg_conv);
73327         return tag_ptr(ret_ret, true);
73328 }
73329
73330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEventHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73331         LDKBumpTransactionEventHandler this_obj_conv;
73332         this_obj_conv.inner = untag_ptr(this_obj);
73333         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73335         BumpTransactionEventHandler_free(this_obj_conv);
73336 }
73337
73338 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) {
73339         void* broadcaster_ptr = untag_ptr(broadcaster);
73340         CHECK_ACCESS(broadcaster_ptr);
73341         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
73342         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
73343                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73344                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
73345         }
73346         void* utxo_source_ptr = untag_ptr(utxo_source);
73347         CHECK_ACCESS(utxo_source_ptr);
73348         LDKCoinSelectionSource utxo_source_conv = *(LDKCoinSelectionSource*)(utxo_source_ptr);
73349         if (utxo_source_conv.free == LDKCoinSelectionSource_JCalls_free) {
73350                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73351                 LDKCoinSelectionSource_JCalls_cloned(&utxo_source_conv);
73352         }
73353         void* signer_provider_ptr = untag_ptr(signer_provider);
73354         CHECK_ACCESS(signer_provider_ptr);
73355         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
73356         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
73357                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73358                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
73359         }
73360         void* logger_ptr = untag_ptr(logger);
73361         CHECK_ACCESS(logger_ptr);
73362         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
73363         if (logger_conv.free == LDKLogger_JCalls_free) {
73364                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73365                 LDKLogger_JCalls_cloned(&logger_conv);
73366         }
73367         LDKBumpTransactionEventHandler ret_var = BumpTransactionEventHandler_new(broadcaster_conv, utxo_source_conv, signer_provider_conv, logger_conv);
73368         int64_t ret_ref = 0;
73369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73371         return ret_ref;
73372 }
73373
73374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
73375         LDKBumpTransactionEventHandler this_arg_conv;
73376         this_arg_conv.inner = untag_ptr(this_arg);
73377         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73379         this_arg_conv.is_owned = false;
73380         LDKBumpTransactionEvent* event_conv = (LDKBumpTransactionEvent*)untag_ptr(event);
73381         BumpTransactionEventHandler_handle_event(&this_arg_conv, event_conv);
73382 }
73383
73384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73385         LDKFilesystemStore this_obj_conv;
73386         this_obj_conv.inner = untag_ptr(this_obj);
73387         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73389         FilesystemStore_free(this_obj_conv);
73390 }
73391
73392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1new(JNIEnv *env, jclass clz, jstring data_dir) {
73393         LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
73394         LDKFilesystemStore ret_var = FilesystemStore_new(data_dir_conv);
73395         int64_t ret_ref = 0;
73396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73398         return ret_ref;
73399 }
73400
73401 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
73402         LDKFilesystemStore this_arg_conv;
73403         this_arg_conv.inner = untag_ptr(this_arg);
73404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73406         this_arg_conv.is_owned = false;
73407         LDKStr ret_str = FilesystemStore_get_data_dir(&this_arg_conv);
73408         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
73409         Str_free(ret_str);
73410         return ret_conv;
73411 }
73412
73413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1as_1KVStore(JNIEnv *env, jclass clz, int64_t this_arg) {
73414         LDKFilesystemStore this_arg_conv;
73415         this_arg_conv.inner = untag_ptr(this_arg);
73416         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73418         this_arg_conv.is_owned = false;
73419         LDKKVStore* ret_ret = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
73420         *ret_ret = FilesystemStore_as_KVStore(&this_arg_conv);
73421         return tag_ptr(ret_ret, true);
73422 }
73423
73424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73425         LDKBackgroundProcessor this_obj_conv;
73426         this_obj_conv.inner = untag_ptr(this_obj);
73427         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73429         BackgroundProcessor_free(this_obj_conv);
73430 }
73431
73432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipSync_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
73433         if (!ptr_is_owned(this_ptr)) return;
73434         void* this_ptr_ptr = untag_ptr(this_ptr);
73435         CHECK_ACCESS(this_ptr_ptr);
73436         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
73437         FREE(untag_ptr(this_ptr));
73438         GossipSync_free(this_ptr_conv);
73439 }
73440
73441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1p2_1p(JNIEnv *env, jclass clz, int64_t a) {
73442         LDKP2PGossipSync a_conv;
73443         a_conv.inner = untag_ptr(a);
73444         a_conv.is_owned = ptr_is_owned(a);
73445         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73446         a_conv.is_owned = false;
73447         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
73448         *ret_copy = GossipSync_p2_p(&a_conv);
73449         int64_t ret_ref = tag_ptr(ret_copy, true);
73450         return ret_ref;
73451 }
73452
73453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1rapid(JNIEnv *env, jclass clz, int64_t a) {
73454         LDKRapidGossipSync a_conv;
73455         a_conv.inner = untag_ptr(a);
73456         a_conv.is_owned = ptr_is_owned(a);
73457         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73458         a_conv.is_owned = false;
73459         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
73460         *ret_copy = GossipSync_rapid(&a_conv);
73461         int64_t ret_ref = tag_ptr(ret_copy, true);
73462         return ret_ref;
73463 }
73464
73465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1none(JNIEnv *env, jclass clz) {
73466         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
73467         *ret_copy = GossipSync_none();
73468         int64_t ret_ref = tag_ptr(ret_copy, true);
73469         return ret_ref;
73470 }
73471
73472 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) {
73473         void* persister_ptr = untag_ptr(persister);
73474         CHECK_ACCESS(persister_ptr);
73475         LDKPersister persister_conv = *(LDKPersister*)(persister_ptr);
73476         if (persister_conv.free == LDKPersister_JCalls_free) {
73477                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73478                 LDKPersister_JCalls_cloned(&persister_conv);
73479         }
73480         void* event_handler_ptr = untag_ptr(event_handler);
73481         CHECK_ACCESS(event_handler_ptr);
73482         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
73483         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
73484                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73485                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
73486         }
73487         LDKChainMonitor chain_monitor_conv;
73488         chain_monitor_conv.inner = untag_ptr(chain_monitor);
73489         chain_monitor_conv.is_owned = ptr_is_owned(chain_monitor);
73490         CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
73491         chain_monitor_conv.is_owned = false;
73492         LDKChannelManager channel_manager_conv;
73493         channel_manager_conv.inner = untag_ptr(channel_manager);
73494         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
73495         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
73496         channel_manager_conv.is_owned = false;
73497         void* gossip_sync_ptr = untag_ptr(gossip_sync);
73498         CHECK_ACCESS(gossip_sync_ptr);
73499         LDKGossipSync gossip_sync_conv = *(LDKGossipSync*)(gossip_sync_ptr);
73500         // WARNING: we may need a move here but no clone is available for LDKGossipSync
73501         LDKPeerManager peer_manager_conv;
73502         peer_manager_conv.inner = untag_ptr(peer_manager);
73503         peer_manager_conv.is_owned = ptr_is_owned(peer_manager);
73504         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
73505         peer_manager_conv.is_owned = false;
73506         void* logger_ptr = untag_ptr(logger);
73507         CHECK_ACCESS(logger_ptr);
73508         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
73509         if (logger_conv.free == LDKLogger_JCalls_free) {
73510                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73511                 LDKLogger_JCalls_cloned(&logger_conv);
73512         }
73513         void* scorer_ptr = untag_ptr(scorer);
73514         CHECK_ACCESS(scorer_ptr);
73515         LDKCOption_WriteableScoreZ scorer_conv = *(LDKCOption_WriteableScoreZ*)(scorer_ptr);
73516         // WARNING: we may need a move here but no clone is available for LDKCOption_WriteableScoreZ
73517         if (scorer_conv.tag == LDKCOption_WriteableScoreZ_Some) {
73518                 // Manually implement clone for Java trait instances
73519                 if (scorer_conv.some.free == LDKWriteableScore_JCalls_free) {
73520                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73521                         LDKWriteableScore_JCalls_cloned(&scorer_conv.some);
73522                 }
73523         }
73524         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);
73525         int64_t ret_ref = 0;
73526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73528         return ret_ref;
73529 }
73530
73531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
73532         LDKBackgroundProcessor this_arg_conv;
73533         this_arg_conv.inner = untag_ptr(this_arg);
73534         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73536         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
73537         
73538         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
73539         *ret_conv = BackgroundProcessor_join(this_arg_conv);
73540         return tag_ptr(ret_conv, true);
73541 }
73542
73543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
73544         LDKBackgroundProcessor this_arg_conv;
73545         this_arg_conv.inner = untag_ptr(this_arg);
73546         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73548         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
73549         
73550         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
73551         *ret_conv = BackgroundProcessor_stop(this_arg_conv);
73552         return tag_ptr(ret_conv, true);
73553 }
73554
73555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
73556         if (!ptr_is_owned(this_ptr)) return;
73557         void* this_ptr_ptr = untag_ptr(this_ptr);
73558         CHECK_ACCESS(this_ptr_ptr);
73559         LDKBolt11ParseError this_ptr_conv = *(LDKBolt11ParseError*)(this_ptr_ptr);
73560         FREE(untag_ptr(this_ptr));
73561         Bolt11ParseError_free(this_ptr_conv);
73562 }
73563
73564 static inline uint64_t Bolt11ParseError_clone_ptr(LDKBolt11ParseError *NONNULL_PTR arg) {
73565         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73566         *ret_copy = Bolt11ParseError_clone(arg);
73567         int64_t ret_ref = tag_ptr(ret_copy, true);
73568         return ret_ref;
73569 }
73570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73571         LDKBolt11ParseError* arg_conv = (LDKBolt11ParseError*)untag_ptr(arg);
73572         int64_t ret_conv = Bolt11ParseError_clone_ptr(arg_conv);
73573         return ret_conv;
73574 }
73575
73576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73577         LDKBolt11ParseError* orig_conv = (LDKBolt11ParseError*)untag_ptr(orig);
73578         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73579         *ret_copy = Bolt11ParseError_clone(orig_conv);
73580         int64_t ret_ref = tag_ptr(ret_copy, true);
73581         return ret_ref;
73582 }
73583
73584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1bech32_1error(JNIEnv *env, jclass clz, int64_t a) {
73585         void* a_ptr = untag_ptr(a);
73586         CHECK_ACCESS(a_ptr);
73587         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
73588         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
73589         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73590         *ret_copy = Bolt11ParseError_bech32_error(a_conv);
73591         int64_t ret_ref = tag_ptr(ret_copy, true);
73592         return ret_ref;
73593 }
73594
73595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1parse_1amount_1error(JNIEnv *env, jclass clz, int32_t a) {
73596         
73597         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73598         *ret_copy = Bolt11ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
73599         int64_t ret_ref = tag_ptr(ret_copy, true);
73600         return ret_ref;
73601 }
73602
73603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1malformed_1signature(JNIEnv *env, jclass clz, jclass a) {
73604         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
73605         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73606         *ret_copy = Bolt11ParseError_malformed_signature(a_conv);
73607         int64_t ret_ref = tag_ptr(ret_copy, true);
73608         return ret_ref;
73609 }
73610
73611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1bad_1prefix(JNIEnv *env, jclass clz) {
73612         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73613         *ret_copy = Bolt11ParseError_bad_prefix();
73614         int64_t ret_ref = tag_ptr(ret_copy, true);
73615         return ret_ref;
73616 }
73617
73618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unknown_1currency(JNIEnv *env, jclass clz) {
73619         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73620         *ret_copy = Bolt11ParseError_unknown_currency();
73621         int64_t ret_ref = tag_ptr(ret_copy, true);
73622         return ret_ref;
73623 }
73624
73625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unknown_1si_1prefix(JNIEnv *env, jclass clz) {
73626         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73627         *ret_copy = Bolt11ParseError_unknown_si_prefix();
73628         int64_t ret_ref = tag_ptr(ret_copy, true);
73629         return ret_ref;
73630 }
73631
73632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1malformed_1hrp(JNIEnv *env, jclass clz) {
73633         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73634         *ret_copy = Bolt11ParseError_malformed_hrp();
73635         int64_t ret_ref = tag_ptr(ret_copy, true);
73636         return ret_ref;
73637 }
73638
73639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1too_1short_1data_1part(JNIEnv *env, jclass clz) {
73640         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73641         *ret_copy = Bolt11ParseError_too_short_data_part();
73642         int64_t ret_ref = tag_ptr(ret_copy, true);
73643         return ret_ref;
73644 }
73645
73646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unexpected_1end_1of_1tagged_1fields(JNIEnv *env, jclass clz) {
73647         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73648         *ret_copy = Bolt11ParseError_unexpected_end_of_tagged_fields();
73649         int64_t ret_ref = tag_ptr(ret_copy, true);
73650         return ret_ref;
73651 }
73652
73653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1description_1decode_1error(JNIEnv *env, jclass clz, int32_t a) {
73654         
73655         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73656         *ret_copy = Bolt11ParseError_description_decode_error((LDKError){ ._dummy = 0 });
73657         int64_t ret_ref = tag_ptr(ret_copy, true);
73658         return ret_ref;
73659 }
73660
73661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1padding_1error(JNIEnv *env, jclass clz) {
73662         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73663         *ret_copy = Bolt11ParseError_padding_error();
73664         int64_t ret_ref = tag_ptr(ret_copy, true);
73665         return ret_ref;
73666 }
73667
73668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1integer_1overflow_1error(JNIEnv *env, jclass clz) {
73669         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73670         *ret_copy = Bolt11ParseError_integer_overflow_error();
73671         int64_t ret_ref = tag_ptr(ret_copy, true);
73672         return ret_ref;
73673 }
73674
73675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1seg_1wit_1program_1length(JNIEnv *env, jclass clz) {
73676         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73677         *ret_copy = Bolt11ParseError_invalid_seg_wit_program_length();
73678         int64_t ret_ref = tag_ptr(ret_copy, true);
73679         return ret_ref;
73680 }
73681
73682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1pub_1key_1hash_1length(JNIEnv *env, jclass clz) {
73683         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73684         *ret_copy = Bolt11ParseError_invalid_pub_key_hash_length();
73685         int64_t ret_ref = tag_ptr(ret_copy, true);
73686         return ret_ref;
73687 }
73688
73689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1script_1hash_1length(JNIEnv *env, jclass clz) {
73690         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73691         *ret_copy = Bolt11ParseError_invalid_script_hash_length();
73692         int64_t ret_ref = tag_ptr(ret_copy, true);
73693         return ret_ref;
73694 }
73695
73696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
73697         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73698         *ret_copy = Bolt11ParseError_invalid_recovery_id();
73699         int64_t ret_ref = tag_ptr(ret_copy, true);
73700         return ret_ref;
73701 }
73702
73703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1slice_1length(JNIEnv *env, jclass clz, jstring a) {
73704         LDKStr a_conv = java_to_owned_str(env, a);
73705         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73706         *ret_copy = Bolt11ParseError_invalid_slice_length(a_conv);
73707         int64_t ret_ref = tag_ptr(ret_copy, true);
73708         return ret_ref;
73709 }
73710
73711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1skip(JNIEnv *env, jclass clz) {
73712         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73713         *ret_copy = Bolt11ParseError_skip();
73714         int64_t ret_ref = tag_ptr(ret_copy, true);
73715         return ret_ref;
73716 }
73717
73718 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73719         LDKBolt11ParseError* a_conv = (LDKBolt11ParseError*)untag_ptr(a);
73720         LDKBolt11ParseError* b_conv = (LDKBolt11ParseError*)untag_ptr(b);
73721         jboolean ret_conv = Bolt11ParseError_eq(a_conv, b_conv);
73722         return ret_conv;
73723 }
73724
73725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
73726         if (!ptr_is_owned(this_ptr)) return;
73727         void* this_ptr_ptr = untag_ptr(this_ptr);
73728         CHECK_ACCESS(this_ptr_ptr);
73729         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
73730         FREE(untag_ptr(this_ptr));
73731         ParseOrSemanticError_free(this_ptr_conv);
73732 }
73733
73734 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
73735         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
73736         *ret_copy = ParseOrSemanticError_clone(arg);
73737         int64_t ret_ref = tag_ptr(ret_copy, true);
73738         return ret_ref;
73739 }
73740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73741         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
73742         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
73743         return ret_conv;
73744 }
73745
73746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73747         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
73748         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
73749         *ret_copy = ParseOrSemanticError_clone(orig_conv);
73750         int64_t ret_ref = tag_ptr(ret_copy, true);
73751         return ret_ref;
73752 }
73753
73754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1parse_1error(JNIEnv *env, jclass clz, int64_t a) {
73755         void* a_ptr = untag_ptr(a);
73756         CHECK_ACCESS(a_ptr);
73757         LDKBolt11ParseError a_conv = *(LDKBolt11ParseError*)(a_ptr);
73758         a_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(a));
73759         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
73760         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
73761         int64_t ret_ref = tag_ptr(ret_copy, true);
73762         return ret_ref;
73763 }
73764
73765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1semantic_1error(JNIEnv *env, jclass clz, jclass a) {
73766         LDKBolt11SemanticError a_conv = LDKBolt11SemanticError_from_java(env, a);
73767         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
73768         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
73769         int64_t ret_ref = tag_ptr(ret_copy, true);
73770         return ret_ref;
73771 }
73772
73773 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73774         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
73775         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
73776         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
73777         return ret_conv;
73778 }
73779
73780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73781         LDKBolt11Invoice this_obj_conv;
73782         this_obj_conv.inner = untag_ptr(this_obj);
73783         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73785         Bolt11Invoice_free(this_obj_conv);
73786 }
73787
73788 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73789         LDKBolt11Invoice a_conv;
73790         a_conv.inner = untag_ptr(a);
73791         a_conv.is_owned = ptr_is_owned(a);
73792         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73793         a_conv.is_owned = false;
73794         LDKBolt11Invoice b_conv;
73795         b_conv.inner = untag_ptr(b);
73796         b_conv.is_owned = ptr_is_owned(b);
73797         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73798         b_conv.is_owned = false;
73799         jboolean ret_conv = Bolt11Invoice_eq(&a_conv, &b_conv);
73800         return ret_conv;
73801 }
73802
73803 static inline uint64_t Bolt11Invoice_clone_ptr(LDKBolt11Invoice *NONNULL_PTR arg) {
73804         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(arg);
73805         int64_t ret_ref = 0;
73806         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73807         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73808         return ret_ref;
73809 }
73810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73811         LDKBolt11Invoice arg_conv;
73812         arg_conv.inner = untag_ptr(arg);
73813         arg_conv.is_owned = ptr_is_owned(arg);
73814         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73815         arg_conv.is_owned = false;
73816         int64_t ret_conv = Bolt11Invoice_clone_ptr(&arg_conv);
73817         return ret_conv;
73818 }
73819
73820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73821         LDKBolt11Invoice orig_conv;
73822         orig_conv.inner = untag_ptr(orig);
73823         orig_conv.is_owned = ptr_is_owned(orig);
73824         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73825         orig_conv.is_owned = false;
73826         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(&orig_conv);
73827         int64_t ret_ref = 0;
73828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73830         return ret_ref;
73831 }
73832
73833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
73834         LDKBolt11Invoice o_conv;
73835         o_conv.inner = untag_ptr(o);
73836         o_conv.is_owned = ptr_is_owned(o);
73837         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73838         o_conv.is_owned = false;
73839         int64_t ret_conv = Bolt11Invoice_hash(&o_conv);
73840         return ret_conv;
73841 }
73842
73843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73844         LDKSignedRawBolt11Invoice this_obj_conv;
73845         this_obj_conv.inner = untag_ptr(this_obj);
73846         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73848         SignedRawBolt11Invoice_free(this_obj_conv);
73849 }
73850
73851 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73852         LDKSignedRawBolt11Invoice a_conv;
73853         a_conv.inner = untag_ptr(a);
73854         a_conv.is_owned = ptr_is_owned(a);
73855         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73856         a_conv.is_owned = false;
73857         LDKSignedRawBolt11Invoice b_conv;
73858         b_conv.inner = untag_ptr(b);
73859         b_conv.is_owned = ptr_is_owned(b);
73860         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73861         b_conv.is_owned = false;
73862         jboolean ret_conv = SignedRawBolt11Invoice_eq(&a_conv, &b_conv);
73863         return ret_conv;
73864 }
73865
73866 static inline uint64_t SignedRawBolt11Invoice_clone_ptr(LDKSignedRawBolt11Invoice *NONNULL_PTR arg) {
73867         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(arg);
73868         int64_t ret_ref = 0;
73869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73871         return ret_ref;
73872 }
73873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73874         LDKSignedRawBolt11Invoice arg_conv;
73875         arg_conv.inner = untag_ptr(arg);
73876         arg_conv.is_owned = ptr_is_owned(arg);
73877         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73878         arg_conv.is_owned = false;
73879         int64_t ret_conv = SignedRawBolt11Invoice_clone_ptr(&arg_conv);
73880         return ret_conv;
73881 }
73882
73883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73884         LDKSignedRawBolt11Invoice orig_conv;
73885         orig_conv.inner = untag_ptr(orig);
73886         orig_conv.is_owned = ptr_is_owned(orig);
73887         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73888         orig_conv.is_owned = false;
73889         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(&orig_conv);
73890         int64_t ret_ref = 0;
73891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73893         return ret_ref;
73894 }
73895
73896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
73897         LDKSignedRawBolt11Invoice o_conv;
73898         o_conv.inner = untag_ptr(o);
73899         o_conv.is_owned = ptr_is_owned(o);
73900         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73901         o_conv.is_owned = false;
73902         int64_t ret_conv = SignedRawBolt11Invoice_hash(&o_conv);
73903         return ret_conv;
73904 }
73905
73906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73907         LDKRawBolt11Invoice this_obj_conv;
73908         this_obj_conv.inner = untag_ptr(this_obj);
73909         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73911         RawBolt11Invoice_free(this_obj_conv);
73912 }
73913
73914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
73915         LDKRawBolt11Invoice this_ptr_conv;
73916         this_ptr_conv.inner = untag_ptr(this_ptr);
73917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73919         this_ptr_conv.is_owned = false;
73920         LDKRawDataPart ret_var = RawBolt11Invoice_get_data(&this_ptr_conv);
73921         int64_t ret_ref = 0;
73922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73924         return ret_ref;
73925 }
73926
73927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73928         LDKRawBolt11Invoice this_ptr_conv;
73929         this_ptr_conv.inner = untag_ptr(this_ptr);
73930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73932         this_ptr_conv.is_owned = false;
73933         LDKRawDataPart val_conv;
73934         val_conv.inner = untag_ptr(val);
73935         val_conv.is_owned = ptr_is_owned(val);
73936         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73937         val_conv = RawDataPart_clone(&val_conv);
73938         RawBolt11Invoice_set_data(&this_ptr_conv, val_conv);
73939 }
73940
73941 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73942         LDKRawBolt11Invoice a_conv;
73943         a_conv.inner = untag_ptr(a);
73944         a_conv.is_owned = ptr_is_owned(a);
73945         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73946         a_conv.is_owned = false;
73947         LDKRawBolt11Invoice b_conv;
73948         b_conv.inner = untag_ptr(b);
73949         b_conv.is_owned = ptr_is_owned(b);
73950         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73951         b_conv.is_owned = false;
73952         jboolean ret_conv = RawBolt11Invoice_eq(&a_conv, &b_conv);
73953         return ret_conv;
73954 }
73955
73956 static inline uint64_t RawBolt11Invoice_clone_ptr(LDKRawBolt11Invoice *NONNULL_PTR arg) {
73957         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(arg);
73958         int64_t ret_ref = 0;
73959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73961         return ret_ref;
73962 }
73963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73964         LDKRawBolt11Invoice arg_conv;
73965         arg_conv.inner = untag_ptr(arg);
73966         arg_conv.is_owned = ptr_is_owned(arg);
73967         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73968         arg_conv.is_owned = false;
73969         int64_t ret_conv = RawBolt11Invoice_clone_ptr(&arg_conv);
73970         return ret_conv;
73971 }
73972
73973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73974         LDKRawBolt11Invoice orig_conv;
73975         orig_conv.inner = untag_ptr(orig);
73976         orig_conv.is_owned = ptr_is_owned(orig);
73977         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73978         orig_conv.is_owned = false;
73979         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(&orig_conv);
73980         int64_t ret_ref = 0;
73981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73983         return ret_ref;
73984 }
73985
73986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
73987         LDKRawBolt11Invoice o_conv;
73988         o_conv.inner = untag_ptr(o);
73989         o_conv.is_owned = ptr_is_owned(o);
73990         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73991         o_conv.is_owned = false;
73992         int64_t ret_conv = RawBolt11Invoice_hash(&o_conv);
73993         return ret_conv;
73994 }
73995
73996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73997         LDKRawDataPart this_obj_conv;
73998         this_obj_conv.inner = untag_ptr(this_obj);
73999         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74001         RawDataPart_free(this_obj_conv);
74002 }
74003
74004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
74005         LDKRawDataPart this_ptr_conv;
74006         this_ptr_conv.inner = untag_ptr(this_ptr);
74007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74009         this_ptr_conv.is_owned = false;
74010         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
74011         int64_t ret_ref = 0;
74012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74014         return ret_ref;
74015 }
74016
74017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74018         LDKRawDataPart this_ptr_conv;
74019         this_ptr_conv.inner = untag_ptr(this_ptr);
74020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74022         this_ptr_conv.is_owned = false;
74023         LDKPositiveTimestamp val_conv;
74024         val_conv.inner = untag_ptr(val);
74025         val_conv.is_owned = ptr_is_owned(val);
74026         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74027         val_conv = PositiveTimestamp_clone(&val_conv);
74028         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
74029 }
74030
74031 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74032         LDKRawDataPart a_conv;
74033         a_conv.inner = untag_ptr(a);
74034         a_conv.is_owned = ptr_is_owned(a);
74035         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74036         a_conv.is_owned = false;
74037         LDKRawDataPart b_conv;
74038         b_conv.inner = untag_ptr(b);
74039         b_conv.is_owned = ptr_is_owned(b);
74040         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74041         b_conv.is_owned = false;
74042         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
74043         return ret_conv;
74044 }
74045
74046 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
74047         LDKRawDataPart ret_var = RawDataPart_clone(arg);
74048         int64_t ret_ref = 0;
74049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74051         return ret_ref;
74052 }
74053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74054         LDKRawDataPart arg_conv;
74055         arg_conv.inner = untag_ptr(arg);
74056         arg_conv.is_owned = ptr_is_owned(arg);
74057         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74058         arg_conv.is_owned = false;
74059         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
74060         return ret_conv;
74061 }
74062
74063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74064         LDKRawDataPart orig_conv;
74065         orig_conv.inner = untag_ptr(orig);
74066         orig_conv.is_owned = ptr_is_owned(orig);
74067         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74068         orig_conv.is_owned = false;
74069         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
74070         int64_t ret_ref = 0;
74071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74073         return ret_ref;
74074 }
74075
74076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1hash(JNIEnv *env, jclass clz, int64_t o) {
74077         LDKRawDataPart o_conv;
74078         o_conv.inner = untag_ptr(o);
74079         o_conv.is_owned = ptr_is_owned(o);
74080         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74081         o_conv.is_owned = false;
74082         int64_t ret_conv = RawDataPart_hash(&o_conv);
74083         return ret_conv;
74084 }
74085
74086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74087         LDKPositiveTimestamp this_obj_conv;
74088         this_obj_conv.inner = untag_ptr(this_obj);
74089         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74091         PositiveTimestamp_free(this_obj_conv);
74092 }
74093
74094 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74095         LDKPositiveTimestamp a_conv;
74096         a_conv.inner = untag_ptr(a);
74097         a_conv.is_owned = ptr_is_owned(a);
74098         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74099         a_conv.is_owned = false;
74100         LDKPositiveTimestamp b_conv;
74101         b_conv.inner = untag_ptr(b);
74102         b_conv.is_owned = ptr_is_owned(b);
74103         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74104         b_conv.is_owned = false;
74105         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
74106         return ret_conv;
74107 }
74108
74109 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
74110         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
74111         int64_t ret_ref = 0;
74112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74114         return ret_ref;
74115 }
74116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74117         LDKPositiveTimestamp arg_conv;
74118         arg_conv.inner = untag_ptr(arg);
74119         arg_conv.is_owned = ptr_is_owned(arg);
74120         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74121         arg_conv.is_owned = false;
74122         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
74123         return ret_conv;
74124 }
74125
74126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74127         LDKPositiveTimestamp orig_conv;
74128         orig_conv.inner = untag_ptr(orig);
74129         orig_conv.is_owned = ptr_is_owned(orig);
74130         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74131         orig_conv.is_owned = false;
74132         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
74133         int64_t ret_ref = 0;
74134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74136         return ret_ref;
74137 }
74138
74139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1hash(JNIEnv *env, jclass clz, int64_t o) {
74140         LDKPositiveTimestamp o_conv;
74141         o_conv.inner = untag_ptr(o);
74142         o_conv.is_owned = ptr_is_owned(o);
74143         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74144         o_conv.is_owned = false;
74145         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
74146         return ret_conv;
74147 }
74148
74149 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74150         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
74151         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
74152         return ret_conv;
74153 }
74154
74155 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
74156         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
74157         return ret_conv;
74158 }
74159
74160 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
74161         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
74162         return ret_conv;
74163 }
74164
74165 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
74166         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
74167         return ret_conv;
74168 }
74169
74170 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
74171         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
74172         return ret_conv;
74173 }
74174
74175 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74176         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
74177         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
74178         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
74179         return ret_conv;
74180 }
74181
74182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1hash(JNIEnv *env, jclass clz, int64_t o) {
74183         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
74184         int64_t ret_conv = SiPrefix_hash(o_conv);
74185         return ret_conv;
74186 }
74187
74188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
74189         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
74190         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
74191         return ret_conv;
74192 }
74193
74194 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74195         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
74196         jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
74197         return ret_conv;
74198 }
74199
74200 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
74201         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
74202         return ret_conv;
74203 }
74204
74205 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
74206         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
74207         return ret_conv;
74208 }
74209
74210 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
74211         jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
74212         return ret_conv;
74213 }
74214
74215 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
74216         jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
74217         return ret_conv;
74218 }
74219
74220 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
74221         jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
74222         return ret_conv;
74223 }
74224
74225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
74226         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
74227         int64_t ret_conv = Currency_hash(o_conv);
74228         return ret_conv;
74229 }
74230
74231 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74232         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
74233         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
74234         jboolean ret_conv = Currency_eq(a_conv, b_conv);
74235         return ret_conv;
74236 }
74237
74238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74239         LDKSha256 this_obj_conv;
74240         this_obj_conv.inner = untag_ptr(this_obj);
74241         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74243         Sha256_free(this_obj_conv);
74244 }
74245
74246 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
74247         LDKSha256 ret_var = Sha256_clone(arg);
74248         int64_t ret_ref = 0;
74249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74250         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74251         return ret_ref;
74252 }
74253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74254         LDKSha256 arg_conv;
74255         arg_conv.inner = untag_ptr(arg);
74256         arg_conv.is_owned = ptr_is_owned(arg);
74257         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74258         arg_conv.is_owned = false;
74259         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
74260         return ret_conv;
74261 }
74262
74263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74264         LDKSha256 orig_conv;
74265         orig_conv.inner = untag_ptr(orig);
74266         orig_conv.is_owned = ptr_is_owned(orig);
74267         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74268         orig_conv.is_owned = false;
74269         LDKSha256 ret_var = Sha256_clone(&orig_conv);
74270         int64_t ret_ref = 0;
74271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74273         return ret_ref;
74274 }
74275
74276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
74277         LDKSha256 o_conv;
74278         o_conv.inner = untag_ptr(o);
74279         o_conv.is_owned = ptr_is_owned(o);
74280         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74281         o_conv.is_owned = false;
74282         int64_t ret_conv = Sha256_hash(&o_conv);
74283         return ret_conv;
74284 }
74285
74286 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74287         LDKSha256 a_conv;
74288         a_conv.inner = untag_ptr(a);
74289         a_conv.is_owned = ptr_is_owned(a);
74290         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74291         a_conv.is_owned = false;
74292         LDKSha256 b_conv;
74293         b_conv.inner = untag_ptr(b);
74294         b_conv.is_owned = ptr_is_owned(b);
74295         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74296         b_conv.is_owned = false;
74297         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
74298         return ret_conv;
74299 }
74300
74301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1from_1bytes(JNIEnv *env, jclass clz, int8_tArray bytes) {
74302         uint8_t bytes_arr[32];
74303         CHECK((*env)->GetArrayLength(env, bytes) == 32);
74304         (*env)->GetByteArrayRegion(env, bytes, 0, 32, bytes_arr);
74305         uint8_t (*bytes_ref)[32] = &bytes_arr;
74306         LDKSha256 ret_var = Sha256_from_bytes(bytes_ref);
74307         int64_t ret_ref = 0;
74308         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74309         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74310         return ret_ref;
74311 }
74312
74313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74314         LDKDescription this_obj_conv;
74315         this_obj_conv.inner = untag_ptr(this_obj);
74316         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74318         Description_free(this_obj_conv);
74319 }
74320
74321 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
74322         LDKDescription ret_var = Description_clone(arg);
74323         int64_t ret_ref = 0;
74324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74326         return ret_ref;
74327 }
74328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74329         LDKDescription arg_conv;
74330         arg_conv.inner = untag_ptr(arg);
74331         arg_conv.is_owned = ptr_is_owned(arg);
74332         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74333         arg_conv.is_owned = false;
74334         int64_t ret_conv = Description_clone_ptr(&arg_conv);
74335         return ret_conv;
74336 }
74337
74338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74339         LDKDescription orig_conv;
74340         orig_conv.inner = untag_ptr(orig);
74341         orig_conv.is_owned = ptr_is_owned(orig);
74342         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74343         orig_conv.is_owned = false;
74344         LDKDescription ret_var = Description_clone(&orig_conv);
74345         int64_t ret_ref = 0;
74346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74348         return ret_ref;
74349 }
74350
74351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
74352         LDKDescription o_conv;
74353         o_conv.inner = untag_ptr(o);
74354         o_conv.is_owned = ptr_is_owned(o);
74355         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74356         o_conv.is_owned = false;
74357         int64_t ret_conv = Description_hash(&o_conv);
74358         return ret_conv;
74359 }
74360
74361 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74362         LDKDescription a_conv;
74363         a_conv.inner = untag_ptr(a);
74364         a_conv.is_owned = ptr_is_owned(a);
74365         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74366         a_conv.is_owned = false;
74367         LDKDescription b_conv;
74368         b_conv.inner = untag_ptr(b);
74369         b_conv.is_owned = ptr_is_owned(b);
74370         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74371         b_conv.is_owned = false;
74372         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
74373         return ret_conv;
74374 }
74375
74376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74377         LDKPayeePubKey this_obj_conv;
74378         this_obj_conv.inner = untag_ptr(this_obj);
74379         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74381         PayeePubKey_free(this_obj_conv);
74382 }
74383
74384 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
74385         LDKPayeePubKey this_ptr_conv;
74386         this_ptr_conv.inner = untag_ptr(this_ptr);
74387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74389         this_ptr_conv.is_owned = false;
74390         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
74391         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PayeePubKey_get_a(&this_ptr_conv).compressed_form);
74392         return ret_arr;
74393 }
74394
74395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
74396         LDKPayeePubKey this_ptr_conv;
74397         this_ptr_conv.inner = untag_ptr(this_ptr);
74398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74400         this_ptr_conv.is_owned = false;
74401         LDKPublicKey val_ref;
74402         CHECK((*env)->GetArrayLength(env, val) == 33);
74403         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
74404         PayeePubKey_set_a(&this_ptr_conv, val_ref);
74405 }
74406
74407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
74408         LDKPublicKey a_arg_ref;
74409         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
74410         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
74411         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
74412         int64_t ret_ref = 0;
74413         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74414         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74415         return ret_ref;
74416 }
74417
74418 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
74419         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
74420         int64_t ret_ref = 0;
74421         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74422         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74423         return ret_ref;
74424 }
74425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74426         LDKPayeePubKey arg_conv;
74427         arg_conv.inner = untag_ptr(arg);
74428         arg_conv.is_owned = ptr_is_owned(arg);
74429         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74430         arg_conv.is_owned = false;
74431         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
74432         return ret_conv;
74433 }
74434
74435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74436         LDKPayeePubKey orig_conv;
74437         orig_conv.inner = untag_ptr(orig);
74438         orig_conv.is_owned = ptr_is_owned(orig);
74439         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74440         orig_conv.is_owned = false;
74441         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
74442         int64_t ret_ref = 0;
74443         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74444         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74445         return ret_ref;
74446 }
74447
74448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
74449         LDKPayeePubKey o_conv;
74450         o_conv.inner = untag_ptr(o);
74451         o_conv.is_owned = ptr_is_owned(o);
74452         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74453         o_conv.is_owned = false;
74454         int64_t ret_conv = PayeePubKey_hash(&o_conv);
74455         return ret_conv;
74456 }
74457
74458 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74459         LDKPayeePubKey a_conv;
74460         a_conv.inner = untag_ptr(a);
74461         a_conv.is_owned = ptr_is_owned(a);
74462         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74463         a_conv.is_owned = false;
74464         LDKPayeePubKey b_conv;
74465         b_conv.inner = untag_ptr(b);
74466         b_conv.is_owned = ptr_is_owned(b);
74467         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74468         b_conv.is_owned = false;
74469         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
74470         return ret_conv;
74471 }
74472
74473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74474         LDKExpiryTime this_obj_conv;
74475         this_obj_conv.inner = untag_ptr(this_obj);
74476         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74478         ExpiryTime_free(this_obj_conv);
74479 }
74480
74481 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
74482         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
74483         int64_t ret_ref = 0;
74484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74486         return ret_ref;
74487 }
74488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74489         LDKExpiryTime arg_conv;
74490         arg_conv.inner = untag_ptr(arg);
74491         arg_conv.is_owned = ptr_is_owned(arg);
74492         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74493         arg_conv.is_owned = false;
74494         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
74495         return ret_conv;
74496 }
74497
74498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74499         LDKExpiryTime orig_conv;
74500         orig_conv.inner = untag_ptr(orig);
74501         orig_conv.is_owned = ptr_is_owned(orig);
74502         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74503         orig_conv.is_owned = false;
74504         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
74505         int64_t ret_ref = 0;
74506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74508         return ret_ref;
74509 }
74510
74511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
74512         LDKExpiryTime o_conv;
74513         o_conv.inner = untag_ptr(o);
74514         o_conv.is_owned = ptr_is_owned(o);
74515         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74516         o_conv.is_owned = false;
74517         int64_t ret_conv = ExpiryTime_hash(&o_conv);
74518         return ret_conv;
74519 }
74520
74521 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74522         LDKExpiryTime a_conv;
74523         a_conv.inner = untag_ptr(a);
74524         a_conv.is_owned = ptr_is_owned(a);
74525         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74526         a_conv.is_owned = false;
74527         LDKExpiryTime b_conv;
74528         b_conv.inner = untag_ptr(b);
74529         b_conv.is_owned = ptr_is_owned(b);
74530         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74531         b_conv.is_owned = false;
74532         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
74533         return ret_conv;
74534 }
74535
74536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74537         LDKMinFinalCltvExpiryDelta this_obj_conv;
74538         this_obj_conv.inner = untag_ptr(this_obj);
74539         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74541         MinFinalCltvExpiryDelta_free(this_obj_conv);
74542 }
74543
74544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
74545         LDKMinFinalCltvExpiryDelta this_ptr_conv;
74546         this_ptr_conv.inner = untag_ptr(this_ptr);
74547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74549         this_ptr_conv.is_owned = false;
74550         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
74551         return ret_conv;
74552 }
74553
74554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74555         LDKMinFinalCltvExpiryDelta this_ptr_conv;
74556         this_ptr_conv.inner = untag_ptr(this_ptr);
74557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74559         this_ptr_conv.is_owned = false;
74560         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
74561 }
74562
74563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
74564         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
74565         int64_t ret_ref = 0;
74566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74568         return ret_ref;
74569 }
74570
74571 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
74572         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
74573         int64_t ret_ref = 0;
74574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74576         return ret_ref;
74577 }
74578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74579         LDKMinFinalCltvExpiryDelta arg_conv;
74580         arg_conv.inner = untag_ptr(arg);
74581         arg_conv.is_owned = ptr_is_owned(arg);
74582         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74583         arg_conv.is_owned = false;
74584         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
74585         return ret_conv;
74586 }
74587
74588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74589         LDKMinFinalCltvExpiryDelta orig_conv;
74590         orig_conv.inner = untag_ptr(orig);
74591         orig_conv.is_owned = ptr_is_owned(orig);
74592         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74593         orig_conv.is_owned = false;
74594         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
74595         int64_t ret_ref = 0;
74596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74598         return ret_ref;
74599 }
74600
74601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1hash(JNIEnv *env, jclass clz, int64_t o) {
74602         LDKMinFinalCltvExpiryDelta o_conv;
74603         o_conv.inner = untag_ptr(o);
74604         o_conv.is_owned = ptr_is_owned(o);
74605         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74606         o_conv.is_owned = false;
74607         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
74608         return ret_conv;
74609 }
74610
74611 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74612         LDKMinFinalCltvExpiryDelta a_conv;
74613         a_conv.inner = untag_ptr(a);
74614         a_conv.is_owned = ptr_is_owned(a);
74615         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74616         a_conv.is_owned = false;
74617         LDKMinFinalCltvExpiryDelta b_conv;
74618         b_conv.inner = untag_ptr(b);
74619         b_conv.is_owned = ptr_is_owned(b);
74620         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74621         b_conv.is_owned = false;
74622         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
74623         return ret_conv;
74624 }
74625
74626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
74627         if (!ptr_is_owned(this_ptr)) return;
74628         void* this_ptr_ptr = untag_ptr(this_ptr);
74629         CHECK_ACCESS(this_ptr_ptr);
74630         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
74631         FREE(untag_ptr(this_ptr));
74632         Fallback_free(this_ptr_conv);
74633 }
74634
74635 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
74636         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
74637         *ret_copy = Fallback_clone(arg);
74638         int64_t ret_ref = tag_ptr(ret_copy, true);
74639         return ret_ref;
74640 }
74641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74642         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
74643         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
74644         return ret_conv;
74645 }
74646
74647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74648         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
74649         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
74650         *ret_copy = Fallback_clone(orig_conv);
74651         int64_t ret_ref = tag_ptr(ret_copy, true);
74652         return ret_ref;
74653 }
74654
74655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
74656         
74657         LDKCVec_u8Z program_ref;
74658         program_ref.datalen = (*env)->GetArrayLength(env, program);
74659         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
74660         (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
74661         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
74662         *ret_copy = Fallback_seg_wit_program((LDKWitnessVersion){ ._0 = version }, program_ref);
74663         int64_t ret_ref = tag_ptr(ret_copy, true);
74664         return ret_ref;
74665 }
74666
74667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
74668         LDKTwentyBytes a_ref;
74669         CHECK((*env)->GetArrayLength(env, a) == 20);
74670         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
74671         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
74672         *ret_copy = Fallback_pub_key_hash(a_ref);
74673         int64_t ret_ref = tag_ptr(ret_copy, true);
74674         return ret_ref;
74675 }
74676
74677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
74678         LDKTwentyBytes a_ref;
74679         CHECK((*env)->GetArrayLength(env, a) == 20);
74680         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
74681         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
74682         *ret_copy = Fallback_script_hash(a_ref);
74683         int64_t ret_ref = tag_ptr(ret_copy, true);
74684         return ret_ref;
74685 }
74686
74687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
74688         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
74689         int64_t ret_conv = Fallback_hash(o_conv);
74690         return ret_conv;
74691 }
74692
74693 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74694         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
74695         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
74696         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
74697         return ret_conv;
74698 }
74699
74700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74701         LDKBolt11InvoiceSignature this_obj_conv;
74702         this_obj_conv.inner = untag_ptr(this_obj);
74703         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74705         Bolt11InvoiceSignature_free(this_obj_conv);
74706 }
74707
74708 static inline uint64_t Bolt11InvoiceSignature_clone_ptr(LDKBolt11InvoiceSignature *NONNULL_PTR arg) {
74709         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(arg);
74710         int64_t ret_ref = 0;
74711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74713         return ret_ref;
74714 }
74715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74716         LDKBolt11InvoiceSignature arg_conv;
74717         arg_conv.inner = untag_ptr(arg);
74718         arg_conv.is_owned = ptr_is_owned(arg);
74719         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74720         arg_conv.is_owned = false;
74721         int64_t ret_conv = Bolt11InvoiceSignature_clone_ptr(&arg_conv);
74722         return ret_conv;
74723 }
74724
74725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74726         LDKBolt11InvoiceSignature orig_conv;
74727         orig_conv.inner = untag_ptr(orig);
74728         orig_conv.is_owned = ptr_is_owned(orig);
74729         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74730         orig_conv.is_owned = false;
74731         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(&orig_conv);
74732         int64_t ret_ref = 0;
74733         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74734         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74735         return ret_ref;
74736 }
74737
74738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1hash(JNIEnv *env, jclass clz, int64_t o) {
74739         LDKBolt11InvoiceSignature o_conv;
74740         o_conv.inner = untag_ptr(o);
74741         o_conv.is_owned = ptr_is_owned(o);
74742         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74743         o_conv.is_owned = false;
74744         int64_t ret_conv = Bolt11InvoiceSignature_hash(&o_conv);
74745         return ret_conv;
74746 }
74747
74748 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74749         LDKBolt11InvoiceSignature a_conv;
74750         a_conv.inner = untag_ptr(a);
74751         a_conv.is_owned = ptr_is_owned(a);
74752         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74753         a_conv.is_owned = false;
74754         LDKBolt11InvoiceSignature b_conv;
74755         b_conv.inner = untag_ptr(b);
74756         b_conv.is_owned = ptr_is_owned(b);
74757         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74758         b_conv.is_owned = false;
74759         jboolean ret_conv = Bolt11InvoiceSignature_eq(&a_conv, &b_conv);
74760         return ret_conv;
74761 }
74762
74763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74764         LDKPrivateRoute this_obj_conv;
74765         this_obj_conv.inner = untag_ptr(this_obj);
74766         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74768         PrivateRoute_free(this_obj_conv);
74769 }
74770
74771 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
74772         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
74773         int64_t ret_ref = 0;
74774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74776         return ret_ref;
74777 }
74778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74779         LDKPrivateRoute arg_conv;
74780         arg_conv.inner = untag_ptr(arg);
74781         arg_conv.is_owned = ptr_is_owned(arg);
74782         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74783         arg_conv.is_owned = false;
74784         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
74785         return ret_conv;
74786 }
74787
74788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74789         LDKPrivateRoute orig_conv;
74790         orig_conv.inner = untag_ptr(orig);
74791         orig_conv.is_owned = ptr_is_owned(orig);
74792         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74793         orig_conv.is_owned = false;
74794         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
74795         int64_t ret_ref = 0;
74796         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74797         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74798         return ret_ref;
74799 }
74800
74801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
74802         LDKPrivateRoute o_conv;
74803         o_conv.inner = untag_ptr(o);
74804         o_conv.is_owned = ptr_is_owned(o);
74805         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74806         o_conv.is_owned = false;
74807         int64_t ret_conv = PrivateRoute_hash(&o_conv);
74808         return ret_conv;
74809 }
74810
74811 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74812         LDKPrivateRoute a_conv;
74813         a_conv.inner = untag_ptr(a);
74814         a_conv.is_owned = ptr_is_owned(a);
74815         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74816         a_conv.is_owned = false;
74817         LDKPrivateRoute b_conv;
74818         b_conv.inner = untag_ptr(b);
74819         b_conv.is_owned = ptr_is_owned(b);
74820         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74821         b_conv.is_owned = false;
74822         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
74823         return ret_conv;
74824 }
74825
74826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
74827         LDKSignedRawBolt11Invoice this_arg_conv;
74828         this_arg_conv.inner = untag_ptr(this_arg);
74829         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74831         this_arg_conv = SignedRawBolt11Invoice_clone(&this_arg_conv);
74832         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
74833         *ret_conv = SignedRawBolt11Invoice_into_parts(this_arg_conv);
74834         return tag_ptr(ret_conv, true);
74835 }
74836
74837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
74838         LDKSignedRawBolt11Invoice this_arg_conv;
74839         this_arg_conv.inner = untag_ptr(this_arg);
74840         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74842         this_arg_conv.is_owned = false;
74843         LDKRawBolt11Invoice ret_var = SignedRawBolt11Invoice_raw_invoice(&this_arg_conv);
74844         int64_t ret_ref = 0;
74845         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74846         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74847         return ret_ref;
74848 }
74849
74850 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
74851         LDKSignedRawBolt11Invoice this_arg_conv;
74852         this_arg_conv.inner = untag_ptr(this_arg);
74853         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74855         this_arg_conv.is_owned = false;
74856         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74857         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawBolt11Invoice_signable_hash(&this_arg_conv));
74858         return ret_arr;
74859 }
74860
74861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
74862         LDKSignedRawBolt11Invoice this_arg_conv;
74863         this_arg_conv.inner = untag_ptr(this_arg);
74864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74866         this_arg_conv.is_owned = false;
74867         LDKBolt11InvoiceSignature ret_var = SignedRawBolt11Invoice_signature(&this_arg_conv);
74868         int64_t ret_ref = 0;
74869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74871         return ret_ref;
74872 }
74873
74874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
74875         LDKSignedRawBolt11Invoice this_arg_conv;
74876         this_arg_conv.inner = untag_ptr(this_arg);
74877         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74879         this_arg_conv.is_owned = false;
74880         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
74881         *ret_conv = SignedRawBolt11Invoice_recover_payee_pub_key(&this_arg_conv);
74882         return tag_ptr(ret_conv, true);
74883 }
74884
74885 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
74886         LDKSignedRawBolt11Invoice this_arg_conv;
74887         this_arg_conv.inner = untag_ptr(this_arg);
74888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74890         this_arg_conv.is_owned = false;
74891         jboolean ret_conv = SignedRawBolt11Invoice_check_signature(&this_arg_conv);
74892         return ret_conv;
74893 }
74894
74895 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
74896         LDKRawBolt11Invoice this_arg_conv;
74897         this_arg_conv.inner = untag_ptr(this_arg);
74898         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74900         this_arg_conv.is_owned = false;
74901         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74902         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawBolt11Invoice_signable_hash(&this_arg_conv).data);
74903         return ret_arr;
74904 }
74905
74906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
74907         LDKRawBolt11Invoice this_arg_conv;
74908         this_arg_conv.inner = untag_ptr(this_arg);
74909         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74911         this_arg_conv.is_owned = false;
74912         LDKSha256 ret_var = RawBolt11Invoice_payment_hash(&this_arg_conv);
74913         int64_t ret_ref = 0;
74914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74916         return ret_ref;
74917 }
74918
74919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
74920         LDKRawBolt11Invoice this_arg_conv;
74921         this_arg_conv.inner = untag_ptr(this_arg);
74922         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74924         this_arg_conv.is_owned = false;
74925         LDKDescription ret_var = RawBolt11Invoice_description(&this_arg_conv);
74926         int64_t ret_ref = 0;
74927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74929         return ret_ref;
74930 }
74931
74932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
74933         LDKRawBolt11Invoice this_arg_conv;
74934         this_arg_conv.inner = untag_ptr(this_arg);
74935         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74937         this_arg_conv.is_owned = false;
74938         LDKPayeePubKey ret_var = RawBolt11Invoice_payee_pub_key(&this_arg_conv);
74939         int64_t ret_ref = 0;
74940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74942         return ret_ref;
74943 }
74944
74945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
74946         LDKRawBolt11Invoice this_arg_conv;
74947         this_arg_conv.inner = untag_ptr(this_arg);
74948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74950         this_arg_conv.is_owned = false;
74951         LDKSha256 ret_var = RawBolt11Invoice_description_hash(&this_arg_conv);
74952         int64_t ret_ref = 0;
74953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74955         return ret_ref;
74956 }
74957
74958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
74959         LDKRawBolt11Invoice this_arg_conv;
74960         this_arg_conv.inner = untag_ptr(this_arg);
74961         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74963         this_arg_conv.is_owned = false;
74964         LDKExpiryTime ret_var = RawBolt11Invoice_expiry_time(&this_arg_conv);
74965         int64_t ret_ref = 0;
74966         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74967         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74968         return ret_ref;
74969 }
74970
74971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1min_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
74972         LDKRawBolt11Invoice this_arg_conv;
74973         this_arg_conv.inner = untag_ptr(this_arg);
74974         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74976         this_arg_conv.is_owned = false;
74977         LDKMinFinalCltvExpiryDelta ret_var = RawBolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
74978         int64_t ret_ref = 0;
74979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74981         return ret_ref;
74982 }
74983
74984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
74985         LDKRawBolt11Invoice this_arg_conv;
74986         this_arg_conv.inner = untag_ptr(this_arg);
74987         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74989         this_arg_conv.is_owned = false;
74990         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
74991         *ret_copy = RawBolt11Invoice_payment_secret(&this_arg_conv);
74992         int64_t ret_ref = tag_ptr(ret_copy, true);
74993         return ret_ref;
74994 }
74995
74996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
74997         LDKRawBolt11Invoice this_arg_conv;
74998         this_arg_conv.inner = untag_ptr(this_arg);
74999         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75001         this_arg_conv.is_owned = false;
75002         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
75003         *ret_copy = RawBolt11Invoice_payment_metadata(&this_arg_conv);
75004         int64_t ret_ref = tag_ptr(ret_copy, true);
75005         return ret_ref;
75006 }
75007
75008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
75009         LDKRawBolt11Invoice this_arg_conv;
75010         this_arg_conv.inner = untag_ptr(this_arg);
75011         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75013         this_arg_conv.is_owned = false;
75014         LDKBolt11InvoiceFeatures ret_var = RawBolt11Invoice_features(&this_arg_conv);
75015         int64_t ret_ref = 0;
75016         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75017         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75018         return ret_ref;
75019 }
75020
75021 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
75022         LDKRawBolt11Invoice this_arg_conv;
75023         this_arg_conv.inner = untag_ptr(this_arg);
75024         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75026         this_arg_conv.is_owned = false;
75027         LDKCVec_PrivateRouteZ ret_var = RawBolt11Invoice_private_routes(&this_arg_conv);
75028         int64_tArray ret_arr = NULL;
75029         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
75030         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
75031         for (size_t o = 0; o < ret_var.datalen; o++) {
75032                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
75033                 int64_t ret_conv_14_ref = 0;
75034                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
75035                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
75036                 ret_arr_ptr[o] = ret_conv_14_ref;
75037         }
75038         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
75039         FREE(ret_var.data);
75040         return ret_arr;
75041 }
75042
75043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
75044         LDKRawBolt11Invoice this_arg_conv;
75045         this_arg_conv.inner = untag_ptr(this_arg);
75046         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75048         this_arg_conv.is_owned = false;
75049         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
75050         *ret_copy = RawBolt11Invoice_amount_pico_btc(&this_arg_conv);
75051         int64_t ret_ref = tag_ptr(ret_copy, true);
75052         return ret_ref;
75053 }
75054
75055 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
75056         LDKRawBolt11Invoice this_arg_conv;
75057         this_arg_conv.inner = untag_ptr(this_arg);
75058         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75060         this_arg_conv.is_owned = false;
75061         jclass ret_conv = LDKCurrency_to_java(env, RawBolt11Invoice_currency(&this_arg_conv));
75062         return ret_conv;
75063 }
75064
75065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
75066         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
75067         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
75068         return tag_ptr(ret_conv, true);
75069 }
75070
75071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
75072         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
75073         *ret_conv = PositiveTimestamp_from_system_time(time);
75074         return tag_ptr(ret_conv, true);
75075 }
75076
75077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t duration) {
75078         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
75079         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
75080         return tag_ptr(ret_conv, true);
75081 }
75082
75083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
75084         LDKPositiveTimestamp this_arg_conv;
75085         this_arg_conv.inner = untag_ptr(this_arg);
75086         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75088         this_arg_conv.is_owned = false;
75089         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
75090         return ret_conv;
75091 }
75092
75093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
75094         LDKPositiveTimestamp this_arg_conv;
75095         this_arg_conv.inner = untag_ptr(this_arg);
75096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75098         this_arg_conv.is_owned = false;
75099         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
75100         return ret_conv;
75101 }
75102
75103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
75104         LDKPositiveTimestamp this_arg_conv;
75105         this_arg_conv.inner = untag_ptr(this_arg);
75106         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75108         this_arg_conv.is_owned = false;
75109         int64_t ret_conv = PositiveTimestamp_as_time(&this_arg_conv);
75110         return ret_conv;
75111 }
75112
75113 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
75114         LDKBolt11Invoice this_arg_conv;
75115         this_arg_conv.inner = untag_ptr(this_arg);
75116         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75118         this_arg_conv.is_owned = false;
75119         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
75120         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt11Invoice_signable_hash(&this_arg_conv).data);
75121         return ret_arr;
75122 }
75123
75124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
75125         LDKBolt11Invoice this_arg_conv;
75126         this_arg_conv.inner = untag_ptr(this_arg);
75127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75129         this_arg_conv = Bolt11Invoice_clone(&this_arg_conv);
75130         LDKSignedRawBolt11Invoice ret_var = Bolt11Invoice_into_signed_raw(this_arg_conv);
75131         int64_t ret_ref = 0;
75132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75134         return ret_ref;
75135 }
75136
75137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
75138         LDKBolt11Invoice this_arg_conv;
75139         this_arg_conv.inner = untag_ptr(this_arg);
75140         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75142         this_arg_conv.is_owned = false;
75143         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
75144         *ret_conv = Bolt11Invoice_check_signature(&this_arg_conv);
75145         return tag_ptr(ret_conv, true);
75146 }
75147
75148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
75149         LDKSignedRawBolt11Invoice signed_invoice_conv;
75150         signed_invoice_conv.inner = untag_ptr(signed_invoice);
75151         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
75152         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
75153         signed_invoice_conv = SignedRawBolt11Invoice_clone(&signed_invoice_conv);
75154         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
75155         *ret_conv = Bolt11Invoice_from_signed(signed_invoice_conv);
75156         return tag_ptr(ret_conv, true);
75157 }
75158
75159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
75160         LDKBolt11Invoice this_arg_conv;
75161         this_arg_conv.inner = untag_ptr(this_arg);
75162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75164         this_arg_conv.is_owned = false;
75165         int64_t ret_conv = Bolt11Invoice_timestamp(&this_arg_conv);
75166         return ret_conv;
75167 }
75168
75169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
75170         LDKBolt11Invoice this_arg_conv;
75171         this_arg_conv.inner = untag_ptr(this_arg);
75172         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75174         this_arg_conv.is_owned = false;
75175         int64_t ret_conv = Bolt11Invoice_duration_since_epoch(&this_arg_conv);
75176         return ret_conv;
75177 }
75178
75179 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
75180         LDKBolt11Invoice this_arg_conv;
75181         this_arg_conv.inner = untag_ptr(this_arg);
75182         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75184         this_arg_conv.is_owned = false;
75185         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
75186         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Bolt11Invoice_payment_hash(&this_arg_conv));
75187         return ret_arr;
75188 }
75189
75190 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
75191         LDKBolt11Invoice this_arg_conv;
75192         this_arg_conv.inner = untag_ptr(this_arg);
75193         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75195         this_arg_conv.is_owned = false;
75196         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
75197         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt11Invoice_payee_pub_key(&this_arg_conv).compressed_form);
75198         return ret_arr;
75199 }
75200
75201 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
75202         LDKBolt11Invoice this_arg_conv;
75203         this_arg_conv.inner = untag_ptr(this_arg);
75204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75206         this_arg_conv.is_owned = false;
75207         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
75208         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Bolt11Invoice_payment_secret(&this_arg_conv));
75209         return ret_arr;
75210 }
75211
75212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
75213         LDKBolt11Invoice this_arg_conv;
75214         this_arg_conv.inner = untag_ptr(this_arg);
75215         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75217         this_arg_conv.is_owned = false;
75218         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
75219         *ret_copy = Bolt11Invoice_payment_metadata(&this_arg_conv);
75220         int64_t ret_ref = tag_ptr(ret_copy, true);
75221         return ret_ref;
75222 }
75223
75224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
75225         LDKBolt11Invoice this_arg_conv;
75226         this_arg_conv.inner = untag_ptr(this_arg);
75227         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75229         this_arg_conv.is_owned = false;
75230         LDKBolt11InvoiceFeatures ret_var = Bolt11Invoice_features(&this_arg_conv);
75231         int64_t ret_ref = 0;
75232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75234         return ret_ref;
75235 }
75236
75237 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
75238         LDKBolt11Invoice this_arg_conv;
75239         this_arg_conv.inner = untag_ptr(this_arg);
75240         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75242         this_arg_conv.is_owned = false;
75243         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
75244         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt11Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
75245         return ret_arr;
75246 }
75247
75248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1expires_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
75249         LDKBolt11Invoice this_arg_conv;
75250         this_arg_conv.inner = untag_ptr(this_arg);
75251         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75253         this_arg_conv.is_owned = false;
75254         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
75255         *ret_copy = Bolt11Invoice_expires_at(&this_arg_conv);
75256         int64_t ret_ref = tag_ptr(ret_copy, true);
75257         return ret_ref;
75258 }
75259
75260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
75261         LDKBolt11Invoice this_arg_conv;
75262         this_arg_conv.inner = untag_ptr(this_arg);
75263         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75265         this_arg_conv.is_owned = false;
75266         int64_t ret_conv = Bolt11Invoice_expiry_time(&this_arg_conv);
75267         return ret_conv;
75268 }
75269
75270 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
75271         LDKBolt11Invoice this_arg_conv;
75272         this_arg_conv.inner = untag_ptr(this_arg);
75273         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75275         this_arg_conv.is_owned = false;
75276         jboolean ret_conv = Bolt11Invoice_is_expired(&this_arg_conv);
75277         return ret_conv;
75278 }
75279
75280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1duration_1until_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
75281         LDKBolt11Invoice this_arg_conv;
75282         this_arg_conv.inner = untag_ptr(this_arg);
75283         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75285         this_arg_conv.is_owned = false;
75286         int64_t ret_conv = Bolt11Invoice_duration_until_expiry(&this_arg_conv);
75287         return ret_conv;
75288 }
75289
75290 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) {
75291         LDKBolt11Invoice this_arg_conv;
75292         this_arg_conv.inner = untag_ptr(this_arg);
75293         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75295         this_arg_conv.is_owned = false;
75296         int64_t ret_conv = Bolt11Invoice_expiration_remaining_from_epoch(&this_arg_conv, time);
75297         return ret_conv;
75298 }
75299
75300 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1would_1expire(JNIEnv *env, jclass clz, int64_t this_arg, int64_t at_time) {
75301         LDKBolt11Invoice this_arg_conv;
75302         this_arg_conv.inner = untag_ptr(this_arg);
75303         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75305         this_arg_conv.is_owned = false;
75306         jboolean ret_conv = Bolt11Invoice_would_expire(&this_arg_conv, at_time);
75307         return ret_conv;
75308 }
75309
75310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1min_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
75311         LDKBolt11Invoice this_arg_conv;
75312         this_arg_conv.inner = untag_ptr(this_arg);
75313         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75315         this_arg_conv.is_owned = false;
75316         int64_t ret_conv = Bolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
75317         return ret_conv;
75318 }
75319
75320 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1fallback_1addresses(JNIEnv *env, jclass clz, int64_t this_arg) {
75321         LDKBolt11Invoice this_arg_conv;
75322         this_arg_conv.inner = untag_ptr(this_arg);
75323         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75325         this_arg_conv.is_owned = false;
75326         LDKCVec_StrZ ret_var = Bolt11Invoice_fallback_addresses(&this_arg_conv);
75327         jobjectArray ret_arr = NULL;
75328         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, String_clz, NULL);
75329         ;
75330         jstring *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
75331         for (size_t i = 0; i < ret_var.datalen; i++) {
75332                 LDKStr ret_conv_8_str = ret_var.data[i];
75333                 jstring ret_conv_8_conv = str_ref_to_java(env, ret_conv_8_str.chars, ret_conv_8_str.len);
75334                 Str_free(ret_conv_8_str);
75335                 ret_arr_ptr[i] = ret_conv_8_conv;
75336         }
75337         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
75338         FREE(ret_var.data);
75339         return ret_arr;
75340 }
75341
75342 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
75343         LDKBolt11Invoice this_arg_conv;
75344         this_arg_conv.inner = untag_ptr(this_arg);
75345         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75347         this_arg_conv.is_owned = false;
75348         LDKCVec_PrivateRouteZ ret_var = Bolt11Invoice_private_routes(&this_arg_conv);
75349         int64_tArray ret_arr = NULL;
75350         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
75351         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
75352         for (size_t o = 0; o < ret_var.datalen; o++) {
75353                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
75354                 int64_t ret_conv_14_ref = 0;
75355                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
75356                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
75357                 ret_arr_ptr[o] = ret_conv_14_ref;
75358         }
75359         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
75360         FREE(ret_var.data);
75361         return ret_arr;
75362 }
75363
75364 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
75365         LDKBolt11Invoice this_arg_conv;
75366         this_arg_conv.inner = untag_ptr(this_arg);
75367         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75369         this_arg_conv.is_owned = false;
75370         LDKCVec_RouteHintZ ret_var = Bolt11Invoice_route_hints(&this_arg_conv);
75371         int64_tArray ret_arr = NULL;
75372         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
75373         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
75374         for (size_t l = 0; l < ret_var.datalen; l++) {
75375                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
75376                 int64_t ret_conv_11_ref = 0;
75377                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
75378                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
75379                 ret_arr_ptr[l] = ret_conv_11_ref;
75380         }
75381         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
75382         FREE(ret_var.data);
75383         return ret_arr;
75384 }
75385
75386 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
75387         LDKBolt11Invoice this_arg_conv;
75388         this_arg_conv.inner = untag_ptr(this_arg);
75389         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75391         this_arg_conv.is_owned = false;
75392         jclass ret_conv = LDKCurrency_to_java(env, Bolt11Invoice_currency(&this_arg_conv));
75393         return ret_conv;
75394 }
75395
75396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1amount_1milli_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
75397         LDKBolt11Invoice this_arg_conv;
75398         this_arg_conv.inner = untag_ptr(this_arg);
75399         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75401         this_arg_conv.is_owned = false;
75402         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
75403         *ret_copy = Bolt11Invoice_amount_milli_satoshis(&this_arg_conv);
75404         int64_t ret_ref = tag_ptr(ret_copy, true);
75405         return ret_ref;
75406 }
75407
75408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
75409         LDKStr description_conv = java_to_owned_str(env, description);
75410         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
75411         *ret_conv = Description_new(description_conv);
75412         return tag_ptr(ret_conv, true);
75413 }
75414
75415 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
75416         LDKDescription this_arg_conv;
75417         this_arg_conv.inner = untag_ptr(this_arg);
75418         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75420         this_arg_conv = Description_clone(&this_arg_conv);
75421         LDKStr ret_str = Description_into_inner(this_arg_conv);
75422         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
75423         Str_free(ret_str);
75424         return ret_conv;
75425 }
75426
75427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
75428         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
75429         int64_t ret_ref = 0;
75430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75432         return ret_ref;
75433 }
75434
75435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
75436         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
75437         int64_t ret_ref = 0;
75438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75440         return ret_ref;
75441 }
75442
75443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
75444         LDKExpiryTime this_arg_conv;
75445         this_arg_conv.inner = untag_ptr(this_arg);
75446         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75448         this_arg_conv.is_owned = false;
75449         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
75450         return ret_conv;
75451 }
75452
75453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
75454         LDKExpiryTime this_arg_conv;
75455         this_arg_conv.inner = untag_ptr(this_arg);
75456         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75458         this_arg_conv.is_owned = false;
75459         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
75460         return ret_conv;
75461 }
75462
75463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
75464         LDKRouteHint hops_conv;
75465         hops_conv.inner = untag_ptr(hops);
75466         hops_conv.is_owned = ptr_is_owned(hops);
75467         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
75468         hops_conv = RouteHint_clone(&hops_conv);
75469         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
75470         *ret_conv = PrivateRoute_new(hops_conv);
75471         return tag_ptr(ret_conv, true);
75472 }
75473
75474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
75475         LDKPrivateRoute this_arg_conv;
75476         this_arg_conv.inner = untag_ptr(this_arg);
75477         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75479         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
75480         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
75481         int64_t ret_ref = 0;
75482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75484         return ret_ref;
75485 }
75486
75487 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75488         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
75489         jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
75490         return ret_conv;
75491 }
75492
75493 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
75494         jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
75495         return ret_conv;
75496 }
75497
75498 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
75499         jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
75500         return ret_conv;
75501 }
75502
75503 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
75504         jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
75505         return ret_conv;
75506 }
75507
75508 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) {
75509         jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount());
75510         return ret_conv;
75511 }
75512
75513 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1missing_1route_1hints(JNIEnv *env, jclass clz) {
75514         jclass ret_conv = LDKCreationError_to_java(env, CreationError_missing_route_hints());
75515         return ret_conv;
75516 }
75517
75518 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1min_1final_1cltv_1expiry_1delta_1too_1short(JNIEnv *env, jclass clz) {
75519         jclass ret_conv = LDKCreationError_to_java(env, CreationError_min_final_cltv_expiry_delta_too_short());
75520         return ret_conv;
75521 }
75522
75523 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
75524         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
75525         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
75526         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
75527         return ret_conv;
75528 }
75529
75530 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
75531         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
75532         LDKStr ret_str = CreationError_to_str(o_conv);
75533         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
75534         Str_free(ret_str);
75535         return ret_conv;
75536 }
75537
75538 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75539         LDKBolt11SemanticError* orig_conv = (LDKBolt11SemanticError*)untag_ptr(orig);
75540         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_clone(orig_conv));
75541         return ret_conv;
75542 }
75543
75544 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
75545         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_payment_hash());
75546         return ret_conv;
75547 }
75548
75549 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
75550         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_payment_hashes());
75551         return ret_conv;
75552 }
75553
75554 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1description(JNIEnv *env, jclass clz) {
75555         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_description());
75556         return ret_conv;
75557 }
75558
75559 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
75560         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_descriptions());
75561         return ret_conv;
75562 }
75563
75564 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
75565         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_payment_secret());
75566         return ret_conv;
75567 }
75568
75569 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
75570         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_payment_secrets());
75571         return ret_conv;
75572 }
75573
75574 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
75575         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_features());
75576         return ret_conv;
75577 }
75578
75579 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
75580         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_recovery_id());
75581         return ret_conv;
75582 }
75583
75584 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
75585         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_signature());
75586         return ret_conv;
75587 }
75588
75589 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
75590         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_imprecise_amount());
75591         return ret_conv;
75592 }
75593
75594 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
75595         LDKBolt11SemanticError* a_conv = (LDKBolt11SemanticError*)untag_ptr(a);
75596         LDKBolt11SemanticError* b_conv = (LDKBolt11SemanticError*)untag_ptr(b);
75597         jboolean ret_conv = Bolt11SemanticError_eq(a_conv, b_conv);
75598         return ret_conv;
75599 }
75600
75601 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
75602         LDKBolt11SemanticError* o_conv = (LDKBolt11SemanticError*)untag_ptr(o);
75603         LDKStr ret_str = Bolt11SemanticError_to_str(o_conv);
75604         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
75605         Str_free(ret_str);
75606         return ret_conv;
75607 }
75608
75609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75610         if (!ptr_is_owned(this_ptr)) return;
75611         void* this_ptr_ptr = untag_ptr(this_ptr);
75612         CHECK_ACCESS(this_ptr_ptr);
75613         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
75614         FREE(untag_ptr(this_ptr));
75615         SignOrCreationError_free(this_ptr_conv);
75616 }
75617
75618 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
75619         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
75620         *ret_copy = SignOrCreationError_clone(arg);
75621         int64_t ret_ref = tag_ptr(ret_copy, true);
75622         return ret_ref;
75623 }
75624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75625         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
75626         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
75627         return ret_conv;
75628 }
75629
75630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75631         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
75632         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
75633         *ret_copy = SignOrCreationError_clone(orig_conv);
75634         int64_t ret_ref = tag_ptr(ret_copy, true);
75635         return ret_ref;
75636 }
75637
75638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
75639         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
75640         *ret_copy = SignOrCreationError_sign_error();
75641         int64_t ret_ref = tag_ptr(ret_copy, true);
75642         return ret_ref;
75643 }
75644
75645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
75646         LDKCreationError a_conv = LDKCreationError_from_java(env, a);
75647         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
75648         *ret_copy = SignOrCreationError_creation_error(a_conv);
75649         int64_t ret_ref = tag_ptr(ret_copy, true);
75650         return ret_ref;
75651 }
75652
75653 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
75654         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
75655         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
75656         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
75657         return ret_conv;
75658 }
75659
75660 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
75661         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
75662         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
75663         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
75664         Str_free(ret_str);
75665         return ret_conv;
75666 }
75667
75668 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) {
75669         LDKBolt11Invoice invoice_conv;
75670         invoice_conv.inner = untag_ptr(invoice);
75671         invoice_conv.is_owned = ptr_is_owned(invoice);
75672         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
75673         invoice_conv.is_owned = false;
75674         void* retry_strategy_ptr = untag_ptr(retry_strategy);
75675         CHECK_ACCESS(retry_strategy_ptr);
75676         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
75677         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
75678         LDKChannelManager channelmanager_conv;
75679         channelmanager_conv.inner = untag_ptr(channelmanager);
75680         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
75681         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
75682         channelmanager_conv.is_owned = false;
75683         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
75684         *ret_conv = pay_invoice(&invoice_conv, retry_strategy_conv, &channelmanager_conv);
75685         return tag_ptr(ret_conv, true);
75686 }
75687
75688 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) {
75689         LDKBolt11Invoice invoice_conv;
75690         invoice_conv.inner = untag_ptr(invoice);
75691         invoice_conv.is_owned = ptr_is_owned(invoice);
75692         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
75693         invoice_conv.is_owned = false;
75694         LDKThirtyTwoBytes payment_id_ref;
75695         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
75696         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
75697         void* retry_strategy_ptr = untag_ptr(retry_strategy);
75698         CHECK_ACCESS(retry_strategy_ptr);
75699         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
75700         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
75701         LDKChannelManager channelmanager_conv;
75702         channelmanager_conv.inner = untag_ptr(channelmanager);
75703         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
75704         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
75705         channelmanager_conv.is_owned = false;
75706         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
75707         *ret_conv = pay_invoice_with_id(&invoice_conv, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
75708         return tag_ptr(ret_conv, true);
75709 }
75710
75711 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) {
75712         LDKBolt11Invoice invoice_conv;
75713         invoice_conv.inner = untag_ptr(invoice);
75714         invoice_conv.is_owned = ptr_is_owned(invoice);
75715         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
75716         invoice_conv.is_owned = false;
75717         void* retry_strategy_ptr = untag_ptr(retry_strategy);
75718         CHECK_ACCESS(retry_strategy_ptr);
75719         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
75720         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
75721         LDKChannelManager channelmanager_conv;
75722         channelmanager_conv.inner = untag_ptr(channelmanager);
75723         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
75724         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
75725         channelmanager_conv.is_owned = false;
75726         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
75727         *ret_conv = pay_zero_value_invoice(&invoice_conv, amount_msats, retry_strategy_conv, &channelmanager_conv);
75728         return tag_ptr(ret_conv, true);
75729 }
75730
75731 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) {
75732         LDKBolt11Invoice invoice_conv;
75733         invoice_conv.inner = untag_ptr(invoice);
75734         invoice_conv.is_owned = ptr_is_owned(invoice);
75735         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
75736         invoice_conv.is_owned = false;
75737         LDKThirtyTwoBytes payment_id_ref;
75738         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
75739         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
75740         void* retry_strategy_ptr = untag_ptr(retry_strategy);
75741         CHECK_ACCESS(retry_strategy_ptr);
75742         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
75743         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
75744         LDKChannelManager channelmanager_conv;
75745         channelmanager_conv.inner = untag_ptr(channelmanager);
75746         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
75747         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
75748         channelmanager_conv.is_owned = false;
75749         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
75750         *ret_conv = pay_zero_value_invoice_with_id(&invoice_conv, amount_msats, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
75751         return tag_ptr(ret_conv, true);
75752 }
75753
75754 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) {
75755         LDKBolt11Invoice invoice_conv;
75756         invoice_conv.inner = untag_ptr(invoice);
75757         invoice_conv.is_owned = ptr_is_owned(invoice);
75758         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
75759         invoice_conv.is_owned = false;
75760         LDKChannelManager channelmanager_conv;
75761         channelmanager_conv.inner = untag_ptr(channelmanager);
75762         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
75763         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
75764         channelmanager_conv.is_owned = false;
75765         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
75766         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
75767         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
75768         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
75769         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
75770         *ret_conv = preflight_probe_invoice(&invoice_conv, &channelmanager_conv, liquidity_limit_multiplier_conv);
75771         return tag_ptr(ret_conv, true);
75772 }
75773
75774 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) {
75775         LDKBolt11Invoice invoice_conv;
75776         invoice_conv.inner = untag_ptr(invoice);
75777         invoice_conv.is_owned = ptr_is_owned(invoice);
75778         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
75779         invoice_conv.is_owned = false;
75780         LDKChannelManager channelmanager_conv;
75781         channelmanager_conv.inner = untag_ptr(channelmanager);
75782         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
75783         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
75784         channelmanager_conv.is_owned = false;
75785         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
75786         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
75787         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
75788         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
75789         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
75790         *ret_conv = preflight_probe_zero_value_invoice(&invoice_conv, amount_msat, &channelmanager_conv, liquidity_limit_multiplier_conv);
75791         return tag_ptr(ret_conv, true);
75792 }
75793
75794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75795         if (!ptr_is_owned(this_ptr)) return;
75796         void* this_ptr_ptr = untag_ptr(this_ptr);
75797         CHECK_ACCESS(this_ptr_ptr);
75798         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
75799         FREE(untag_ptr(this_ptr));
75800         PaymentError_free(this_ptr_conv);
75801 }
75802
75803 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
75804         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
75805         *ret_copy = PaymentError_clone(arg);
75806         int64_t ret_ref = tag_ptr(ret_copy, true);
75807         return ret_ref;
75808 }
75809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75810         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
75811         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
75812         return ret_conv;
75813 }
75814
75815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75816         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
75817         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
75818         *ret_copy = PaymentError_clone(orig_conv);
75819         int64_t ret_ref = tag_ptr(ret_copy, true);
75820         return ret_ref;
75821 }
75822
75823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1invoice(JNIEnv *env, jclass clz, jstring a) {
75824         LDKStr a_conv = java_to_owned_str(env, a);
75825         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
75826         *ret_copy = PaymentError_invoice(a_conv);
75827         int64_t ret_ref = tag_ptr(ret_copy, true);
75828         return ret_ref;
75829 }
75830
75831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1sending(JNIEnv *env, jclass clz, jclass a) {
75832         LDKRetryableSendFailure a_conv = LDKRetryableSendFailure_from_java(env, a);
75833         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
75834         *ret_copy = PaymentError_sending(a_conv);
75835         int64_t ret_ref = tag_ptr(ret_copy, true);
75836         return ret_ref;
75837 }
75838
75839 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
75840         LDKPaymentError* a_conv = (LDKPaymentError*)untag_ptr(a);
75841         LDKPaymentError* b_conv = (LDKPaymentError*)untag_ptr(b);
75842         jboolean ret_conv = PaymentError_eq(a_conv, b_conv);
75843         return ret_conv;
75844 }
75845
75846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbingError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75847         if (!ptr_is_owned(this_ptr)) return;
75848         void* this_ptr_ptr = untag_ptr(this_ptr);
75849         CHECK_ACCESS(this_ptr_ptr);
75850         LDKProbingError this_ptr_conv = *(LDKProbingError*)(this_ptr_ptr);
75851         FREE(untag_ptr(this_ptr));
75852         ProbingError_free(this_ptr_conv);
75853 }
75854
75855 static inline uint64_t ProbingError_clone_ptr(LDKProbingError *NONNULL_PTR arg) {
75856         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
75857         *ret_copy = ProbingError_clone(arg);
75858         int64_t ret_ref = tag_ptr(ret_copy, true);
75859         return ret_ref;
75860 }
75861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbingError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75862         LDKProbingError* arg_conv = (LDKProbingError*)untag_ptr(arg);
75863         int64_t ret_conv = ProbingError_clone_ptr(arg_conv);
75864         return ret_conv;
75865 }
75866
75867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbingError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75868         LDKProbingError* orig_conv = (LDKProbingError*)untag_ptr(orig);
75869         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
75870         *ret_copy = ProbingError_clone(orig_conv);
75871         int64_t ret_ref = tag_ptr(ret_copy, true);
75872         return ret_ref;
75873 }
75874
75875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbingError_1invoice(JNIEnv *env, jclass clz, jstring a) {
75876         LDKStr a_conv = java_to_owned_str(env, a);
75877         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
75878         *ret_copy = ProbingError_invoice(a_conv);
75879         int64_t ret_ref = tag_ptr(ret_copy, true);
75880         return ret_ref;
75881 }
75882
75883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbingError_1sending(JNIEnv *env, jclass clz, int64_t a) {
75884         void* a_ptr = untag_ptr(a);
75885         CHECK_ACCESS(a_ptr);
75886         LDKProbeSendFailure a_conv = *(LDKProbeSendFailure*)(a_ptr);
75887         a_conv = ProbeSendFailure_clone((LDKProbeSendFailure*)untag_ptr(a));
75888         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
75889         *ret_copy = ProbingError_sending(a_conv);
75890         int64_t ret_ref = tag_ptr(ret_copy, true);
75891         return ret_ref;
75892 }
75893
75894 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ProbingError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
75895         LDKProbingError* a_conv = (LDKProbingError*)untag_ptr(a);
75896         LDKProbingError* b_conv = (LDKProbingError*)untag_ptr(b);
75897         jboolean ret_conv = ProbingError_eq(a_conv, b_conv);
75898         return ret_conv;
75899 }
75900
75901 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) {
75902         void* amt_msat_ptr = untag_ptr(amt_msat);
75903         CHECK_ACCESS(amt_msat_ptr);
75904         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
75905         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
75906         void* payment_hash_ptr = untag_ptr(payment_hash);
75907         CHECK_ACCESS(payment_hash_ptr);
75908         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
75909         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
75910         LDKStr description_conv = java_to_owned_str(env, description);
75911         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
75912         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
75913         if (phantom_route_hints_constr.datalen > 0)
75914                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
75915         else
75916                 phantom_route_hints_constr.data = NULL;
75917         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
75918         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
75919                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
75920                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
75921                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
75922                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
75923                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
75924                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
75925                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
75926         }
75927         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
75928         void* entropy_source_ptr = untag_ptr(entropy_source);
75929         CHECK_ACCESS(entropy_source_ptr);
75930         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
75931         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
75932                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75933                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
75934         }
75935         void* node_signer_ptr = untag_ptr(node_signer);
75936         CHECK_ACCESS(node_signer_ptr);
75937         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
75938         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
75939                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75940                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
75941         }
75942         void* logger_ptr = untag_ptr(logger);
75943         CHECK_ACCESS(logger_ptr);
75944         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75945         if (logger_conv.free == LDKLogger_JCalls_free) {
75946                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75947                 LDKLogger_JCalls_cloned(&logger_conv);
75948         }
75949         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
75950         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
75951         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
75952         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
75953         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
75954         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
75955         *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);
75956         return tag_ptr(ret_conv, true);
75957 }
75958
75959 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) {
75960         void* amt_msat_ptr = untag_ptr(amt_msat);
75961         CHECK_ACCESS(amt_msat_ptr);
75962         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
75963         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
75964         void* payment_hash_ptr = untag_ptr(payment_hash);
75965         CHECK_ACCESS(payment_hash_ptr);
75966         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
75967         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
75968         LDKSha256 description_hash_conv;
75969         description_hash_conv.inner = untag_ptr(description_hash);
75970         description_hash_conv.is_owned = ptr_is_owned(description_hash);
75971         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
75972         description_hash_conv = Sha256_clone(&description_hash_conv);
75973         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
75974         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
75975         if (phantom_route_hints_constr.datalen > 0)
75976                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
75977         else
75978                 phantom_route_hints_constr.data = NULL;
75979         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
75980         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
75981                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
75982                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
75983                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
75984                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
75985                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
75986                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
75987                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
75988         }
75989         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
75990         void* entropy_source_ptr = untag_ptr(entropy_source);
75991         CHECK_ACCESS(entropy_source_ptr);
75992         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
75993         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
75994                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75995                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
75996         }
75997         void* node_signer_ptr = untag_ptr(node_signer);
75998         CHECK_ACCESS(node_signer_ptr);
75999         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
76000         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
76001                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76002                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
76003         }
76004         void* logger_ptr = untag_ptr(logger);
76005         CHECK_ACCESS(logger_ptr);
76006         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76007         if (logger_conv.free == LDKLogger_JCalls_free) {
76008                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76009                 LDKLogger_JCalls_cloned(&logger_conv);
76010         }
76011         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
76012         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
76013         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
76014         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
76015         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
76016         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
76017         *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);
76018         return tag_ptr(ret_conv, true);
76019 }
76020
76021 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) {
76022         LDKChannelManager channelmanager_conv;
76023         channelmanager_conv.inner = untag_ptr(channelmanager);
76024         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
76025         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
76026         channelmanager_conv.is_owned = false;
76027         void* node_signer_ptr = untag_ptr(node_signer);
76028         CHECK_ACCESS(node_signer_ptr);
76029         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
76030         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
76031                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76032                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
76033         }
76034         void* logger_ptr = untag_ptr(logger);
76035         CHECK_ACCESS(logger_ptr);
76036         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76037         if (logger_conv.free == LDKLogger_JCalls_free) {
76038                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76039                 LDKLogger_JCalls_cloned(&logger_conv);
76040         }
76041         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
76042         void* amt_msat_ptr = untag_ptr(amt_msat);
76043         CHECK_ACCESS(amt_msat_ptr);
76044         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
76045         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
76046         LDKStr description_conv = java_to_owned_str(env, description);
76047         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
76048         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
76049         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
76050         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
76051         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
76052         *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);
76053         return tag_ptr(ret_conv, true);
76054 }
76055
76056 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) {
76057         LDKChannelManager channelmanager_conv;
76058         channelmanager_conv.inner = untag_ptr(channelmanager);
76059         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
76060         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
76061         channelmanager_conv.is_owned = false;
76062         void* node_signer_ptr = untag_ptr(node_signer);
76063         CHECK_ACCESS(node_signer_ptr);
76064         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
76065         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
76066                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76067                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
76068         }
76069         void* logger_ptr = untag_ptr(logger);
76070         CHECK_ACCESS(logger_ptr);
76071         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76072         if (logger_conv.free == LDKLogger_JCalls_free) {
76073                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76074                 LDKLogger_JCalls_cloned(&logger_conv);
76075         }
76076         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
76077         void* amt_msat_ptr = untag_ptr(amt_msat);
76078         CHECK_ACCESS(amt_msat_ptr);
76079         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
76080         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
76081         LDKSha256 description_hash_conv;
76082         description_hash_conv.inner = untag_ptr(description_hash);
76083         description_hash_conv.is_owned = ptr_is_owned(description_hash);
76084         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
76085         description_hash_conv = Sha256_clone(&description_hash_conv);
76086         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
76087         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
76088         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
76089         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
76090         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
76091         *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);
76092         return tag_ptr(ret_conv, true);
76093 }
76094
76095 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) {
76096         LDKChannelManager channelmanager_conv;
76097         channelmanager_conv.inner = untag_ptr(channelmanager);
76098         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
76099         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
76100         channelmanager_conv.is_owned = false;
76101         void* node_signer_ptr = untag_ptr(node_signer);
76102         CHECK_ACCESS(node_signer_ptr);
76103         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
76104         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
76105                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76106                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
76107         }
76108         void* logger_ptr = untag_ptr(logger);
76109         CHECK_ACCESS(logger_ptr);
76110         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76111         if (logger_conv.free == LDKLogger_JCalls_free) {
76112                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76113                 LDKLogger_JCalls_cloned(&logger_conv);
76114         }
76115         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
76116         void* amt_msat_ptr = untag_ptr(amt_msat);
76117         CHECK_ACCESS(amt_msat_ptr);
76118         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
76119         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
76120         LDKSha256 description_hash_conv;
76121         description_hash_conv.inner = untag_ptr(description_hash);
76122         description_hash_conv.is_owned = ptr_is_owned(description_hash);
76123         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
76124         description_hash_conv = Sha256_clone(&description_hash_conv);
76125         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
76126         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
76127         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
76128         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
76129         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
76130         *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);
76131         return tag_ptr(ret_conv, true);
76132 }
76133
76134 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) {
76135         LDKChannelManager channelmanager_conv;
76136         channelmanager_conv.inner = untag_ptr(channelmanager);
76137         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
76138         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
76139         channelmanager_conv.is_owned = false;
76140         void* node_signer_ptr = untag_ptr(node_signer);
76141         CHECK_ACCESS(node_signer_ptr);
76142         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
76143         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
76144                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76145                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
76146         }
76147         void* logger_ptr = untag_ptr(logger);
76148         CHECK_ACCESS(logger_ptr);
76149         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76150         if (logger_conv.free == LDKLogger_JCalls_free) {
76151                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76152                 LDKLogger_JCalls_cloned(&logger_conv);
76153         }
76154         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
76155         void* amt_msat_ptr = untag_ptr(amt_msat);
76156         CHECK_ACCESS(amt_msat_ptr);
76157         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
76158         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
76159         LDKStr description_conv = java_to_owned_str(env, description);
76160         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
76161         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
76162         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
76163         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
76164         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
76165         *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);
76166         return tag_ptr(ret_conv, true);
76167 }
76168
76169 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) {
76170         LDKChannelManager channelmanager_conv;
76171         channelmanager_conv.inner = untag_ptr(channelmanager);
76172         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
76173         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
76174         channelmanager_conv.is_owned = false;
76175         void* node_signer_ptr = untag_ptr(node_signer);
76176         CHECK_ACCESS(node_signer_ptr);
76177         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
76178         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
76179                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76180                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
76181         }
76182         void* logger_ptr = untag_ptr(logger);
76183         CHECK_ACCESS(logger_ptr);
76184         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76185         if (logger_conv.free == LDKLogger_JCalls_free) {
76186                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76187                 LDKLogger_JCalls_cloned(&logger_conv);
76188         }
76189         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
76190         void* amt_msat_ptr = untag_ptr(amt_msat);
76191         CHECK_ACCESS(amt_msat_ptr);
76192         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
76193         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
76194         LDKStr description_conv = java_to_owned_str(env, description);
76195         LDKThirtyTwoBytes payment_hash_ref;
76196         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
76197         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
76198         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
76199         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
76200         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
76201         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
76202         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
76203         *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);
76204         return tag_ptr(ret_conv, true);
76205 }
76206
76207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
76208         LDKStr s_conv = java_to_owned_str(env, s);
76209         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
76210         *ret_conv = SiPrefix_from_str(s_conv);
76211         return tag_ptr(ret_conv, true);
76212 }
76213
76214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
76215         LDKStr s_conv = java_to_owned_str(env, s);
76216         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
76217         *ret_conv = Bolt11Invoice_from_str(s_conv);
76218         return tag_ptr(ret_conv, true);
76219 }
76220
76221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
76222         LDKStr s_conv = java_to_owned_str(env, s);
76223         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
76224         *ret_conv = SignedRawBolt11Invoice_from_str(s_conv);
76225         return tag_ptr(ret_conv, true);
76226 }
76227
76228 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
76229         LDKBolt11ParseError* o_conv = (LDKBolt11ParseError*)untag_ptr(o);
76230         LDKStr ret_str = Bolt11ParseError_to_str(o_conv);
76231         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
76232         Str_free(ret_str);
76233         return ret_conv;
76234 }
76235
76236 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
76237         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
76238         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
76239         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
76240         Str_free(ret_str);
76241         return ret_conv;
76242 }
76243
76244 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
76245         LDKBolt11Invoice o_conv;
76246         o_conv.inner = untag_ptr(o);
76247         o_conv.is_owned = ptr_is_owned(o);
76248         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76249         o_conv.is_owned = false;
76250         LDKStr ret_str = Bolt11Invoice_to_str(&o_conv);
76251         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
76252         Str_free(ret_str);
76253         return ret_conv;
76254 }
76255
76256 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
76257         LDKSignedRawBolt11Invoice o_conv;
76258         o_conv.inner = untag_ptr(o);
76259         o_conv.is_owned = ptr_is_owned(o);
76260         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76261         o_conv.is_owned = false;
76262         LDKStr ret_str = SignedRawBolt11Invoice_to_str(&o_conv);
76263         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
76264         Str_free(ret_str);
76265         return ret_conv;
76266 }
76267
76268 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
76269         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
76270         LDKStr ret_str = Currency_to_str(o_conv);
76271         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
76272         Str_free(ret_str);
76273         return ret_conv;
76274 }
76275
76276 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
76277         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
76278         LDKStr ret_str = SiPrefix_to_str(o_conv);
76279         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
76280         Str_free(ret_str);
76281         return ret_conv;
76282 }
76283
76284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
76285         LDKRapidGossipSync this_obj_conv;
76286         this_obj_conv.inner = untag_ptr(this_obj);
76287         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76289         RapidGossipSync_free(this_obj_conv);
76290 }
76291
76292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger) {
76293         LDKNetworkGraph network_graph_conv;
76294         network_graph_conv.inner = untag_ptr(network_graph);
76295         network_graph_conv.is_owned = ptr_is_owned(network_graph);
76296         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
76297         network_graph_conv.is_owned = false;
76298         void* logger_ptr = untag_ptr(logger);
76299         CHECK_ACCESS(logger_ptr);
76300         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76301         if (logger_conv.free == LDKLogger_JCalls_free) {
76302                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76303                 LDKLogger_JCalls_cloned(&logger_conv);
76304         }
76305         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
76306         int64_t ret_ref = 0;
76307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76309         return ret_ref;
76310 }
76311
76312 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) {
76313         LDKRapidGossipSync this_arg_conv;
76314         this_arg_conv.inner = untag_ptr(this_arg);
76315         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76317         this_arg_conv.is_owned = false;
76318         LDKStr sync_path_conv = java_to_owned_str(env, sync_path);
76319         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
76320         *ret_conv = RapidGossipSync_sync_network_graph_with_file_path(&this_arg_conv, sync_path_conv);
76321         return tag_ptr(ret_conv, true);
76322 }
76323
76324 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) {
76325         LDKRapidGossipSync this_arg_conv;
76326         this_arg_conv.inner = untag_ptr(this_arg);
76327         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76329         this_arg_conv.is_owned = false;
76330         LDKu8slice update_data_ref;
76331         update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
76332         update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
76333         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
76334         *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
76335         (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
76336         return tag_ptr(ret_conv, true);
76337 }
76338
76339 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) {
76340         LDKRapidGossipSync this_arg_conv;
76341         this_arg_conv.inner = untag_ptr(this_arg);
76342         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76344         this_arg_conv.is_owned = false;
76345         LDKu8slice update_data_ref;
76346         update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
76347         update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
76348         void* current_time_unix_ptr = untag_ptr(current_time_unix);
76349         CHECK_ACCESS(current_time_unix_ptr);
76350         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
76351         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
76352         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
76353         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
76354         (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
76355         return tag_ptr(ret_conv, true);
76356 }
76357
76358 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1is_1initial_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_arg) {
76359         LDKRapidGossipSync this_arg_conv;
76360         this_arg_conv.inner = untag_ptr(this_arg);
76361         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76363         this_arg_conv.is_owned = false;
76364         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
76365         return ret_conv;
76366 }
76367
76368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
76369         if (!ptr_is_owned(this_ptr)) return;
76370         void* this_ptr_ptr = untag_ptr(this_ptr);
76371         CHECK_ACCESS(this_ptr_ptr);
76372         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
76373         FREE(untag_ptr(this_ptr));
76374         GraphSyncError_free(this_ptr_conv);
76375 }
76376
76377 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
76378         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
76379         *ret_copy = GraphSyncError_clone(arg);
76380         int64_t ret_ref = tag_ptr(ret_copy, true);
76381         return ret_ref;
76382 }
76383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76384         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
76385         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
76386         return ret_conv;
76387 }
76388
76389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
76390         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
76391         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
76392         *ret_copy = GraphSyncError_clone(orig_conv);
76393         int64_t ret_ref = tag_ptr(ret_copy, true);
76394         return ret_ref;
76395 }
76396
76397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1decode_1error(JNIEnv *env, jclass clz, int64_t a) {
76398         void* a_ptr = untag_ptr(a);
76399         CHECK_ACCESS(a_ptr);
76400         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
76401         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
76402         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
76403         *ret_copy = GraphSyncError_decode_error(a_conv);
76404         int64_t ret_ref = tag_ptr(ret_copy, true);
76405         return ret_ref;
76406 }
76407
76408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1lightning_1error(JNIEnv *env, jclass clz, int64_t a) {
76409         LDKLightningError a_conv;
76410         a_conv.inner = untag_ptr(a);
76411         a_conv.is_owned = ptr_is_owned(a);
76412         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76413         a_conv = LightningError_clone(&a_conv);
76414         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
76415         *ret_copy = GraphSyncError_lightning_error(a_conv);
76416         int64_t ret_ref = tag_ptr(ret_copy, true);
76417         return ret_ref;
76418 }
76419